@versatiles/versatiles-rs 4.13.0 → 4.15.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/index.cjs CHANGED
@@ -1,10 +1,13 @@
1
- // prettier-ignore
2
1
  /* eslint-disable */
3
2
  // @ts-nocheck
4
3
  /* auto-generated by NAPI-RS */
5
4
 
6
5
  const { readFileSync } = require('fs')
7
6
  let nativeBinding = null
7
+ // Which artifact actually loaded. The WASI fallback chain overwrites it with
8
+ // the flavor it resolved; the late native retry below leaves it alone because
9
+ // it only runs while no WASI candidate has been loaded.
10
+ let __napiLoadedBindingTarget = 'native'
8
11
  const loadErrors = []
9
12
 
10
13
  const isMusl = () => {
@@ -63,7 +66,16 @@ const isMuslFromChildProcess = () => {
63
66
  function requireNative() {
64
67
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
65
68
  try {
66
- return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
69
+ const overrideBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
70
+ // The override may be a generated WASI loader, which already reports its
71
+ // own flavor. Adopt it: `module.exports` aliases this object, so claiming
72
+ // 'native' would both misreport the artifact and overwrite the loader's
73
+ // marker through the alias.
74
+ __napiLoadedBindingTarget =
75
+ overrideBinding && typeof overrideBinding.__napiBindingTarget === 'string'
76
+ ? overrideBinding.__napiBindingTarget
77
+ : 'native'
78
+ return overrideBinding
67
79
  } catch (err) {
68
80
  loadErrors.push(err)
69
81
  }
@@ -77,8 +89,8 @@ function requireNative() {
77
89
  try {
78
90
  const binding = require('@versatiles/versatiles-rs-android-arm64')
79
91
  const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
92
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
93
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
94
  }
83
95
  return binding
84
96
  } catch (e) {
@@ -93,8 +105,8 @@ function requireNative() {
93
105
  try {
94
106
  const binding = require('@versatiles/versatiles-rs-android-arm-eabi')
95
107
  const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
108
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
109
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
110
  }
99
111
  return binding
100
112
  } catch (e) {
@@ -107,36 +119,36 @@ function requireNative() {
107
119
  if (process.arch === 'x64') {
108
120
  if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
109
121
  try {
110
- return require('./versatiles.win32-x64-gnu.node')
111
- } catch (e) {
112
- loadErrors.push(e)
113
- }
114
- try {
115
- const binding = require('@versatiles/versatiles-rs-win32-x64-gnu')
116
- const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
122
+ return require('./versatiles.win32-x64-gnu.node')
123
+ } catch (e) {
124
+ loadErrors.push(e)
125
+ }
126
+ try {
127
+ const binding = require('@versatiles/versatiles-rs-win32-x64-gnu')
128
+ const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-gnu/package.json').version
129
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
130
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
131
+ }
132
+ return binding
133
+ } catch (e) {
134
+ loadErrors.push(e)
119
135
  }
120
- return binding
121
- } catch (e) {
122
- loadErrors.push(e)
123
- }
124
136
  } else {
125
137
  try {
126
- return require('./versatiles.win32-x64-msvc.node')
127
- } catch (e) {
128
- loadErrors.push(e)
129
- }
130
- try {
131
- const binding = require('@versatiles/versatiles-rs-win32-x64-msvc')
132
- const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
138
+ return require('./versatiles.win32-x64-msvc.node')
139
+ } catch (e) {
140
+ loadErrors.push(e)
141
+ }
142
+ try {
143
+ const binding = require('@versatiles/versatiles-rs-win32-x64-msvc')
144
+ const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-msvc/package.json').version
145
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
146
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
147
+ }
148
+ return binding
149
+ } catch (e) {
150
+ loadErrors.push(e)
135
151
  }
136
- return binding
137
- } catch (e) {
138
- loadErrors.push(e)
139
- }
140
152
  }
141
153
  } else if (process.arch === 'ia32') {
142
154
  try {
@@ -147,8 +159,8 @@ function requireNative() {
147
159
  try {
148
160
  const binding = require('@versatiles/versatiles-rs-win32-ia32-msvc')
149
161
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '4.13.0' && 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 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
162
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
164
  }
153
165
  return binding
154
166
  } catch (e) {
@@ -163,8 +175,8 @@ function requireNative() {
163
175
  try {
164
176
  const binding = require('@versatiles/versatiles-rs-win32-arm64-msvc')
165
177
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
178
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
179
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
180
  }
169
181
  return binding
170
182
  } catch (e) {
@@ -182,8 +194,8 @@ function requireNative() {
182
194
  try {
183
195
  const binding = require('@versatiles/versatiles-rs-darwin-universal')
184
196
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
197
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
198
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
199
  }
188
200
  return binding
189
201
  } catch (e) {
@@ -198,8 +210,8 @@ function requireNative() {
198
210
  try {
199
211
  const binding = require('@versatiles/versatiles-rs-darwin-x64')
200
212
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
213
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
214
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
215
  }
204
216
  return binding
205
217
  } catch (e) {
@@ -214,8 +226,8 @@ function requireNative() {
214
226
  try {
215
227
  const binding = require('@versatiles/versatiles-rs-darwin-arm64')
216
228
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
229
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
230
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
231
  }
220
232
  return binding
221
233
  } catch (e) {
@@ -234,8 +246,8 @@ function requireNative() {
234
246
  try {
235
247
  const binding = require('@versatiles/versatiles-rs-freebsd-x64')
236
248
  const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
249
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
250
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
251
  }
240
252
  return binding
241
253
  } catch (e) {
@@ -250,8 +262,8 @@ function requireNative() {
250
262
  try {
251
263
  const binding = require('@versatiles/versatiles-rs-freebsd-arm64')
252
264
  const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
265
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
267
  }
256
268
  return binding
257
269
  } catch (e) {
@@ -271,8 +283,8 @@ function requireNative() {
271
283
  try {
272
284
  const binding = require('@versatiles/versatiles-rs-linux-x64-musl')
273
285
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
286
+ if (bindingPackageVersion !== '4.15.0' && 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 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
288
  }
277
289
  return binding
278
290
  } catch (e) {
@@ -287,8 +299,8 @@ function requireNative() {
287
299
  try {
288
300
  const binding = require('@versatiles/versatiles-rs-linux-x64-gnu')
289
301
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
302
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
303
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
304
  }
293
305
  return binding
294
306
  } catch (e) {
@@ -305,8 +317,8 @@ function requireNative() {
305
317
  try {
306
318
  const binding = require('@versatiles/versatiles-rs-linux-arm64-musl')
307
319
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
320
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
321
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
322
  }
311
323
  return binding
312
324
  } catch (e) {
@@ -321,8 +333,8 @@ function requireNative() {
321
333
  try {
322
334
  const binding = require('@versatiles/versatiles-rs-linux-arm64-gnu')
323
335
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
336
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
337
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
338
  }
327
339
  return binding
328
340
  } catch (e) {
@@ -339,8 +351,8 @@ function requireNative() {
339
351
  try {
340
352
  const binding = require('@versatiles/versatiles-rs-linux-arm-musleabihf')
341
353
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
354
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
355
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
356
  }
345
357
  return binding
346
358
  } catch (e) {
@@ -355,8 +367,8 @@ function requireNative() {
355
367
  try {
356
368
  const binding = require('@versatiles/versatiles-rs-linux-arm-gnueabihf')
357
369
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
370
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
371
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
372
  }
361
373
  return binding
362
374
  } catch (e) {
@@ -373,8 +385,8 @@ function requireNative() {
373
385
  try {
374
386
  const binding = require('@versatiles/versatiles-rs-linux-loong64-musl')
375
387
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
388
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
389
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
390
  }
379
391
  return binding
380
392
  } catch (e) {
@@ -389,8 +401,8 @@ function requireNative() {
389
401
  try {
390
402
  const binding = require('@versatiles/versatiles-rs-linux-loong64-gnu')
391
403
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
404
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
405
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
406
  }
395
407
  return binding
396
408
  } catch (e) {
@@ -407,8 +419,8 @@ function requireNative() {
407
419
  try {
408
420
  const binding = require('@versatiles/versatiles-rs-linux-riscv64-musl')
409
421
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '4.13.0' && 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 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
422
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
423
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
424
  }
413
425
  return binding
414
426
  } catch (e) {
@@ -423,8 +435,8 @@ function requireNative() {
423
435
  try {
424
436
  const binding = require('@versatiles/versatiles-rs-linux-riscv64-gnu')
425
437
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
438
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
439
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
440
  }
429
441
  return binding
430
442
  } catch (e) {
@@ -440,8 +452,8 @@ function requireNative() {
440
452
  try {
441
453
  const binding = require('@versatiles/versatiles-rs-linux-ppc64-gnu')
442
454
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '4.13.0' && 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 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
455
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
456
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
457
  }
446
458
  return binding
447
459
  } catch (e) {
@@ -456,8 +468,8 @@ function requireNative() {
456
468
  try {
457
469
  const binding = require('@versatiles/versatiles-rs-linux-s390x-gnu')
458
470
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '4.13.0' && 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 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
471
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
472
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
473
  }
462
474
  return binding
463
475
  } catch (e) {
@@ -476,8 +488,8 @@ function requireNative() {
476
488
  try {
477
489
  const binding = require('@versatiles/versatiles-rs-openharmony-arm64')
478
490
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
491
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
492
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
493
  }
482
494
  return binding
483
495
  } catch (e) {
@@ -492,8 +504,8 @@ function requireNative() {
492
504
  try {
493
505
  const binding = require('@versatiles/versatiles-rs-openharmony-x64')
494
506
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
507
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
508
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
509
  }
498
510
  return binding
499
511
  } catch (e) {
@@ -508,8 +520,8 @@ function requireNative() {
508
520
  try {
509
521
  const binding = require('@versatiles/versatiles-rs-openharmony-arm')
510
522
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
523
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
524
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
525
  }
514
526
  return binding
515
527
  } catch (e) {
@@ -550,7 +562,7 @@ function createLoadErrorChain(errors) {
550
562
  //
551
563
  // NAPI_RS_WASI_FLAVOR selects one exact generated flavor and implies strict
552
564
  // WASI loading. It never crosses into another flavor or falls back to native.
553
- const __napiWasiFlavors = ["wasm32-wasi"]
565
+ const __napiWasiFlavors = ['wasm32-wasi']
554
566
  const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR
555
567
  const __napiWasiFlavorRequested =
556
568
  typeof __napiWasiFlavor === 'string' && __napiWasiFlavor.length > 0
@@ -619,15 +631,16 @@ if (!nativeBinding || forceWasi) {
619
631
  }
620
632
  return null
621
633
  }
622
- if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
634
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
623
635
  let candidateError = null
624
636
  let candidateFailed = false
625
637
  try {
626
- candidateError = __napiWasiResolveCandidate('./versatiles.wasi.cjs', false, ["./versatiles.wasm32-wasi.debug.wasm","./versatiles.wasm32-wasi.wasm"])
638
+ candidateError = __napiWasiResolveCandidate('./versatiles.wasi.cjs', false, ['./versatiles.wasm32-wasi.debug.wasm', './versatiles.wasm32-wasi.wasm'])
627
639
  candidateFailed = candidateError !== null
628
640
  if (!candidateFailed) {
629
641
  wasiBinding = require('./versatiles.wasi.cjs')
630
642
  nativeBinding = wasiBinding
643
+ __napiLoadedBindingTarget = 'wasm32-wasi'
631
644
  wasiBindingLoaded = true
632
645
  }
633
646
  } catch (err) {
@@ -639,7 +652,7 @@ if (!nativeBinding || forceWasi) {
639
652
  loadErrors.push(candidateError)
640
653
  }
641
654
  }
642
- if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
655
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
643
656
  let candidateError = null
644
657
  let candidateFailed = false
645
658
  try {
@@ -648,12 +661,13 @@ if (!nativeBinding || forceWasi) {
648
661
  if (!candidateFailed) {
649
662
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
650
663
  const bindingPackageVersion = require('@versatiles/versatiles-rs-wasm32-wasi/package.json').version
651
- if (bindingPackageVersion !== '4.13.0') {
652
- throw new Error(`WASI binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
664
+ if (bindingPackageVersion !== '4.15.0') {
665
+ throw new Error(`WASI binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
653
666
  }
654
667
  }
655
668
  wasiBinding = require('@versatiles/versatiles-rs-wasm32-wasi')
656
669
  nativeBinding = wasiBinding
670
+ __napiLoadedBindingTarget = 'wasm32-wasi'
657
671
  wasiBindingLoaded = true
658
672
  }
659
673
  } catch (err) {
@@ -699,6 +713,70 @@ if (!nativeBinding) {
699
713
  throw new Error(`Failed to load native binding`)
700
714
  }
701
715
 
716
+ function __napiStampBindingTarget(exportsObject, target) {
717
+ if (
718
+ Object.prototype.hasOwnProperty.call(exportsObject, '__napiBindingTarget')
719
+ ) {
720
+ if (exportsObject.__napiBindingTarget === target) {
721
+ // Already ours: the root entry aliases the object it loaded, so a WASI
722
+ // fallback candidate — or a `NAPI_RS_NATIVE_LIBRARY_PATH` override that
723
+ // is a generated loader — arrives already stamped with this same value.
724
+ return target
725
+ }
726
+ const error = new Error(
727
+ '`__napiBindingTarget` is reserved by the generated binding loader, but the loaded binding already exports it. Rename the export, e.g. #[napi(js_name = "...")].',
728
+ )
729
+ error.code = 'ERR_NAPI_BINDING_TARGET_CONFLICT'
730
+ throw error
731
+ }
732
+ if (!Object.isExtensible(exportsObject)) {
733
+ // A `#[napi(module_exports)]` hook may seal or freeze this object
734
+ // (`Object::seal` / `Object::freeze`). Reporting the artifact is metadata,
735
+ // never a reason to fail an otherwise successful load, so the stamp is
736
+ // skipped. What a consumer still sees then follows the entry point: the
737
+ // browser and deferred loaders declare `__napiBindingTarget` at module
738
+ // level and go on reporting it, while the CommonJS entries hand back this
739
+ // very object as `module.exports`, so there the value is absent.
740
+ return target
741
+ }
742
+ try {
743
+ // [[Define]], not [[Set]]: an ordinary assignment walks the prototype
744
+ // chain, so an inherited accessor could swallow the value or throw and
745
+ // fail an otherwise successful load. The descriptor is what a successful
746
+ // assignment would have produced.
747
+ Object.defineProperty(exportsObject, '__napiBindingTarget', {
748
+ configurable: true,
749
+ enumerable: true,
750
+ value: target,
751
+ writable: true,
752
+ })
753
+ } catch {
754
+ // Same rule as the non-extensible skip above: reporting the artifact is
755
+ // metadata, never a reason to fail an otherwise successful load. An exotic
756
+ // object (a Proxy whose defineProperty trap refuses) is skipped, not
757
+ // thrown over.
758
+ }
759
+ // The CommonJS loaders assign this return value so `cjs-module-lexer` — and
760
+ // therefore Node's CJS -> ESM named export detection — can see
761
+ // `__napiBindingTarget` statically.
762
+ return target
763
+ }
764
+ // Stamp before the alias, not after. The guard only reads `nativeBinding`
765
+ // (`hasOwnProperty` plus a comparison), which is safe against any addon
766
+ // accessor; an assignment is not, because a `#[napi(module_exports)]` hook can
767
+ // expose a getter reporting this very value and a setter that throws. So the
768
+ // assignment lands on the loader's own `module.exports`, still the original
769
+ // object here, and the alias below replaces it.
770
+ //
771
+ // The assignment is what keeps the marker a statically visible CommonJS export:
772
+ // `cjs-module-lexer` is Node's CJS -> ESM named export detection, it cannot see
773
+ // a bare call, and the later `module.exports = nativeBinding` does not undo the
774
+ // detection. The assignment itself always succeeds — its target is this
775
+ // loader's own, still extensible `module.exports` — and the alias below then
776
+ // discards the value it wrote. What a consumer reads is whatever the guard put
777
+ // on `nativeBinding`, so on a frozen binding, where the guard skips, the
778
+ // linked import resolves to `undefined`.
779
+ module.exports.__napiBindingTarget = __napiStampBindingTarget(nativeBinding, __napiLoadedBindingTarget)
702
780
  module.exports = nativeBinding
703
781
  module.exports.Progress = nativeBinding.Progress
704
782
  module.exports.SourceType = nativeBinding.SourceType
package/index.d.ts CHANGED
@@ -1,5 +1,14 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+
4
+ /**
5
+ * Which binding artifact the generated loader actually loaded: `'native'` for
6
+ * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
7
+ * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
8
+ * can point the loader at a WASI artifact this package does not build itself.
9
+ */
10
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
11
+
3
12
  /**
4
13
  * Progress monitor for long-running operations
5
14
  *
package/index.js CHANGED
@@ -1,4 +1,3 @@
1
- // prettier-ignore
2
1
  /* eslint-disable */
3
2
  // @ts-nocheck
4
3
  /* auto-generated by NAPI-RS */
@@ -8,6 +7,10 @@ const require = createRequire(import.meta.url)
8
7
 
9
8
  const { readFileSync } = require('fs')
10
9
  let nativeBinding = null
10
+ // Which artifact actually loaded. The WASI fallback chain overwrites it with
11
+ // the flavor it resolved; the late native retry below leaves it alone because
12
+ // it only runs while no WASI candidate has been loaded.
13
+ let __napiLoadedBindingTarget = 'native'
11
14
  const loadErrors = []
12
15
 
13
16
  const isMusl = () => {
@@ -66,7 +69,16 @@ const isMuslFromChildProcess = () => {
66
69
  function requireNative() {
67
70
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
68
71
  try {
69
- return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
72
+ const overrideBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
73
+ // The override may be a generated WASI loader, which already reports its
74
+ // own flavor. Adopt it: `module.exports` aliases this object, so claiming
75
+ // 'native' would both misreport the artifact and overwrite the loader's
76
+ // marker through the alias.
77
+ __napiLoadedBindingTarget =
78
+ overrideBinding && typeof overrideBinding.__napiBindingTarget === 'string'
79
+ ? overrideBinding.__napiBindingTarget
80
+ : 'native'
81
+ return overrideBinding
70
82
  } catch (err) {
71
83
  loadErrors.push(err)
72
84
  }
@@ -80,8 +92,8 @@ function requireNative() {
80
92
  try {
81
93
  const binding = require('@versatiles/versatiles-rs-android-arm64')
82
94
  const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm64/package.json').version
83
- if (bindingPackageVersion !== '4.13.0' && 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 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
95
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
96
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
85
97
  }
86
98
  return binding
87
99
  } catch (e) {
@@ -96,8 +108,8 @@ function requireNative() {
96
108
  try {
97
109
  const binding = require('@versatiles/versatiles-rs-android-arm-eabi')
98
110
  const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm-eabi/package.json').version
99
- if (bindingPackageVersion !== '4.13.0' && 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 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
111
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
112
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
113
  }
102
114
  return binding
103
115
  } catch (e) {
@@ -110,36 +122,36 @@ function requireNative() {
110
122
  if (process.arch === 'x64') {
111
123
  if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
112
124
  try {
113
- return require('./versatiles.win32-x64-gnu.node')
114
- } catch (e) {
115
- loadErrors.push(e)
116
- }
117
- try {
118
- const binding = require('@versatiles/versatiles-rs-win32-x64-gnu')
119
- const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-gnu/package.json').version
120
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
125
+ return require('./versatiles.win32-x64-gnu.node')
126
+ } catch (e) {
127
+ loadErrors.push(e)
128
+ }
129
+ try {
130
+ const binding = require('@versatiles/versatiles-rs-win32-x64-gnu')
131
+ const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-gnu/package.json').version
132
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
133
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
134
+ }
135
+ return binding
136
+ } catch (e) {
137
+ loadErrors.push(e)
122
138
  }
123
- return binding
124
- } catch (e) {
125
- loadErrors.push(e)
126
- }
127
139
  } else {
128
140
  try {
129
- return require('./versatiles.win32-x64-msvc.node')
130
- } catch (e) {
131
- loadErrors.push(e)
132
- }
133
- try {
134
- const binding = require('@versatiles/versatiles-rs-win32-x64-msvc')
135
- const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-msvc/package.json').version
136
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
141
+ return require('./versatiles.win32-x64-msvc.node')
142
+ } catch (e) {
143
+ loadErrors.push(e)
144
+ }
145
+ try {
146
+ const binding = require('@versatiles/versatiles-rs-win32-x64-msvc')
147
+ const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-msvc/package.json').version
148
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
149
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ }
151
+ return binding
152
+ } catch (e) {
153
+ loadErrors.push(e)
138
154
  }
139
- return binding
140
- } catch (e) {
141
- loadErrors.push(e)
142
- }
143
155
  }
144
156
  } else if (process.arch === 'ia32') {
145
157
  try {
@@ -150,8 +162,8 @@ function requireNative() {
150
162
  try {
151
163
  const binding = require('@versatiles/versatiles-rs-win32-ia32-msvc')
152
164
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-ia32-msvc/package.json').version
153
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
154
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
165
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
166
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
155
167
  }
156
168
  return binding
157
169
  } catch (e) {
@@ -166,8 +178,8 @@ function requireNative() {
166
178
  try {
167
179
  const binding = require('@versatiles/versatiles-rs-win32-arm64-msvc')
168
180
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-arm64-msvc/package.json').version
169
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
170
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
181
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
182
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
171
183
  }
172
184
  return binding
173
185
  } catch (e) {
@@ -185,8 +197,8 @@ function requireNative() {
185
197
  try {
186
198
  const binding = require('@versatiles/versatiles-rs-darwin-universal')
187
199
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-universal/package.json').version
188
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
189
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
200
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
201
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
190
202
  }
191
203
  return binding
192
204
  } catch (e) {
@@ -201,8 +213,8 @@ function requireNative() {
201
213
  try {
202
214
  const binding = require('@versatiles/versatiles-rs-darwin-x64')
203
215
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-x64/package.json').version
204
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
205
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
216
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
217
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
206
218
  }
207
219
  return binding
208
220
  } catch (e) {
@@ -217,8 +229,8 @@ function requireNative() {
217
229
  try {
218
230
  const binding = require('@versatiles/versatiles-rs-darwin-arm64')
219
231
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-arm64/package.json').version
220
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
221
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
232
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
233
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
222
234
  }
223
235
  return binding
224
236
  } catch (e) {
@@ -237,8 +249,8 @@ function requireNative() {
237
249
  try {
238
250
  const binding = require('@versatiles/versatiles-rs-freebsd-x64')
239
251
  const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-x64/package.json').version
240
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
241
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
252
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
253
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
242
254
  }
243
255
  return binding
244
256
  } catch (e) {
@@ -253,8 +265,8 @@ function requireNative() {
253
265
  try {
254
266
  const binding = require('@versatiles/versatiles-rs-freebsd-arm64')
255
267
  const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-arm64/package.json').version
256
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
257
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
268
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
269
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
258
270
  }
259
271
  return binding
260
272
  } catch (e) {
@@ -274,8 +286,8 @@ function requireNative() {
274
286
  try {
275
287
  const binding = require('@versatiles/versatiles-rs-linux-x64-musl')
276
288
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-musl/package.json').version
277
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
278
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
289
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
290
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
279
291
  }
280
292
  return binding
281
293
  } catch (e) {
@@ -290,8 +302,8 @@ function requireNative() {
290
302
  try {
291
303
  const binding = require('@versatiles/versatiles-rs-linux-x64-gnu')
292
304
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-gnu/package.json').version
293
- if (bindingPackageVersion !== '4.13.0' && 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 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
305
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
306
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
295
307
  }
296
308
  return binding
297
309
  } catch (e) {
@@ -308,8 +320,8 @@ function requireNative() {
308
320
  try {
309
321
  const binding = require('@versatiles/versatiles-rs-linux-arm64-musl')
310
322
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-musl/package.json').version
311
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
312
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
323
+ if (bindingPackageVersion !== '4.15.0' && 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 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
313
325
  }
314
326
  return binding
315
327
  } catch (e) {
@@ -324,8 +336,8 @@ function requireNative() {
324
336
  try {
325
337
  const binding = require('@versatiles/versatiles-rs-linux-arm64-gnu')
326
338
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-gnu/package.json').version
327
- if (bindingPackageVersion !== '4.13.0' && 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 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
339
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
340
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
329
341
  }
330
342
  return binding
331
343
  } catch (e) {
@@ -342,8 +354,8 @@ function requireNative() {
342
354
  try {
343
355
  const binding = require('@versatiles/versatiles-rs-linux-arm-musleabihf')
344
356
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-musleabihf/package.json').version
345
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
346
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
357
+ if (bindingPackageVersion !== '4.15.0' && 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 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
347
359
  }
348
360
  return binding
349
361
  } catch (e) {
@@ -358,8 +370,8 @@ function requireNative() {
358
370
  try {
359
371
  const binding = require('@versatiles/versatiles-rs-linux-arm-gnueabihf')
360
372
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-gnueabihf/package.json').version
361
- if (bindingPackageVersion !== '4.13.0' && 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 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
373
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
374
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
375
  }
364
376
  return binding
365
377
  } catch (e) {
@@ -376,8 +388,8 @@ function requireNative() {
376
388
  try {
377
389
  const binding = require('@versatiles/versatiles-rs-linux-loong64-musl')
378
390
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-musl/package.json').version
379
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
380
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
391
+ if (bindingPackageVersion !== '4.15.0' && 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 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
381
393
  }
382
394
  return binding
383
395
  } catch (e) {
@@ -392,8 +404,8 @@ function requireNative() {
392
404
  try {
393
405
  const binding = require('@versatiles/versatiles-rs-linux-loong64-gnu')
394
406
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-gnu/package.json').version
395
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
396
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
407
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
408
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
397
409
  }
398
410
  return binding
399
411
  } catch (e) {
@@ -410,8 +422,8 @@ function requireNative() {
410
422
  try {
411
423
  const binding = require('@versatiles/versatiles-rs-linux-riscv64-musl')
412
424
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-musl/package.json').version
413
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
414
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
425
+ if (bindingPackageVersion !== '4.15.0' && 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 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
415
427
  }
416
428
  return binding
417
429
  } catch (e) {
@@ -426,8 +438,8 @@ function requireNative() {
426
438
  try {
427
439
  const binding = require('@versatiles/versatiles-rs-linux-riscv64-gnu')
428
440
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-gnu/package.json').version
429
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
430
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
441
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
442
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
431
443
  }
432
444
  return binding
433
445
  } catch (e) {
@@ -443,8 +455,8 @@ function requireNative() {
443
455
  try {
444
456
  const binding = require('@versatiles/versatiles-rs-linux-ppc64-gnu')
445
457
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-ppc64-gnu/package.json').version
446
- if (bindingPackageVersion !== '4.13.0' && 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 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
458
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
459
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
448
460
  }
449
461
  return binding
450
462
  } catch (e) {
@@ -459,8 +471,8 @@ function requireNative() {
459
471
  try {
460
472
  const binding = require('@versatiles/versatiles-rs-linux-s390x-gnu')
461
473
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-s390x-gnu/package.json').version
462
- if (bindingPackageVersion !== '4.13.0' && 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 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
474
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
475
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
464
476
  }
465
477
  return binding
466
478
  } catch (e) {
@@ -479,8 +491,8 @@ function requireNative() {
479
491
  try {
480
492
  const binding = require('@versatiles/versatiles-rs-openharmony-arm64')
481
493
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm64/package.json').version
482
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
483
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
494
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
495
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
484
496
  }
485
497
  return binding
486
498
  } catch (e) {
@@ -495,8 +507,8 @@ function requireNative() {
495
507
  try {
496
508
  const binding = require('@versatiles/versatiles-rs-openharmony-x64')
497
509
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-x64/package.json').version
498
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
499
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
510
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
511
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
500
512
  }
501
513
  return binding
502
514
  } catch (e) {
@@ -511,8 +523,8 @@ function requireNative() {
511
523
  try {
512
524
  const binding = require('@versatiles/versatiles-rs-openharmony-arm')
513
525
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm/package.json').version
514
- if (bindingPackageVersion !== '4.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
515
- throw new Error(`Native binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
526
+ if (bindingPackageVersion !== '4.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
527
+ throw new Error(`Native binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
516
528
  }
517
529
  return binding
518
530
  } catch (e) {
@@ -553,7 +565,7 @@ function createLoadErrorChain(errors) {
553
565
  //
554
566
  // NAPI_RS_WASI_FLAVOR selects one exact generated flavor and implies strict
555
567
  // WASI loading. It never crosses into another flavor or falls back to native.
556
- const __napiWasiFlavors = ["wasm32-wasi"]
568
+ const __napiWasiFlavors = ['wasm32-wasi']
557
569
  const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR
558
570
  const __napiWasiFlavorRequested =
559
571
  typeof __napiWasiFlavor === 'string' && __napiWasiFlavor.length > 0
@@ -622,15 +634,16 @@ if (!nativeBinding || forceWasi) {
622
634
  }
623
635
  return null
624
636
  }
625
- if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
637
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
626
638
  let candidateError = null
627
639
  let candidateFailed = false
628
640
  try {
629
- candidateError = __napiWasiResolveCandidate('./versatiles.wasi.cjs', false, ["./versatiles.wasm32-wasi.debug.wasm","./versatiles.wasm32-wasi.wasm"])
641
+ candidateError = __napiWasiResolveCandidate('./versatiles.wasi.cjs', false, ['./versatiles.wasm32-wasi.debug.wasm', './versatiles.wasm32-wasi.wasm'])
630
642
  candidateFailed = candidateError !== null
631
643
  if (!candidateFailed) {
632
644
  wasiBinding = require('./versatiles.wasi.cjs')
633
645
  nativeBinding = wasiBinding
646
+ __napiLoadedBindingTarget = 'wasm32-wasi'
634
647
  wasiBindingLoaded = true
635
648
  }
636
649
  } catch (err) {
@@ -642,7 +655,7 @@ if (!nativeBinding || forceWasi) {
642
655
  loadErrors.push(candidateError)
643
656
  }
644
657
  }
645
- if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
658
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
646
659
  let candidateError = null
647
660
  let candidateFailed = false
648
661
  try {
@@ -651,12 +664,13 @@ if (!nativeBinding || forceWasi) {
651
664
  if (!candidateFailed) {
652
665
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
653
666
  const bindingPackageVersion = require('@versatiles/versatiles-rs-wasm32-wasi/package.json').version
654
- if (bindingPackageVersion !== '4.13.0') {
655
- throw new Error(`WASI binding package version mismatch, expected 4.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
667
+ if (bindingPackageVersion !== '4.15.0') {
668
+ throw new Error(`WASI binding package version mismatch, expected 4.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
656
669
  }
657
670
  }
658
671
  wasiBinding = require('@versatiles/versatiles-rs-wasm32-wasi')
659
672
  nativeBinding = wasiBinding
673
+ __napiLoadedBindingTarget = 'wasm32-wasi'
660
674
  wasiBindingLoaded = true
661
675
  }
662
676
  } catch (err) {
@@ -717,3 +731,4 @@ export { parseVpl }
717
731
  export { parseVplCst }
718
732
  export { stringifyVpl }
719
733
  export { stringifyVplCst }
734
+ export const __napiBindingTarget = __napiLoadedBindingTarget
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versatiles/versatiles-rs",
3
- "version": "4.13.0",
3
+ "version": "4.15.0",
4
4
  "description": "Node.js bindings for VersaTiles - convert, serve, and process map tiles",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -87,29 +87,29 @@
87
87
  },
88
88
  "devDependencies": {
89
89
  "@eslint/js": "^10.0.1",
90
- "@napi-rs/cli": "^3.9.0",
91
- "@types/node": "^26.4.1",
92
- "@vitest/ui": "^5.0.0",
90
+ "@napi-rs/cli": "^3.10.4",
91
+ "@types/node": "^26.6.1",
92
+ "@vitest/ui": "^5.0.1",
93
93
  "chalk": "^6.0.0",
94
- "eslint": "^10.10.0",
94
+ "eslint": "^10.11.0",
95
95
  "eslint-config-prettier": "^10.1.8",
96
96
  "npm-check-updates": "^23.1.0",
97
- "prettier": "^3.9.6",
97
+ "prettier": "^3.9.8",
98
98
  "tsx": "^4.23.13",
99
99
  "typedoc": "^0.28.20",
100
100
  "typescript": "^6.0.3",
101
- "typescript-eslint": "^8.69.0",
102
- "vitest": "^5.0.0"
101
+ "typescript-eslint": "^8.70.0",
102
+ "vitest": "^5.0.1"
103
103
  },
104
104
  "optionalDependencies": {
105
- "@versatiles/versatiles-rs-darwin-arm64": "4.13.0",
106
- "@versatiles/versatiles-rs-darwin-x64": "4.13.0",
107
- "@versatiles/versatiles-rs-linux-arm64-gnu": "4.13.0",
108
- "@versatiles/versatiles-rs-linux-arm64-musl": "4.13.0",
109
- "@versatiles/versatiles-rs-linux-x64-gnu": "4.13.0",
110
- "@versatiles/versatiles-rs-linux-x64-musl": "4.13.0",
111
- "@versatiles/versatiles-rs-win32-arm64-msvc": "4.13.0",
112
- "@versatiles/versatiles-rs-win32-x64-msvc": "4.13.0"
105
+ "@versatiles/versatiles-rs-darwin-arm64": "4.15.0",
106
+ "@versatiles/versatiles-rs-darwin-x64": "4.15.0",
107
+ "@versatiles/versatiles-rs-linux-arm64-gnu": "4.15.0",
108
+ "@versatiles/versatiles-rs-linux-arm64-musl": "4.15.0",
109
+ "@versatiles/versatiles-rs-linux-x64-gnu": "4.15.0",
110
+ "@versatiles/versatiles-rs-linux-x64-musl": "4.15.0",
111
+ "@versatiles/versatiles-rs-win32-arm64-msvc": "4.15.0",
112
+ "@versatiles/versatiles-rs-win32-x64-msvc": "4.15.0"
113
113
  },
114
114
  "allowScripts": {
115
115
  "esbuild": true,
package/vpl.d.ts CHANGED
@@ -596,6 +596,10 @@ export interface VectorOverzoomOptions {
596
596
  */
597
597
  buffer?: number;
598
598
  }
599
+ export interface VectorReduceToStyleOptions {
600
+ /** Path to the MapLibre style JSON the tileset should be reduced to. */
601
+ style: string;
602
+ }
599
603
  export interface VectorRepairOptions {
600
604
  /**
601
605
  * Whether to remove features whose geometry cannot be decoded. Defaults to `false`.
@@ -701,6 +705,8 @@ export declare class VPL {
701
705
  vectorFilterProperties(options: VectorFilterPropertiesOptions): VPL;
702
706
  /** Serves vector tiles above the source's highest zoom level by clipping and rescaling. */
703
707
  vectorOverzoom(options?: VectorOverzoomOptions): VPL;
708
+ /** Reduces vector tiles to what one MapLibre style actually draws. */
709
+ vectorReduceToStyle(options: VectorReduceToStyleOptions): VPL;
704
710
  /** Repairs vector tiles so that they conform to MVT 2.1. */
705
711
  vectorRepair(options?: VectorRepairOptions): VPL;
706
712
  /** Joins tabular data onto vector features, matching on an id column. */
package/vpl.js CHANGED
@@ -391,6 +391,12 @@ export class VPL {
391
391
  params['buffer'] = options?.buffer;
392
392
  return new VPL([...this.steps, { name: 'vector_overzoom', params }]);
393
393
  }
394
+ /** Reduces vector tiles to what one MapLibre style actually draws. */
395
+ vectorReduceToStyle(options) {
396
+ const params = {};
397
+ params['style'] = options.style;
398
+ return new VPL([...this.steps, { name: 'vector_reduce_to_style', params }]);
399
+ }
394
400
  /** Repairs vector tiles so that they conform to MVT 2.1. */
395
401
  vectorRepair(options) {
396
402
  const params = {};