@swc/anyformat-image 0.1.1 → 0.1.3
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/binding.d.ts +65 -0
- package/binding.js +62 -56
- package/index.d.ts +97 -0
- package/index.js +52 -10
- package/package.json +20 -10
package/binding.d.ts
CHANGED
|
@@ -9,6 +9,23 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
|
|
11
11
|
|
|
12
|
+
/** Returns the bounds of the pixels with a minimum alpha on the thread pool. */
|
|
13
|
+
export declare function alphaBounds(image: Uint8Array | RawImageInput, options?: AlphaBoundsOptions | undefined | null): Promise<Rect | null>
|
|
14
|
+
|
|
15
|
+
/** Options of `alphaBounds`. */
|
|
16
|
+
export interface AlphaBoundsOptions {
|
|
17
|
+
/** From 0 to 255. */
|
|
18
|
+
minAlpha?: number
|
|
19
|
+
/** The decode options for an input that is an encoded file. */
|
|
20
|
+
decode?: DecodeOptions
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns the smallest rectangle that contains every pixel whose alpha is
|
|
25
|
+
* `minAlpha` or more. Returns `null` when there is no such pixel.
|
|
26
|
+
*/
|
|
27
|
+
export declare function alphaBoundsSync(image: Uint8Array | RawImageInput, options?: AlphaBoundsOptions | undefined | null): Rect | null
|
|
28
|
+
|
|
12
29
|
/** Compares two images on the thread pool. */
|
|
13
30
|
export declare function compareImages(a: Uint8Array | RawImageInput, b: Uint8Array | RawImageInput, options?: CompareOptions | undefined | null): Promise<CompareResult>
|
|
14
31
|
|
|
@@ -65,6 +82,20 @@ export interface CompareResult {
|
|
|
65
82
|
diffEncoded: Buffer | null
|
|
66
83
|
}
|
|
67
84
|
|
|
85
|
+
/** Copies a rectangle of an image on the thread pool. */
|
|
86
|
+
export declare function crop(image: Uint8Array | RawImageInput, rect: RectInput, options?: CropOptions | undefined | null): Promise<RawImage | Buffer>
|
|
87
|
+
|
|
88
|
+
/** Options of `crop`. */
|
|
89
|
+
export interface CropOptions {
|
|
90
|
+
/** The decode options for an input that is an encoded file. */
|
|
91
|
+
decode?: DecodeOptions
|
|
92
|
+
/** 'raw' or encode options. */
|
|
93
|
+
output?: 'raw' | EncodeOptions | null
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Copies a rectangle of an image that is a raw image or an encoded file. */
|
|
97
|
+
export declare function cropSync(image: Uint8Array | RawImageInput, rect: RectInput, options?: CropOptions | undefined | null): RawImage | Buffer
|
|
98
|
+
|
|
68
99
|
/** Decodes an encoded image on the thread pool. */
|
|
69
100
|
export declare function decode(data: Uint8Array, options?: DecodeOptions | undefined | null): Promise<DecodedImage>
|
|
70
101
|
|
|
@@ -240,5 +271,39 @@ export interface Rect {
|
|
|
240
271
|
height: number
|
|
241
272
|
}
|
|
242
273
|
|
|
274
|
+
/** A rectangle from JavaScript. */
|
|
275
|
+
export interface RectInput {
|
|
276
|
+
/** The left edge. */
|
|
277
|
+
x: number
|
|
278
|
+
/** The top edge. */
|
|
279
|
+
y: number
|
|
280
|
+
/** The width. */
|
|
281
|
+
width: number
|
|
282
|
+
/** The height. */
|
|
283
|
+
height: number
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** Resizes an image on the thread pool. */
|
|
287
|
+
export declare function resize(image: Uint8Array | RawImageInput, options: ResizeOptions): Promise<RawImage | Buffer>
|
|
288
|
+
|
|
289
|
+
/** Options of `resize`. */
|
|
290
|
+
export interface ResizeOptions {
|
|
291
|
+
/** The target width. */
|
|
292
|
+
width?: number
|
|
293
|
+
/** The target height. */
|
|
294
|
+
height?: number
|
|
295
|
+
/** 'fill', 'inside', or 'outside'. */
|
|
296
|
+
fit?: string
|
|
297
|
+
/** 'box' or 'nearest'. */
|
|
298
|
+
filter?: string
|
|
299
|
+
/** The decode options for an input that is an encoded file. */
|
|
300
|
+
decode?: DecodeOptions
|
|
301
|
+
/** 'raw' or encode options. */
|
|
302
|
+
output?: 'raw' | EncodeOptions | null
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** Resizes an image that is a raw image or an encoded file. */
|
|
306
|
+
export declare function resizeSync(image: Uint8Array | RawImageInput, options: ResizeOptions): RawImage | Buffer
|
|
307
|
+
|
|
243
308
|
/** Returns the identifiers of every format that `detect` can return. */
|
|
244
309
|
export declare function supportedFormats(): Array<string>
|
package/binding.js
CHANGED
|
@@ -94,8 +94,8 @@ function requireNative() {
|
|
|
94
94
|
try {
|
|
95
95
|
const binding = require('@swc/anyformat-image-android-arm64')
|
|
96
96
|
const bindingPackageVersion = require('@swc/anyformat-image-android-arm64/package.json').version
|
|
97
|
-
if (bindingPackageVersion !== '0.1.
|
|
98
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
97
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
98
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
99
99
|
}
|
|
100
100
|
return binding
|
|
101
101
|
} catch (e) {
|
|
@@ -110,8 +110,8 @@ function requireNative() {
|
|
|
110
110
|
try {
|
|
111
111
|
const binding = require('@swc/anyformat-image-android-arm-eabi')
|
|
112
112
|
const bindingPackageVersion = require('@swc/anyformat-image-android-arm-eabi/package.json').version
|
|
113
|
-
if (bindingPackageVersion !== '0.1.
|
|
114
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
113
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
114
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
115
115
|
}
|
|
116
116
|
return binding
|
|
117
117
|
} catch (e) {
|
|
@@ -131,8 +131,8 @@ function requireNative() {
|
|
|
131
131
|
try {
|
|
132
132
|
const binding = require('@swc/anyformat-image-win32-x64-gnu')
|
|
133
133
|
const bindingPackageVersion = require('@swc/anyformat-image-win32-x64-gnu/package.json').version
|
|
134
|
-
if (bindingPackageVersion !== '0.1.
|
|
135
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
134
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
135
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
136
136
|
}
|
|
137
137
|
return binding
|
|
138
138
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@swc/anyformat-image-win32-x64-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@swc/anyformat-image-win32-x64-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
150
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -164,8 +164,8 @@ function requireNative() {
|
|
|
164
164
|
try {
|
|
165
165
|
const binding = require('@swc/anyformat-image-win32-ia32-msvc')
|
|
166
166
|
const bindingPackageVersion = require('@swc/anyformat-image-win32-ia32-msvc/package.json').version
|
|
167
|
-
if (bindingPackageVersion !== '0.1.
|
|
168
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
167
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
168
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
169
169
|
}
|
|
170
170
|
return binding
|
|
171
171
|
} catch (e) {
|
|
@@ -180,8 +180,8 @@ function requireNative() {
|
|
|
180
180
|
try {
|
|
181
181
|
const binding = require('@swc/anyformat-image-win32-arm64-msvc')
|
|
182
182
|
const bindingPackageVersion = require('@swc/anyformat-image-win32-arm64-msvc/package.json').version
|
|
183
|
-
if (bindingPackageVersion !== '0.1.
|
|
184
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
183
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
184
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
185
185
|
}
|
|
186
186
|
return binding
|
|
187
187
|
} catch (e) {
|
|
@@ -199,8 +199,8 @@ function requireNative() {
|
|
|
199
199
|
try {
|
|
200
200
|
const binding = require('@swc/anyformat-image-darwin-universal')
|
|
201
201
|
const bindingPackageVersion = require('@swc/anyformat-image-darwin-universal/package.json').version
|
|
202
|
-
if (bindingPackageVersion !== '0.1.
|
|
203
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
202
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
203
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
204
204
|
}
|
|
205
205
|
return binding
|
|
206
206
|
} catch (e) {
|
|
@@ -215,8 +215,8 @@ function requireNative() {
|
|
|
215
215
|
try {
|
|
216
216
|
const binding = require('@swc/anyformat-image-darwin-x64')
|
|
217
217
|
const bindingPackageVersion = require('@swc/anyformat-image-darwin-x64/package.json').version
|
|
218
|
-
if (bindingPackageVersion !== '0.1.
|
|
219
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
218
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
219
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
220
220
|
}
|
|
221
221
|
return binding
|
|
222
222
|
} catch (e) {
|
|
@@ -231,8 +231,8 @@ function requireNative() {
|
|
|
231
231
|
try {
|
|
232
232
|
const binding = require('@swc/anyformat-image-darwin-arm64')
|
|
233
233
|
const bindingPackageVersion = require('@swc/anyformat-image-darwin-arm64/package.json').version
|
|
234
|
-
if (bindingPackageVersion !== '0.1.
|
|
235
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
234
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
235
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
236
236
|
}
|
|
237
237
|
return binding
|
|
238
238
|
} catch (e) {
|
|
@@ -251,8 +251,8 @@ function requireNative() {
|
|
|
251
251
|
try {
|
|
252
252
|
const binding = require('@swc/anyformat-image-freebsd-x64')
|
|
253
253
|
const bindingPackageVersion = require('@swc/anyformat-image-freebsd-x64/package.json').version
|
|
254
|
-
if (bindingPackageVersion !== '0.1.
|
|
255
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
254
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
255
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
256
256
|
}
|
|
257
257
|
return binding
|
|
258
258
|
} catch (e) {
|
|
@@ -267,8 +267,8 @@ function requireNative() {
|
|
|
267
267
|
try {
|
|
268
268
|
const binding = require('@swc/anyformat-image-freebsd-arm64')
|
|
269
269
|
const bindingPackageVersion = require('@swc/anyformat-image-freebsd-arm64/package.json').version
|
|
270
|
-
if (bindingPackageVersion !== '0.1.
|
|
271
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
270
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
271
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
272
272
|
}
|
|
273
273
|
return binding
|
|
274
274
|
} catch (e) {
|
|
@@ -283,8 +283,8 @@ function requireNative() {
|
|
|
283
283
|
try {
|
|
284
284
|
const binding = require('@swc/anyformat-image-freebsd-ppc64')
|
|
285
285
|
const bindingPackageVersion = require('@swc/anyformat-image-freebsd-ppc64/package.json').version
|
|
286
|
-
if (bindingPackageVersion !== '0.1.
|
|
287
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
286
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
287
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
288
288
|
}
|
|
289
289
|
return binding
|
|
290
290
|
} catch (e) {
|
|
@@ -304,8 +304,8 @@ function requireNative() {
|
|
|
304
304
|
try {
|
|
305
305
|
const binding = require('@swc/anyformat-image-linux-x64-musl')
|
|
306
306
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-x64-musl/package.json').version
|
|
307
|
-
if (bindingPackageVersion !== '0.1.
|
|
308
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
307
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
308
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
309
309
|
}
|
|
310
310
|
return binding
|
|
311
311
|
} catch (e) {
|
|
@@ -320,8 +320,8 @@ function requireNative() {
|
|
|
320
320
|
try {
|
|
321
321
|
const binding = require('@swc/anyformat-image-linux-x64-gnu')
|
|
322
322
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-x64-gnu/package.json').version
|
|
323
|
-
if (bindingPackageVersion !== '0.1.
|
|
324
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
323
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
324
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
325
325
|
}
|
|
326
326
|
return binding
|
|
327
327
|
} catch (e) {
|
|
@@ -338,8 +338,8 @@ function requireNative() {
|
|
|
338
338
|
try {
|
|
339
339
|
const binding = require('@swc/anyformat-image-linux-arm64-musl')
|
|
340
340
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-arm64-musl/package.json').version
|
|
341
|
-
if (bindingPackageVersion !== '0.1.
|
|
342
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
341
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
342
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
343
343
|
}
|
|
344
344
|
return binding
|
|
345
345
|
} catch (e) {
|
|
@@ -354,8 +354,8 @@ function requireNative() {
|
|
|
354
354
|
try {
|
|
355
355
|
const binding = require('@swc/anyformat-image-linux-arm64-gnu')
|
|
356
356
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-arm64-gnu/package.json').version
|
|
357
|
-
if (bindingPackageVersion !== '0.1.
|
|
358
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
357
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
358
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
359
359
|
}
|
|
360
360
|
return binding
|
|
361
361
|
} catch (e) {
|
|
@@ -372,8 +372,8 @@ function requireNative() {
|
|
|
372
372
|
try {
|
|
373
373
|
const binding = require('@swc/anyformat-image-linux-arm-musleabihf')
|
|
374
374
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-arm-musleabihf/package.json').version
|
|
375
|
-
if (bindingPackageVersion !== '0.1.
|
|
376
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
375
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
376
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
377
377
|
}
|
|
378
378
|
return binding
|
|
379
379
|
} catch (e) {
|
|
@@ -388,8 +388,8 @@ function requireNative() {
|
|
|
388
388
|
try {
|
|
389
389
|
const binding = require('@swc/anyformat-image-linux-arm-gnueabihf')
|
|
390
390
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-arm-gnueabihf/package.json').version
|
|
391
|
-
if (bindingPackageVersion !== '0.1.
|
|
392
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
391
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
392
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
393
393
|
}
|
|
394
394
|
return binding
|
|
395
395
|
} catch (e) {
|
|
@@ -406,8 +406,8 @@ function requireNative() {
|
|
|
406
406
|
try {
|
|
407
407
|
const binding = require('@swc/anyformat-image-linux-loong64-musl')
|
|
408
408
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-loong64-musl/package.json').version
|
|
409
|
-
if (bindingPackageVersion !== '0.1.
|
|
410
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
409
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
410
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
411
411
|
}
|
|
412
412
|
return binding
|
|
413
413
|
} catch (e) {
|
|
@@ -422,8 +422,8 @@ function requireNative() {
|
|
|
422
422
|
try {
|
|
423
423
|
const binding = require('@swc/anyformat-image-linux-loong64-gnu')
|
|
424
424
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-loong64-gnu/package.json').version
|
|
425
|
-
if (bindingPackageVersion !== '0.1.
|
|
426
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
425
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
426
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
427
427
|
}
|
|
428
428
|
return binding
|
|
429
429
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@swc/anyformat-image-linux-riscv64-musl')
|
|
442
442
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-riscv64-musl/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
443
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@swc/anyformat-image-linux-riscv64-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-riscv64-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
459
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -473,8 +473,8 @@ function requireNative() {
|
|
|
473
473
|
try {
|
|
474
474
|
const binding = require('@swc/anyformat-image-linux-ppc64-gnu')
|
|
475
475
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-ppc64-gnu/package.json').version
|
|
476
|
-
if (bindingPackageVersion !== '0.1.
|
|
477
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
476
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
477
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
478
478
|
}
|
|
479
479
|
return binding
|
|
480
480
|
} catch (e) {
|
|
@@ -489,8 +489,8 @@ function requireNative() {
|
|
|
489
489
|
try {
|
|
490
490
|
const binding = require('@swc/anyformat-image-linux-s390x-gnu')
|
|
491
491
|
const bindingPackageVersion = require('@swc/anyformat-image-linux-s390x-gnu/package.json').version
|
|
492
|
-
if (bindingPackageVersion !== '0.1.
|
|
493
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
492
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
493
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
494
494
|
}
|
|
495
495
|
return binding
|
|
496
496
|
} catch (e) {
|
|
@@ -509,8 +509,8 @@ function requireNative() {
|
|
|
509
509
|
try {
|
|
510
510
|
const binding = require('@swc/anyformat-image-openharmony-arm64')
|
|
511
511
|
const bindingPackageVersion = require('@swc/anyformat-image-openharmony-arm64/package.json').version
|
|
512
|
-
if (bindingPackageVersion !== '0.1.
|
|
513
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
512
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
513
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
514
514
|
}
|
|
515
515
|
return binding
|
|
516
516
|
} catch (e) {
|
|
@@ -525,8 +525,8 @@ function requireNative() {
|
|
|
525
525
|
try {
|
|
526
526
|
const binding = require('@swc/anyformat-image-openharmony-x64')
|
|
527
527
|
const bindingPackageVersion = require('@swc/anyformat-image-openharmony-x64/package.json').version
|
|
528
|
-
if (bindingPackageVersion !== '0.1.
|
|
529
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
528
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
529
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
530
530
|
}
|
|
531
531
|
return binding
|
|
532
532
|
} catch (e) {
|
|
@@ -541,8 +541,8 @@ function requireNative() {
|
|
|
541
541
|
try {
|
|
542
542
|
const binding = require('@swc/anyformat-image-openharmony-arm')
|
|
543
543
|
const bindingPackageVersion = require('@swc/anyformat-image-openharmony-arm/package.json').version
|
|
544
|
-
if (bindingPackageVersion !== '0.1.
|
|
545
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
544
|
+
if (bindingPackageVersion !== '0.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
545
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
546
546
|
}
|
|
547
547
|
return binding
|
|
548
548
|
} catch (e) {
|
|
@@ -683,8 +683,8 @@ if (!nativeBinding || forceWasi) {
|
|
|
683
683
|
if (!candidateFailed) {
|
|
684
684
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
685
685
|
const bindingPackageVersion = require('@swc/anyformat-image-wasm32-wasi/package.json').version
|
|
686
|
-
if (bindingPackageVersion !== '0.1.
|
|
687
|
-
throw new Error(`WASI binding package version mismatch, expected 0.1.
|
|
686
|
+
if (bindingPackageVersion !== '0.1.3') {
|
|
687
|
+
throw new Error(`WASI binding package version mismatch, expected 0.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
wasiBinding = require('@swc/anyformat-image-wasm32-wasi')
|
|
@@ -835,8 +835,12 @@ function __napiStampBindingTarget(exportsObject, target) {
|
|
|
835
835
|
// linked import resolves to `undefined`.
|
|
836
836
|
module.exports.__napiBindingTarget = __napiStampBindingTarget(nativeBinding, __napiLoadedBindingTarget)
|
|
837
837
|
module.exports = nativeBinding
|
|
838
|
+
module.exports.alphaBounds = nativeBinding.alphaBounds
|
|
839
|
+
module.exports.alphaBoundsSync = nativeBinding.alphaBoundsSync
|
|
838
840
|
module.exports.compareImages = nativeBinding.compareImages
|
|
839
841
|
module.exports.compareImagesSync = nativeBinding.compareImagesSync
|
|
842
|
+
module.exports.crop = nativeBinding.crop
|
|
843
|
+
module.exports.cropSync = nativeBinding.cropSync
|
|
840
844
|
module.exports.decode = nativeBinding.decode
|
|
841
845
|
module.exports.decodeSync = nativeBinding.decodeSync
|
|
842
846
|
module.exports.detect = nativeBinding.detect
|
|
@@ -845,4 +849,6 @@ module.exports.encodeSync = nativeBinding.encodeSync
|
|
|
845
849
|
module.exports.listFormatSupport = nativeBinding.listFormatSupport
|
|
846
850
|
module.exports.readImageInfo = nativeBinding.readImageInfo
|
|
847
851
|
module.exports.readImageInfoSync = nativeBinding.readImageInfoSync
|
|
852
|
+
module.exports.resize = nativeBinding.resize
|
|
853
|
+
module.exports.resizeSync = nativeBinding.resizeSync
|
|
848
854
|
module.exports.supportedFormats = nativeBinding.supportedFormats
|
package/index.d.ts
CHANGED
|
@@ -268,6 +268,7 @@ export interface CompareOptions {
|
|
|
268
268
|
diff?: 'raw' | EncodeOptions | null | undefined
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
/** A rectangle in pixels. */
|
|
271
272
|
export interface Rect {
|
|
272
273
|
x: number
|
|
273
274
|
y: number
|
|
@@ -336,3 +337,99 @@ export declare function compareImagesSync(
|
|
|
336
337
|
options: CompareOptions & { diff: EncodeOptions },
|
|
337
338
|
): CompareResultWithEncoded
|
|
338
339
|
export declare function compareImagesSync(a: ImageInput, b: ImageInput, options?: CompareOptions | null): CompareResult
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* The output of a function that makes an image. 'raw' returns a raw image.
|
|
343
|
+
* Encode options return an encoded file.
|
|
344
|
+
*/
|
|
345
|
+
export type ImageOutput = 'raw' | EncodeOptions
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* The resampling filter of `resize`.
|
|
349
|
+
*
|
|
350
|
+
* - 'box': area average. Each channel of a target pixel, alpha too, is the
|
|
351
|
+
* mean of the source pixels that the target pixel covers, rounded half up.
|
|
352
|
+
* The channels are not premultiplied. When the target is larger than the
|
|
353
|
+
* source, each target pixel takes one source pixel.
|
|
354
|
+
* - 'nearest': each target pixel takes the source pixel nearest to its
|
|
355
|
+
* center.
|
|
356
|
+
*/
|
|
357
|
+
export type ResizeFilter = 'box' | 'nearest'
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* How `resize` uses `width` and `height` when both are set.
|
|
361
|
+
*
|
|
362
|
+
* - 'fill': use both. The aspect ratio can change.
|
|
363
|
+
* - 'inside': keep the aspect ratio. The result is as large as possible, but
|
|
364
|
+
* not wider than `width` or higher than `height`.
|
|
365
|
+
* - 'outside': keep the aspect ratio. The result is as small as possible, but
|
|
366
|
+
* not narrower than `width` or lower than `height`.
|
|
367
|
+
*/
|
|
368
|
+
export type ResizeFit = 'fill' | 'inside' | 'outside'
|
|
369
|
+
|
|
370
|
+
export interface ResizeOptions {
|
|
371
|
+
/**
|
|
372
|
+
* The target width, an integer from 1 to 2^31 - 1. Set `width`, `height`,
|
|
373
|
+
* or both. When only one is set, the other keeps the aspect ratio.
|
|
374
|
+
*/
|
|
375
|
+
width?: number | null | undefined
|
|
376
|
+
/** The target height, an integer from 1 to 2^31 - 1. */
|
|
377
|
+
height?: number | null | undefined
|
|
378
|
+
/** Default: 'fill'. */
|
|
379
|
+
fit?: ResizeFit | null | undefined
|
|
380
|
+
/** Default: 'box'. */
|
|
381
|
+
filter?: ResizeFilter | null | undefined
|
|
382
|
+
/** The decode options for an input that is an encoded file. */
|
|
383
|
+
decode?: DecodeOptions | null | undefined
|
|
384
|
+
/** Default: 'raw'. */
|
|
385
|
+
output?: ImageOutput | null | undefined
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Resizes an image. The input is a raw image or an encoded file. The result
|
|
390
|
+
* is a raw image, or an encoded file when `output` is encode options. An
|
|
391
|
+
* image that already has the target size gives a copy of its pixels.
|
|
392
|
+
*/
|
|
393
|
+
export declare function resize(image: ImageInput, options: ResizeOptions & { output: EncodeOptions }): Promise<OwnedBuffer>
|
|
394
|
+
export declare function resize(image: ImageInput, options: ResizeOptions): Promise<RawImageBuffer>
|
|
395
|
+
/** The synchronous form of `resize`. */
|
|
396
|
+
export declare function resizeSync(image: ImageInput, options: ResizeOptions & { output: EncodeOptions }): OwnedBuffer
|
|
397
|
+
export declare function resizeSync(image: ImageInput, options: ResizeOptions): RawImageBuffer
|
|
398
|
+
|
|
399
|
+
export interface CropOptions {
|
|
400
|
+
/** The decode options for an input that is an encoded file. */
|
|
401
|
+
decode?: DecodeOptions | null | undefined
|
|
402
|
+
/** Default: 'raw'. */
|
|
403
|
+
output?: ImageOutput | null | undefined
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Copies the pixels in `rect` to a new image. The input is a raw image or an
|
|
408
|
+
* encoded file. `rect` must be inside the image, and its width and height
|
|
409
|
+
* must be 1 or more. The result of `alphaBounds` is a valid `rect`.
|
|
410
|
+
*/
|
|
411
|
+
export declare function crop(
|
|
412
|
+
image: ImageInput,
|
|
413
|
+
rect: Rect,
|
|
414
|
+
options: CropOptions & { output: EncodeOptions },
|
|
415
|
+
): Promise<OwnedBuffer>
|
|
416
|
+
export declare function crop(image: ImageInput, rect: Rect, options?: CropOptions | null): Promise<RawImageBuffer>
|
|
417
|
+
/** The synchronous form of `crop`. */
|
|
418
|
+
export declare function cropSync(image: ImageInput, rect: Rect, options: CropOptions & { output: EncodeOptions }): OwnedBuffer
|
|
419
|
+
export declare function cropSync(image: ImageInput, rect: Rect, options?: CropOptions | null): RawImageBuffer
|
|
420
|
+
|
|
421
|
+
export interface AlphaBoundsOptions {
|
|
422
|
+
/** An integer from 0 to 255. Default: 255. */
|
|
423
|
+
minAlpha?: number | null | undefined
|
|
424
|
+
/** The decode options for an input that is an encoded file. */
|
|
425
|
+
decode?: DecodeOptions | null | undefined
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Returns the smallest rectangle that contains every pixel whose alpha is
|
|
430
|
+
* `minAlpha` or more. Returns `null` when there is no such pixel. The input
|
|
431
|
+
* is a raw image or an encoded file.
|
|
432
|
+
*/
|
|
433
|
+
export declare function alphaBounds(image: ImageInput, options?: AlphaBoundsOptions | null): Promise<Rect | null>
|
|
434
|
+
/** The synchronous form of `alphaBounds`. */
|
|
435
|
+
export declare function alphaBoundsSync(image: ImageInput, options?: AlphaBoundsOptions | null): Rect | null
|
package/index.js
CHANGED
|
@@ -102,18 +102,35 @@ function normalizeRawImage(name, value) {
|
|
|
102
102
|
|
|
103
103
|
function normalizeImageInput(name, value) {
|
|
104
104
|
if (isUint8Array(value)) return value
|
|
105
|
+
if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer || value === null || typeof value !== 'object') {
|
|
106
|
+
throw invalidType(`"${name}" argument`, 'a Uint8Array (an encoded file) or a raw image object', value)
|
|
107
|
+
}
|
|
108
|
+
return normalizeRawImage(name, value)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Normalizes an input of `compareImages`, and names the input in an error, as
|
|
112
|
+
// the errors of the native code do.
|
|
113
|
+
function normalizeCompareInput(name, value) {
|
|
105
114
|
try {
|
|
106
|
-
|
|
107
|
-
throw invalidType(`"${name}" argument`, 'a Uint8Array (an encoded file) or a raw image object', value)
|
|
108
|
-
}
|
|
109
|
-
return normalizeRawImage(name, value)
|
|
115
|
+
return normalizeImageInput(name, value)
|
|
110
116
|
} catch (error) {
|
|
111
|
-
// Name the input, as the errors of the native code do.
|
|
112
117
|
if (error.code === 'ERR_INVALID_ARG_TYPE') error.input = name
|
|
113
118
|
throw error
|
|
114
119
|
}
|
|
115
120
|
}
|
|
116
121
|
|
|
122
|
+
// Returns a plain copy of a rectangle. Throws for a property of a wrong type.
|
|
123
|
+
function normalizeRect(name, value) {
|
|
124
|
+
if (value === null || typeof value !== 'object' || ArrayBuffer.isView(value)) {
|
|
125
|
+
throw invalidType(`"${name}" argument`, 'an object with x, y, width, and height', value)
|
|
126
|
+
}
|
|
127
|
+
const { x, y, width, height } = value
|
|
128
|
+
for (const [key, item] of [['x', x], ['y', y], ['width', width], ['height', height]]) {
|
|
129
|
+
if (typeof item !== 'number') throw invalidType(`"${name}.${key}" property`, 'a number', item)
|
|
130
|
+
}
|
|
131
|
+
return { x, y, width, height }
|
|
132
|
+
}
|
|
133
|
+
|
|
117
134
|
// The type of each option. The native code checks the values, and these
|
|
118
135
|
// checks give clear messages for values of a wrong type.
|
|
119
136
|
const STRING = { name: 'a string', test: (value) => typeof value === 'string' }
|
|
@@ -163,6 +180,17 @@ const COMPARE_OPTIONS = {
|
|
|
163
180
|
decode: DECODE_OPTIONS,
|
|
164
181
|
diff: { or: STRING, options: ENCODE_OPTIONS },
|
|
165
182
|
}
|
|
183
|
+
const OUTPUT = { or: STRING, options: ENCODE_OPTIONS }
|
|
184
|
+
const RESIZE_OPTIONS = {
|
|
185
|
+
width: NUMBER,
|
|
186
|
+
height: NUMBER,
|
|
187
|
+
fit: STRING,
|
|
188
|
+
filter: STRING,
|
|
189
|
+
decode: DECODE_OPTIONS,
|
|
190
|
+
output: OUTPUT,
|
|
191
|
+
}
|
|
192
|
+
const CROP_OPTIONS = { decode: DECODE_OPTIONS, output: OUTPUT }
|
|
193
|
+
const ALPHA_BOUNDS_OPTIONS = { minAlpha: NUMBER, decode: DECODE_OPTIONS }
|
|
166
194
|
|
|
167
195
|
// Returns a plain copy of an options object for the native function. A
|
|
168
196
|
// property that is null or undefined is left out, so that it has its default
|
|
@@ -184,7 +212,7 @@ function normalizeOptions(options, schema, name) {
|
|
|
184
212
|
|
|
185
213
|
function normalizeOption(value, type, name) {
|
|
186
214
|
if (type.or) {
|
|
187
|
-
// `diff`: a string ('raw') or encode options.
|
|
215
|
+
// `diff` and `output`: a string ('raw') or encode options.
|
|
188
216
|
if (type.or.test(value)) return value
|
|
189
217
|
if (typeof value !== 'object') throw invalidType(`"${name}" property`, `${type.or.name} or an object`, value)
|
|
190
218
|
const options = normalizeOptions(value, type.options, name)
|
|
@@ -200,7 +228,8 @@ function normalizeOption(value, type, name) {
|
|
|
200
228
|
|
|
201
229
|
// Wraps a native function. `prepare` checks and copies the arguments before
|
|
202
230
|
// the options. `optionsIndex` is the position of the options argument, and
|
|
203
|
-
// `schema` describes it.
|
|
231
|
+
// `schema` describes it. `required` makes the options argument required, as
|
|
232
|
+
// for `encode` and `resize`.
|
|
204
233
|
function wrap(fn, isAsync, prepare, optionsIndex = -1, schema = null, required = false) {
|
|
205
234
|
return function wrapped(...args) {
|
|
206
235
|
// The native code rejects the promise from the event loop, so the error
|
|
@@ -216,7 +245,7 @@ function wrap(fn, isAsync, prepare, optionsIndex = -1, schema = null, required =
|
|
|
216
245
|
throw invalidOptions('"options" argument', options)
|
|
217
246
|
}
|
|
218
247
|
args[optionsIndex] = normalizeOptions(options, schema, 'options')
|
|
219
|
-
if (
|
|
248
|
+
if (schema === ENCODE_OPTIONS && args[optionsIndex].format === undefined) {
|
|
220
249
|
throw invalidType('"options.format" property', "a string, for example 'png'", undefined)
|
|
221
250
|
}
|
|
222
251
|
}
|
|
@@ -246,8 +275,15 @@ const checkImage = (args) => {
|
|
|
246
275
|
args[0] = normalizeRawImage('image', args[0])
|
|
247
276
|
}
|
|
248
277
|
const checkInputs = (args) => {
|
|
249
|
-
args[0] =
|
|
250
|
-
args[1] =
|
|
278
|
+
args[0] = normalizeCompareInput('a', args[0])
|
|
279
|
+
args[1] = normalizeCompareInput('b', args[1])
|
|
280
|
+
}
|
|
281
|
+
const checkInput = (args) => {
|
|
282
|
+
args[0] = normalizeImageInput('image', args[0])
|
|
283
|
+
}
|
|
284
|
+
const checkInputAndRect = (args) => {
|
|
285
|
+
args[0] = normalizeImageInput('image', args[0])
|
|
286
|
+
args[1] = normalizeRect('rect', args[1])
|
|
251
287
|
}
|
|
252
288
|
|
|
253
289
|
module.exports.detect = wrap(binding.detect, false, checkData)
|
|
@@ -264,3 +300,9 @@ module.exports.encode = wrap(binding.encode, true, checkImage, 1, ENCODE_OPTIONS
|
|
|
264
300
|
module.exports.encodeSync = wrap(binding.encodeSync, false, checkImage, 1, ENCODE_OPTIONS, true)
|
|
265
301
|
module.exports.compareImages = wrap(binding.compareImages, true, checkInputs, 2, COMPARE_OPTIONS)
|
|
266
302
|
module.exports.compareImagesSync = wrap(binding.compareImagesSync, false, checkInputs, 2, COMPARE_OPTIONS)
|
|
303
|
+
module.exports.resize = wrap(binding.resize, true, checkInput, 1, RESIZE_OPTIONS, true)
|
|
304
|
+
module.exports.resizeSync = wrap(binding.resizeSync, false, checkInput, 1, RESIZE_OPTIONS, true)
|
|
305
|
+
module.exports.crop = wrap(binding.crop, true, checkInputAndRect, 2, CROP_OPTIONS)
|
|
306
|
+
module.exports.cropSync = wrap(binding.cropSync, false, checkInputAndRect, 2, CROP_OPTIONS)
|
|
307
|
+
module.exports.alphaBounds = wrap(binding.alphaBounds, true, checkInput, 1, ALPHA_BOUNDS_OPTIONS)
|
|
308
|
+
module.exports.alphaBoundsSync = wrap(binding.alphaBoundsSync, false, checkInput, 1, ALPHA_BOUNDS_OPTIONS)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/anyformat-image",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "High-performance image processing for Node.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -23,10 +23,15 @@
|
|
|
23
23
|
"aarch64-apple-darwin",
|
|
24
24
|
"x86_64-pc-windows-msvc",
|
|
25
25
|
"aarch64-pc-windows-msvc",
|
|
26
|
+
"i686-pc-windows-msvc",
|
|
26
27
|
"x86_64-unknown-linux-gnu",
|
|
27
28
|
"aarch64-unknown-linux-gnu",
|
|
28
29
|
"x86_64-unknown-linux-musl",
|
|
29
|
-
"aarch64-unknown-linux-musl"
|
|
30
|
+
"aarch64-unknown-linux-musl",
|
|
31
|
+
"armv7-unknown-linux-gnueabihf",
|
|
32
|
+
"aarch64-linux-android",
|
|
33
|
+
"armv7-linux-androideabi",
|
|
34
|
+
"x86_64-unknown-freebsd"
|
|
30
35
|
]
|
|
31
36
|
},
|
|
32
37
|
"engines": {
|
|
@@ -44,14 +49,19 @@
|
|
|
44
49
|
"pngjs": "7.0.0"
|
|
45
50
|
},
|
|
46
51
|
"optionalDependencies": {
|
|
47
|
-
"@swc/anyformat-image-darwin-x64": "0.1.
|
|
48
|
-
"@swc/anyformat-image-darwin-arm64": "0.1.
|
|
49
|
-
"@swc/anyformat-image-win32-x64-msvc": "0.1.
|
|
50
|
-
"@swc/anyformat-image-win32-arm64-msvc": "0.1.
|
|
51
|
-
"@swc/anyformat-image-
|
|
52
|
-
"@swc/anyformat-image-linux-
|
|
53
|
-
"@swc/anyformat-image-linux-
|
|
54
|
-
"@swc/anyformat-image-linux-
|
|
52
|
+
"@swc/anyformat-image-darwin-x64": "0.1.3",
|
|
53
|
+
"@swc/anyformat-image-darwin-arm64": "0.1.3",
|
|
54
|
+
"@swc/anyformat-image-win32-x64-msvc": "0.1.3",
|
|
55
|
+
"@swc/anyformat-image-win32-arm64-msvc": "0.1.3",
|
|
56
|
+
"@swc/anyformat-image-win32-ia32-msvc": "0.1.3",
|
|
57
|
+
"@swc/anyformat-image-linux-x64-gnu": "0.1.3",
|
|
58
|
+
"@swc/anyformat-image-linux-arm64-gnu": "0.1.3",
|
|
59
|
+
"@swc/anyformat-image-linux-x64-musl": "0.1.3",
|
|
60
|
+
"@swc/anyformat-image-linux-arm64-musl": "0.1.3",
|
|
61
|
+
"@swc/anyformat-image-linux-arm-gnueabihf": "0.1.3",
|
|
62
|
+
"@swc/anyformat-image-android-arm64": "0.1.3",
|
|
63
|
+
"@swc/anyformat-image-android-arm-eabi": "0.1.3",
|
|
64
|
+
"@swc/anyformat-image-freebsd-x64": "0.1.3"
|
|
55
65
|
},
|
|
56
66
|
"scripts": {
|
|
57
67
|
"build": "napi build --platform --js binding.js --dts binding.d.ts --release",
|