@napi-rs/image 1.11.0 → 1.11.2

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.
Files changed (3) hide show
  1. package/index.d.ts +40 -40
  2. package/index.js +234 -102
  3. package/package.json +17 -17
package/index.d.ts CHANGED
@@ -412,26 +412,26 @@ export declare enum PngRowFilter {
412
412
  *
413
413
  * <!-- NOTE: To test new test images locally, replace the GitHub path with `../../../docs/` -->
414
414
  * <div style="display: flex; flex-wrap: wrap; align-items: flex-start;">
415
- * <div style="margin: 0 8px 8px 0;">
416
- * <img src="https://raw.githubusercontent.com/image-rs/image/master/examples/scaledown/scaledown-test-near.png" title="Nearest"><br>
417
- * Nearest Neighbor
418
- * </div>
419
- * <div style="margin: 0 8px 8px 0;">
420
- * <img src="https://raw.githubusercontent.com/image-rs/image/master/examples/scaledown/scaledown-test-tri.png" title="Triangle"><br>
421
- * Linear: Triangle
422
- * </div>
423
- * <div style="margin: 0 8px 8px 0;">
424
- * <img src="https://raw.githubusercontent.com/image-rs/image/master/examples/scaledown/scaledown-test-cmr.png" title="CatmullRom"><br>
425
- * Cubic: Catmull-Rom
426
- * </div>
427
- * <div style="margin: 0 8px 8px 0;">
428
- * <img src="https://raw.githubusercontent.com/image-rs/image/master/examples/scaledown/scaledown-test-gauss.png" title="Gaussian"><br>
429
- * Gaussian
430
- * </div>
431
- * <div style="margin: 0 8px 8px 0;">
432
- * <img src="https://raw.githubusercontent.com/image-rs/image/master/examples/scaledown/scaledown-test-lcz2.png" title="Lanczos3"><br>
433
- * Lanczos with window 3
434
- * </div>
415
+ * <div style="margin: 0 8px 8px 0;">
416
+ * <img src="https://raw.githubusercontent.com/image-rs/image/master/examples/scaledown/scaledown-test-near.png" title="Nearest"><br>
417
+ * Nearest Neighbor
418
+ * </div>
419
+ * <div style="margin: 0 8px 8px 0;">
420
+ * <img src="https://raw.githubusercontent.com/image-rs/image/master/examples/scaledown/scaledown-test-tri.png" title="Triangle"><br>
421
+ * Linear: Triangle
422
+ * </div>
423
+ * <div style="margin: 0 8px 8px 0;">
424
+ * <img src="https://raw.githubusercontent.com/image-rs/image/master/examples/scaledown/scaledown-test-cmr.png" title="CatmullRom"><br>
425
+ * Cubic: Catmull-Rom
426
+ * </div>
427
+ * <div style="margin: 0 8px 8px 0;">
428
+ * <img src="https://raw.githubusercontent.com/image-rs/image/master/examples/scaledown/scaledown-test-gauss.png" title="Gaussian"><br>
429
+ * Gaussian
430
+ * </div>
431
+ * <div style="margin: 0 8px 8px 0;">
432
+ * <img src="https://raw.githubusercontent.com/image-rs/image/master/examples/scaledown/scaledown-test-lcz2.png" title="Lanczos3"><br>
433
+ * Lanczos with window 3
434
+ * </div>
435
435
  * </div>
436
436
  *
437
437
  * ## Speed
@@ -440,26 +440,26 @@ export declare enum PngRowFilter {
440
440
  * i7-4770 CPU with Rust 1.37 in release mode:
441
441
  *
442
442
  * <table style="width: auto;">
443
- * <tr>
444
- * <th>Nearest</th>
445
- * <td>31 ms</td>
446
- * </tr>
447
- * <tr>
448
- * <th>Triangle</th>
449
- * <td>414 ms</td>
450
- * </tr>
451
- * <tr>
452
- * <th>CatmullRom</th>
453
- * <td>817 ms</td>
454
- * </tr>
455
- * <tr>
456
- * <th>Gaussian</th>
457
- * <td>1180 ms</td>
458
- * </tr>
459
- * <tr>
460
- * <th>Lanczos3</th>
461
- * <td>1170 ms</td>
462
- * </tr>
443
+ * <tr>
444
+ * <th>Nearest</th>
445
+ * <td>31 ms</td>
446
+ * </tr>
447
+ * <tr>
448
+ * <th>Triangle</th>
449
+ * <td>414 ms</td>
450
+ * </tr>
451
+ * <tr>
452
+ * <th>CatmullRom</th>
453
+ * <td>817 ms</td>
454
+ * </tr>
455
+ * <tr>
456
+ * <th>Gaussian</th>
457
+ * <td>1180 ms</td>
458
+ * </tr>
459
+ * <tr>
460
+ * <th>Lanczos3</th>
461
+ * <td>1170 ms</td>
462
+ * </tr>
463
463
  * </table>
464
464
  */
465
465
  export declare enum ResizeFilterType {
package/index.js CHANGED
@@ -78,11 +78,15 @@ function requireNative() {
78
78
  loadErrors.push(e)
79
79
  }
80
80
  try {
81
- return require('@napi-rs/image-android-arm64')
81
+ const binding = require('@napi-rs/image-android-arm64')
82
+ const bindingPackageVersion = require('@napi-rs/image-android-arm64/package.json').version
83
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
84
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
85
+ }
86
+ return binding
82
87
  } catch (e) {
83
88
  loadErrors.push(e)
84
89
  }
85
-
86
90
  } else if (process.arch === 'arm') {
87
91
  try {
88
92
  return require('./image.android-arm-eabi.node')
@@ -90,11 +94,15 @@ function requireNative() {
90
94
  loadErrors.push(e)
91
95
  }
92
96
  try {
93
- return require('@napi-rs/image-android-arm-eabi')
97
+ const binding = require('@napi-rs/image-android-arm-eabi')
98
+ const bindingPackageVersion = require('@napi-rs/image-android-arm-eabi/package.json').version
99
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
100
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
+ }
102
+ return binding
94
103
  } catch (e) {
95
104
  loadErrors.push(e)
96
105
  }
97
-
98
106
  } else {
99
107
  loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
100
108
  }
@@ -106,11 +114,15 @@ function requireNative() {
106
114
  loadErrors.push(e)
107
115
  }
108
116
  try {
109
- return require('@napi-rs/image-win32-x64-msvc')
117
+ const binding = require('@napi-rs/image-win32-x64-msvc')
118
+ const bindingPackageVersion = require('@napi-rs/image-win32-x64-msvc/package.json').version
119
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
120
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
+ }
122
+ return binding
110
123
  } catch (e) {
111
124
  loadErrors.push(e)
112
125
  }
113
-
114
126
  } else if (process.arch === 'ia32') {
115
127
  try {
116
128
  return require('./image.win32-ia32-msvc.node')
@@ -118,11 +130,15 @@ function requireNative() {
118
130
  loadErrors.push(e)
119
131
  }
120
132
  try {
121
- return require('@napi-rs/image-win32-ia32-msvc')
133
+ const binding = require('@napi-rs/image-win32-ia32-msvc')
134
+ const bindingPackageVersion = require('@napi-rs/image-win32-ia32-msvc/package.json').version
135
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
136
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
+ }
138
+ return binding
122
139
  } catch (e) {
123
140
  loadErrors.push(e)
124
141
  }
125
-
126
142
  } else if (process.arch === 'arm64') {
127
143
  try {
128
144
  return require('./image.win32-arm64-msvc.node')
@@ -130,26 +146,34 @@ function requireNative() {
130
146
  loadErrors.push(e)
131
147
  }
132
148
  try {
133
- return require('@napi-rs/image-win32-arm64-msvc')
149
+ const binding = require('@napi-rs/image-win32-arm64-msvc')
150
+ const bindingPackageVersion = require('@napi-rs/image-win32-arm64-msvc/package.json').version
151
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
152
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
153
+ }
154
+ return binding
134
155
  } catch (e) {
135
156
  loadErrors.push(e)
136
157
  }
137
-
138
158
  } else {
139
159
  loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
140
160
  }
141
161
  } else if (process.platform === 'darwin') {
142
162
  try {
143
- return require('./image.darwin-universal.node')
144
- } catch (e) {
145
- loadErrors.push(e)
146
- }
147
- try {
148
- return require('@napi-rs/image-darwin-universal')
149
- } catch (e) {
150
- loadErrors.push(e)
151
- }
152
-
163
+ return require('./image.darwin-universal.node')
164
+ } catch (e) {
165
+ loadErrors.push(e)
166
+ }
167
+ try {
168
+ const binding = require('@napi-rs/image-darwin-universal')
169
+ const bindingPackageVersion = require('@napi-rs/image-darwin-universal/package.json').version
170
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
+ }
173
+ return binding
174
+ } catch (e) {
175
+ loadErrors.push(e)
176
+ }
153
177
  if (process.arch === 'x64') {
154
178
  try {
155
179
  return require('./image.darwin-x64.node')
@@ -157,11 +181,15 @@ function requireNative() {
157
181
  loadErrors.push(e)
158
182
  }
159
183
  try {
160
- return require('@napi-rs/image-darwin-x64')
184
+ const binding = require('@napi-rs/image-darwin-x64')
185
+ const bindingPackageVersion = require('@napi-rs/image-darwin-x64/package.json').version
186
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
187
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
188
+ }
189
+ return binding
161
190
  } catch (e) {
162
191
  loadErrors.push(e)
163
192
  }
164
-
165
193
  } else if (process.arch === 'arm64') {
166
194
  try {
167
195
  return require('./image.darwin-arm64.node')
@@ -169,11 +197,15 @@ function requireNative() {
169
197
  loadErrors.push(e)
170
198
  }
171
199
  try {
172
- return require('@napi-rs/image-darwin-arm64')
200
+ const binding = require('@napi-rs/image-darwin-arm64')
201
+ const bindingPackageVersion = require('@napi-rs/image-darwin-arm64/package.json').version
202
+ if (bindingPackageVersion !== '1.11.1' && 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 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
+ }
205
+ return binding
173
206
  } catch (e) {
174
207
  loadErrors.push(e)
175
208
  }
176
-
177
209
  } else {
178
210
  loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
179
211
  }
@@ -185,11 +217,15 @@ function requireNative() {
185
217
  loadErrors.push(e)
186
218
  }
187
219
  try {
188
- return require('@napi-rs/image-freebsd-x64')
220
+ const binding = require('@napi-rs/image-freebsd-x64')
221
+ const bindingPackageVersion = require('@napi-rs/image-freebsd-x64/package.json').version
222
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
224
+ }
225
+ return binding
189
226
  } catch (e) {
190
227
  loadErrors.push(e)
191
228
  }
192
-
193
229
  } else if (process.arch === 'arm64') {
194
230
  try {
195
231
  return require('./image.freebsd-arm64.node')
@@ -197,11 +233,15 @@ function requireNative() {
197
233
  loadErrors.push(e)
198
234
  }
199
235
  try {
200
- return require('@napi-rs/image-freebsd-arm64')
236
+ const binding = require('@napi-rs/image-freebsd-arm64')
237
+ const bindingPackageVersion = require('@napi-rs/image-freebsd-arm64/package.json').version
238
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
239
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
240
+ }
241
+ return binding
201
242
  } catch (e) {
202
243
  loadErrors.push(e)
203
244
  }
204
-
205
245
  } else {
206
246
  loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
207
247
  }
@@ -209,133 +249,225 @@ function requireNative() {
209
249
  if (process.arch === 'x64') {
210
250
  if (isMusl()) {
211
251
  try {
212
- return require('./image.linux-x64-musl.node')
213
- } catch (e) {
214
- loadErrors.push(e)
215
- }
216
- try {
217
- return require('@napi-rs/image-linux-x64-musl')
218
- } catch (e) {
219
- loadErrors.push(e)
220
- }
221
-
252
+ return require('./image.linux-x64-musl.node')
253
+ } catch (e) {
254
+ loadErrors.push(e)
255
+ }
256
+ try {
257
+ const binding = require('@napi-rs/image-linux-x64-musl')
258
+ const bindingPackageVersion = require('@napi-rs/image-linux-x64-musl/package.json').version
259
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
260
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
261
+ }
262
+ return binding
263
+ } catch (e) {
264
+ loadErrors.push(e)
265
+ }
222
266
  } else {
223
267
  try {
224
- return require('./image.linux-x64-gnu.node')
225
- } catch (e) {
226
- loadErrors.push(e)
227
- }
228
- try {
229
- return require('@napi-rs/image-linux-x64-gnu')
230
- } catch (e) {
231
- loadErrors.push(e)
232
- }
233
-
268
+ return require('./image.linux-x64-gnu.node')
269
+ } catch (e) {
270
+ loadErrors.push(e)
271
+ }
272
+ try {
273
+ const binding = require('@napi-rs/image-linux-x64-gnu')
274
+ const bindingPackageVersion = require('@napi-rs/image-linux-x64-gnu/package.json').version
275
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
276
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
277
+ }
278
+ return binding
279
+ } catch (e) {
280
+ loadErrors.push(e)
281
+ }
234
282
  }
235
283
  } else if (process.arch === 'arm64') {
236
284
  if (isMusl()) {
237
285
  try {
238
- return require('./image.linux-arm64-musl.node')
239
- } catch (e) {
240
- loadErrors.push(e)
241
- }
242
- try {
243
- return require('@napi-rs/image-linux-arm64-musl')
244
- } catch (e) {
245
- loadErrors.push(e)
246
- }
247
-
286
+ return require('./image.linux-arm64-musl.node')
287
+ } catch (e) {
288
+ loadErrors.push(e)
289
+ }
290
+ try {
291
+ const binding = require('@napi-rs/image-linux-arm64-musl')
292
+ const bindingPackageVersion = require('@napi-rs/image-linux-arm64-musl/package.json').version
293
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
294
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
295
+ }
296
+ return binding
297
+ } catch (e) {
298
+ loadErrors.push(e)
299
+ }
248
300
  } else {
249
301
  try {
250
- return require('./image.linux-arm64-gnu.node')
251
- } catch (e) {
252
- loadErrors.push(e)
253
- }
254
- try {
255
- return require('@napi-rs/image-linux-arm64-gnu')
256
- } catch (e) {
257
- loadErrors.push(e)
258
- }
259
-
302
+ return require('./image.linux-arm64-gnu.node')
303
+ } catch (e) {
304
+ loadErrors.push(e)
305
+ }
306
+ try {
307
+ const binding = require('@napi-rs/image-linux-arm64-gnu')
308
+ const bindingPackageVersion = require('@napi-rs/image-linux-arm64-gnu/package.json').version
309
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
311
+ }
312
+ return binding
313
+ } catch (e) {
314
+ loadErrors.push(e)
315
+ }
260
316
  }
261
317
  } else if (process.arch === 'arm') {
262
318
  if (isMusl()) {
263
319
  try {
264
- return require('./image.linux-arm-musleabihf.node')
265
- } catch (e) {
266
- loadErrors.push(e)
267
- }
268
- try {
269
- return require('@napi-rs/image-linux-arm-musleabihf')
270
- } catch (e) {
271
- loadErrors.push(e)
320
+ return require('./image.linux-arm-musleabihf.node')
321
+ } catch (e) {
322
+ loadErrors.push(e)
323
+ }
324
+ try {
325
+ const binding = require('@napi-rs/image-linux-arm-musleabihf')
326
+ const bindingPackageVersion = require('@napi-rs/image-linux-arm-musleabihf/package.json').version
327
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
328
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
329
+ }
330
+ return binding
331
+ } catch (e) {
332
+ loadErrors.push(e)
333
+ }
334
+ } else {
335
+ try {
336
+ return require('./image.linux-arm-gnueabihf.node')
337
+ } catch (e) {
338
+ loadErrors.push(e)
339
+ }
340
+ try {
341
+ const binding = require('@napi-rs/image-linux-arm-gnueabihf')
342
+ const bindingPackageVersion = require('@napi-rs/image-linux-arm-gnueabihf/package.json').version
343
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
344
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
345
+ }
346
+ return binding
347
+ } catch (e) {
348
+ loadErrors.push(e)
349
+ }
272
350
  }
273
-
351
+ } else if (process.arch === 'riscv64') {
352
+ if (isMusl()) {
353
+ try {
354
+ return require('./image.linux-riscv64-musl.node')
355
+ } catch (e) {
356
+ loadErrors.push(e)
357
+ }
358
+ try {
359
+ const binding = require('@napi-rs/image-linux-riscv64-musl')
360
+ const bindingPackageVersion = require('@napi-rs/image-linux-riscv64-musl/package.json').version
361
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
362
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
+ }
364
+ return binding
365
+ } catch (e) {
366
+ loadErrors.push(e)
367
+ }
274
368
  } else {
275
369
  try {
276
- return require('./image.linux-arm-gnueabihf.node')
370
+ return require('./image.linux-riscv64-gnu.node')
371
+ } catch (e) {
372
+ loadErrors.push(e)
373
+ }
374
+ try {
375
+ const binding = require('@napi-rs/image-linux-riscv64-gnu')
376
+ const bindingPackageVersion = require('@napi-rs/image-linux-riscv64-gnu/package.json').version
377
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
378
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
379
+ }
380
+ return binding
381
+ } catch (e) {
382
+ loadErrors.push(e)
383
+ }
384
+ }
385
+ } else if (process.arch === 'ppc64') {
386
+ try {
387
+ return require('./image.linux-ppc64-gnu.node')
277
388
  } catch (e) {
278
389
  loadErrors.push(e)
279
390
  }
280
391
  try {
281
- return require('@napi-rs/image-linux-arm-gnueabihf')
392
+ const binding = require('@napi-rs/image-linux-ppc64-gnu')
393
+ const bindingPackageVersion = require('@napi-rs/image-linux-ppc64-gnu/package.json').version
394
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
395
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
396
+ }
397
+ return binding
282
398
  } catch (e) {
283
399
  loadErrors.push(e)
284
400
  }
285
-
286
- }
287
- } else if (process.arch === 'riscv64') {
288
- if (isMusl()) {
289
- try {
290
- return require('./image.linux-riscv64-musl.node')
401
+ } else if (process.arch === 's390x') {
402
+ try {
403
+ return require('./image.linux-s390x-gnu.node')
291
404
  } catch (e) {
292
405
  loadErrors.push(e)
293
406
  }
294
407
  try {
295
- return require('@napi-rs/image-linux-riscv64-musl')
408
+ const binding = require('@napi-rs/image-linux-s390x-gnu')
409
+ const bindingPackageVersion = require('@napi-rs/image-linux-s390x-gnu/package.json').version
410
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
+ }
413
+ return binding
296
414
  } catch (e) {
297
415
  loadErrors.push(e)
298
416
  }
299
-
300
- } else {
301
- try {
302
- return require('./image.linux-riscv64-gnu.node')
417
+ } else {
418
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
419
+ }
420
+ } else if (process.platform === 'openharmony') {
421
+ if (process.arch === 'arm64') {
422
+ try {
423
+ return require('./image.openharmony-arm64.node')
303
424
  } catch (e) {
304
425
  loadErrors.push(e)
305
426
  }
306
427
  try {
307
- return require('@napi-rs/image-linux-riscv64-gnu')
428
+ const binding = require('@napi-rs/image-openharmony-arm64')
429
+ const bindingPackageVersion = require('@napi-rs/image-openharmony-arm64/package.json').version
430
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
432
+ }
433
+ return binding
308
434
  } catch (e) {
309
435
  loadErrors.push(e)
310
436
  }
311
-
312
- }
313
- } else if (process.arch === 'ppc64') {
437
+ } else if (process.arch === 'x64') {
314
438
  try {
315
- return require('./image.linux-ppc64-gnu.node')
439
+ return require('./image.openharmony-x64.node')
316
440
  } catch (e) {
317
441
  loadErrors.push(e)
318
442
  }
319
443
  try {
320
- return require('@napi-rs/image-linux-ppc64-gnu')
444
+ const binding = require('@napi-rs/image-openharmony-x64')
445
+ const bindingPackageVersion = require('@napi-rs/image-openharmony-x64/package.json').version
446
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
447
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
448
+ }
449
+ return binding
321
450
  } catch (e) {
322
451
  loadErrors.push(e)
323
452
  }
324
-
325
- } else if (process.arch === 's390x') {
453
+ } else if (process.arch === 'arm') {
326
454
  try {
327
- return require('./image.linux-s390x-gnu.node')
455
+ return require('./image.openharmony-arm.node')
328
456
  } catch (e) {
329
457
  loadErrors.push(e)
330
458
  }
331
459
  try {
332
- return require('@napi-rs/image-linux-s390x-gnu')
460
+ const binding = require('@napi-rs/image-openharmony-arm')
461
+ const bindingPackageVersion = require('@napi-rs/image-openharmony-arm/package.json').version
462
+ if (bindingPackageVersion !== '1.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
463
+ throw new Error(`Native binding package version mismatch, expected 1.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
464
+ }
465
+ return binding
333
466
  } catch (e) {
334
467
  loadErrors.push(e)
335
468
  }
336
-
337
469
  } else {
338
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
470
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
339
471
  }
340
472
  } else {
341
473
  loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napi-rs/image",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "main": "index.js",
5
5
  "browser": "browser.js",
6
6
  "types": "index.d.ts",
@@ -72,23 +72,23 @@
72
72
  },
73
73
  "repository": "git@github.com:Brooooooklyn/Image.git",
74
74
  "devDependencies": {
75
- "@napi-rs/cli": "^3.0.0-alpha.92",
76
- "@napi-rs/wasm-runtime": "^0.2.11"
75
+ "@napi-rs/cli": "^3.1.2",
76
+ "@napi-rs/wasm-runtime": "^1.0.3"
77
77
  },
78
- "gitHead": "b59adf7830adafecc7ca8559faec7a8df20bedb4",
78
+ "gitHead": "a1ebba9d4396da61a256a161595a0c15d3da88b5",
79
79
  "optionalDependencies": {
80
- "@napi-rs/image-darwin-x64": "1.11.0",
81
- "@napi-rs/image-win32-x64-msvc": "1.11.0",
82
- "@napi-rs/image-win32-arm64-msvc": "1.11.0",
83
- "@napi-rs/image-linux-x64-gnu": "1.11.0",
84
- "@napi-rs/image-darwin-arm64": "1.11.0",
85
- "@napi-rs/image-android-arm64": "1.11.0",
86
- "@napi-rs/image-linux-arm64-gnu": "1.11.0",
87
- "@napi-rs/image-linux-arm64-musl": "1.11.0",
88
- "@napi-rs/image-linux-arm-gnueabihf": "1.11.0",
89
- "@napi-rs/image-linux-x64-musl": "1.11.0",
90
- "@napi-rs/image-freebsd-x64": "1.11.0",
91
- "@napi-rs/image-win32-ia32-msvc": "1.11.0",
92
- "@napi-rs/image-wasm32-wasi": "1.11.0"
80
+ "@napi-rs/image-darwin-x64": "1.11.2",
81
+ "@napi-rs/image-win32-x64-msvc": "1.11.2",
82
+ "@napi-rs/image-win32-arm64-msvc": "1.11.2",
83
+ "@napi-rs/image-linux-x64-gnu": "1.11.2",
84
+ "@napi-rs/image-darwin-arm64": "1.11.2",
85
+ "@napi-rs/image-android-arm64": "1.11.2",
86
+ "@napi-rs/image-linux-arm64-gnu": "1.11.2",
87
+ "@napi-rs/image-linux-arm64-musl": "1.11.2",
88
+ "@napi-rs/image-linux-arm-gnueabihf": "1.11.2",
89
+ "@napi-rs/image-linux-x64-musl": "1.11.2",
90
+ "@napi-rs/image-freebsd-x64": "1.11.2",
91
+ "@napi-rs/image-win32-ia32-msvc": "1.11.2",
92
+ "@napi-rs/image-wasm32-wasi": "1.11.2"
93
93
  }
94
94
  }