@versatiles/versatiles-rs 4.14.0 → 5.0.0-rc.1
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 +134 -55
- package/index.d.ts +8 -0
- package/index.js +71 -55
- package/package.json +15 -15
- package/vpl.d.ts +7 -1
- package/vpl.js +6 -0
package/index.cjs
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
const { readFileSync } = require('fs')
|
|
6
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'
|
|
7
11
|
const loadErrors = []
|
|
8
12
|
|
|
9
13
|
const isMusl = () => {
|
|
@@ -62,7 +66,16 @@ const isMuslFromChildProcess = () => {
|
|
|
62
66
|
function requireNative() {
|
|
63
67
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
64
68
|
try {
|
|
65
|
-
|
|
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
|
|
66
79
|
} catch (err) {
|
|
67
80
|
loadErrors.push(err)
|
|
68
81
|
}
|
|
@@ -76,8 +89,8 @@ function requireNative() {
|
|
|
76
89
|
try {
|
|
77
90
|
const binding = require('@versatiles/versatiles-rs-android-arm64')
|
|
78
91
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm64/package.json').version
|
|
79
|
-
if (bindingPackageVersion !== '
|
|
80
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
92
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
81
94
|
}
|
|
82
95
|
return binding
|
|
83
96
|
} catch (e) {
|
|
@@ -92,8 +105,8 @@ function requireNative() {
|
|
|
92
105
|
try {
|
|
93
106
|
const binding = require('@versatiles/versatiles-rs-android-arm-eabi')
|
|
94
107
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm-eabi/package.json').version
|
|
95
|
-
if (bindingPackageVersion !== '
|
|
96
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
108
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
97
110
|
}
|
|
98
111
|
return binding
|
|
99
112
|
} catch (e) {
|
|
@@ -113,8 +126,8 @@ function requireNative() {
|
|
|
113
126
|
try {
|
|
114
127
|
const binding = require('@versatiles/versatiles-rs-win32-x64-gnu')
|
|
115
128
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-gnu/package.json').version
|
|
116
|
-
if (bindingPackageVersion !== '
|
|
117
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
129
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
118
131
|
}
|
|
119
132
|
return binding
|
|
120
133
|
} catch (e) {
|
|
@@ -129,8 +142,8 @@ function requireNative() {
|
|
|
129
142
|
try {
|
|
130
143
|
const binding = require('@versatiles/versatiles-rs-win32-x64-msvc')
|
|
131
144
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-msvc/package.json').version
|
|
132
|
-
if (bindingPackageVersion !== '
|
|
133
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
145
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
134
147
|
}
|
|
135
148
|
return binding
|
|
136
149
|
} catch (e) {
|
|
@@ -146,8 +159,8 @@ function requireNative() {
|
|
|
146
159
|
try {
|
|
147
160
|
const binding = require('@versatiles/versatiles-rs-win32-ia32-msvc')
|
|
148
161
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-ia32-msvc/package.json').version
|
|
149
|
-
if (bindingPackageVersion !== '
|
|
150
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
162
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
151
164
|
}
|
|
152
165
|
return binding
|
|
153
166
|
} catch (e) {
|
|
@@ -162,8 +175,8 @@ function requireNative() {
|
|
|
162
175
|
try {
|
|
163
176
|
const binding = require('@versatiles/versatiles-rs-win32-arm64-msvc')
|
|
164
177
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-arm64-msvc/package.json').version
|
|
165
|
-
if (bindingPackageVersion !== '
|
|
166
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
178
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
167
180
|
}
|
|
168
181
|
return binding
|
|
169
182
|
} catch (e) {
|
|
@@ -181,8 +194,8 @@ function requireNative() {
|
|
|
181
194
|
try {
|
|
182
195
|
const binding = require('@versatiles/versatiles-rs-darwin-universal')
|
|
183
196
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-universal/package.json').version
|
|
184
|
-
if (bindingPackageVersion !== '
|
|
185
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
197
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
186
199
|
}
|
|
187
200
|
return binding
|
|
188
201
|
} catch (e) {
|
|
@@ -197,8 +210,8 @@ function requireNative() {
|
|
|
197
210
|
try {
|
|
198
211
|
const binding = require('@versatiles/versatiles-rs-darwin-x64')
|
|
199
212
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-x64/package.json').version
|
|
200
|
-
if (bindingPackageVersion !== '
|
|
201
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
213
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
202
215
|
}
|
|
203
216
|
return binding
|
|
204
217
|
} catch (e) {
|
|
@@ -213,8 +226,8 @@ function requireNative() {
|
|
|
213
226
|
try {
|
|
214
227
|
const binding = require('@versatiles/versatiles-rs-darwin-arm64')
|
|
215
228
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-arm64/package.json').version
|
|
216
|
-
if (bindingPackageVersion !== '
|
|
217
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
229
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
218
231
|
}
|
|
219
232
|
return binding
|
|
220
233
|
} catch (e) {
|
|
@@ -233,8 +246,8 @@ function requireNative() {
|
|
|
233
246
|
try {
|
|
234
247
|
const binding = require('@versatiles/versatiles-rs-freebsd-x64')
|
|
235
248
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-x64/package.json').version
|
|
236
|
-
if (bindingPackageVersion !== '
|
|
237
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
249
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
238
251
|
}
|
|
239
252
|
return binding
|
|
240
253
|
} catch (e) {
|
|
@@ -249,8 +262,8 @@ function requireNative() {
|
|
|
249
262
|
try {
|
|
250
263
|
const binding = require('@versatiles/versatiles-rs-freebsd-arm64')
|
|
251
264
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-arm64/package.json').version
|
|
252
|
-
if (bindingPackageVersion !== '
|
|
253
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
265
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
254
267
|
}
|
|
255
268
|
return binding
|
|
256
269
|
} catch (e) {
|
|
@@ -270,8 +283,8 @@ function requireNative() {
|
|
|
270
283
|
try {
|
|
271
284
|
const binding = require('@versatiles/versatiles-rs-linux-x64-musl')
|
|
272
285
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-musl/package.json').version
|
|
273
|
-
if (bindingPackageVersion !== '
|
|
274
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
286
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
275
288
|
}
|
|
276
289
|
return binding
|
|
277
290
|
} catch (e) {
|
|
@@ -286,8 +299,8 @@ function requireNative() {
|
|
|
286
299
|
try {
|
|
287
300
|
const binding = require('@versatiles/versatiles-rs-linux-x64-gnu')
|
|
288
301
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-gnu/package.json').version
|
|
289
|
-
if (bindingPackageVersion !== '
|
|
290
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
302
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
291
304
|
}
|
|
292
305
|
return binding
|
|
293
306
|
} catch (e) {
|
|
@@ -304,8 +317,8 @@ function requireNative() {
|
|
|
304
317
|
try {
|
|
305
318
|
const binding = require('@versatiles/versatiles-rs-linux-arm64-musl')
|
|
306
319
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-musl/package.json').version
|
|
307
|
-
if (bindingPackageVersion !== '
|
|
308
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
320
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
309
322
|
}
|
|
310
323
|
return binding
|
|
311
324
|
} catch (e) {
|
|
@@ -320,8 +333,8 @@ function requireNative() {
|
|
|
320
333
|
try {
|
|
321
334
|
const binding = require('@versatiles/versatiles-rs-linux-arm64-gnu')
|
|
322
335
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-gnu/package.json').version
|
|
323
|
-
if (bindingPackageVersion !== '
|
|
324
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
336
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
325
338
|
}
|
|
326
339
|
return binding
|
|
327
340
|
} catch (e) {
|
|
@@ -338,8 +351,8 @@ function requireNative() {
|
|
|
338
351
|
try {
|
|
339
352
|
const binding = require('@versatiles/versatiles-rs-linux-arm-musleabihf')
|
|
340
353
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-musleabihf/package.json').version
|
|
341
|
-
if (bindingPackageVersion !== '
|
|
342
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
354
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
343
356
|
}
|
|
344
357
|
return binding
|
|
345
358
|
} catch (e) {
|
|
@@ -354,8 +367,8 @@ function requireNative() {
|
|
|
354
367
|
try {
|
|
355
368
|
const binding = require('@versatiles/versatiles-rs-linux-arm-gnueabihf')
|
|
356
369
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-gnueabihf/package.json').version
|
|
357
|
-
if (bindingPackageVersion !== '
|
|
358
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
370
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
359
372
|
}
|
|
360
373
|
return binding
|
|
361
374
|
} catch (e) {
|
|
@@ -372,8 +385,8 @@ function requireNative() {
|
|
|
372
385
|
try {
|
|
373
386
|
const binding = require('@versatiles/versatiles-rs-linux-loong64-musl')
|
|
374
387
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-musl/package.json').version
|
|
375
|
-
if (bindingPackageVersion !== '
|
|
376
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
388
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
377
390
|
}
|
|
378
391
|
return binding
|
|
379
392
|
} catch (e) {
|
|
@@ -388,8 +401,8 @@ function requireNative() {
|
|
|
388
401
|
try {
|
|
389
402
|
const binding = require('@versatiles/versatiles-rs-linux-loong64-gnu')
|
|
390
403
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-gnu/package.json').version
|
|
391
|
-
if (bindingPackageVersion !== '
|
|
392
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
404
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
393
406
|
}
|
|
394
407
|
return binding
|
|
395
408
|
} catch (e) {
|
|
@@ -406,8 +419,8 @@ function requireNative() {
|
|
|
406
419
|
try {
|
|
407
420
|
const binding = require('@versatiles/versatiles-rs-linux-riscv64-musl')
|
|
408
421
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-musl/package.json').version
|
|
409
|
-
if (bindingPackageVersion !== '
|
|
410
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
422
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
411
424
|
}
|
|
412
425
|
return binding
|
|
413
426
|
} catch (e) {
|
|
@@ -422,8 +435,8 @@ function requireNative() {
|
|
|
422
435
|
try {
|
|
423
436
|
const binding = require('@versatiles/versatiles-rs-linux-riscv64-gnu')
|
|
424
437
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-gnu/package.json').version
|
|
425
|
-
if (bindingPackageVersion !== '
|
|
426
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
438
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
427
440
|
}
|
|
428
441
|
return binding
|
|
429
442
|
} catch (e) {
|
|
@@ -439,8 +452,8 @@ function requireNative() {
|
|
|
439
452
|
try {
|
|
440
453
|
const binding = require('@versatiles/versatiles-rs-linux-ppc64-gnu')
|
|
441
454
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-ppc64-gnu/package.json').version
|
|
442
|
-
if (bindingPackageVersion !== '
|
|
443
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
455
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
444
457
|
}
|
|
445
458
|
return binding
|
|
446
459
|
} catch (e) {
|
|
@@ -455,8 +468,8 @@ function requireNative() {
|
|
|
455
468
|
try {
|
|
456
469
|
const binding = require('@versatiles/versatiles-rs-linux-s390x-gnu')
|
|
457
470
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-s390x-gnu/package.json').version
|
|
458
|
-
if (bindingPackageVersion !== '
|
|
459
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
471
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
460
473
|
}
|
|
461
474
|
return binding
|
|
462
475
|
} catch (e) {
|
|
@@ -475,8 +488,8 @@ function requireNative() {
|
|
|
475
488
|
try {
|
|
476
489
|
const binding = require('@versatiles/versatiles-rs-openharmony-arm64')
|
|
477
490
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm64/package.json').version
|
|
478
|
-
if (bindingPackageVersion !== '
|
|
479
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
491
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
480
493
|
}
|
|
481
494
|
return binding
|
|
482
495
|
} catch (e) {
|
|
@@ -491,8 +504,8 @@ function requireNative() {
|
|
|
491
504
|
try {
|
|
492
505
|
const binding = require('@versatiles/versatiles-rs-openharmony-x64')
|
|
493
506
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-x64/package.json').version
|
|
494
|
-
if (bindingPackageVersion !== '
|
|
495
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
507
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
496
509
|
}
|
|
497
510
|
return binding
|
|
498
511
|
} catch (e) {
|
|
@@ -507,8 +520,8 @@ function requireNative() {
|
|
|
507
520
|
try {
|
|
508
521
|
const binding = require('@versatiles/versatiles-rs-openharmony-arm')
|
|
509
522
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm/package.json').version
|
|
510
|
-
if (bindingPackageVersion !== '
|
|
511
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
523
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
512
525
|
}
|
|
513
526
|
return binding
|
|
514
527
|
} catch (e) {
|
|
@@ -627,6 +640,7 @@ if (!nativeBinding || forceWasi) {
|
|
|
627
640
|
if (!candidateFailed) {
|
|
628
641
|
wasiBinding = require('./versatiles.wasi.cjs')
|
|
629
642
|
nativeBinding = wasiBinding
|
|
643
|
+
__napiLoadedBindingTarget = 'wasm32-wasi'
|
|
630
644
|
wasiBindingLoaded = true
|
|
631
645
|
}
|
|
632
646
|
} catch (err) {
|
|
@@ -647,12 +661,13 @@ if (!nativeBinding || forceWasi) {
|
|
|
647
661
|
if (!candidateFailed) {
|
|
648
662
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
649
663
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-wasm32-wasi/package.json').version
|
|
650
|
-
if (bindingPackageVersion !== '
|
|
651
|
-
throw new Error(`WASI binding package version mismatch, expected
|
|
664
|
+
if (bindingPackageVersion !== '5.0.0-rc.1') {
|
|
665
|
+
throw new Error(`WASI binding package version mismatch, expected 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
652
666
|
}
|
|
653
667
|
}
|
|
654
668
|
wasiBinding = require('@versatiles/versatiles-rs-wasm32-wasi')
|
|
655
669
|
nativeBinding = wasiBinding
|
|
670
|
+
__napiLoadedBindingTarget = 'wasm32-wasi'
|
|
656
671
|
wasiBindingLoaded = true
|
|
657
672
|
}
|
|
658
673
|
} catch (err) {
|
|
@@ -698,6 +713,70 @@ if (!nativeBinding) {
|
|
|
698
713
|
throw new Error(`Failed to load native binding`)
|
|
699
714
|
}
|
|
700
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)
|
|
701
780
|
module.exports = nativeBinding
|
|
702
781
|
module.exports.Progress = nativeBinding.Progress
|
|
703
782
|
module.exports.SourceType = nativeBinding.SourceType
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
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
|
+
|
|
4
12
|
/**
|
|
5
13
|
* Progress monitor for long-running operations
|
|
6
14
|
*
|
package/index.js
CHANGED
|
@@ -7,6 +7,10 @@ const require = createRequire(import.meta.url)
|
|
|
7
7
|
|
|
8
8
|
const { readFileSync } = require('fs')
|
|
9
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'
|
|
10
14
|
const loadErrors = []
|
|
11
15
|
|
|
12
16
|
const isMusl = () => {
|
|
@@ -65,7 +69,16 @@ const isMuslFromChildProcess = () => {
|
|
|
65
69
|
function requireNative() {
|
|
66
70
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
67
71
|
try {
|
|
68
|
-
|
|
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
|
|
69
82
|
} catch (err) {
|
|
70
83
|
loadErrors.push(err)
|
|
71
84
|
}
|
|
@@ -79,8 +92,8 @@ function requireNative() {
|
|
|
79
92
|
try {
|
|
80
93
|
const binding = require('@versatiles/versatiles-rs-android-arm64')
|
|
81
94
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm64/package.json').version
|
|
82
|
-
if (bindingPackageVersion !== '
|
|
83
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
95
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
84
97
|
}
|
|
85
98
|
return binding
|
|
86
99
|
} catch (e) {
|
|
@@ -95,8 +108,8 @@ function requireNative() {
|
|
|
95
108
|
try {
|
|
96
109
|
const binding = require('@versatiles/versatiles-rs-android-arm-eabi')
|
|
97
110
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm-eabi/package.json').version
|
|
98
|
-
if (bindingPackageVersion !== '
|
|
99
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
111
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
100
113
|
}
|
|
101
114
|
return binding
|
|
102
115
|
} catch (e) {
|
|
@@ -116,8 +129,8 @@ function requireNative() {
|
|
|
116
129
|
try {
|
|
117
130
|
const binding = require('@versatiles/versatiles-rs-win32-x64-gnu')
|
|
118
131
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-gnu/package.json').version
|
|
119
|
-
if (bindingPackageVersion !== '
|
|
120
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
132
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
121
134
|
}
|
|
122
135
|
return binding
|
|
123
136
|
} catch (e) {
|
|
@@ -132,8 +145,8 @@ function requireNative() {
|
|
|
132
145
|
try {
|
|
133
146
|
const binding = require('@versatiles/versatiles-rs-win32-x64-msvc')
|
|
134
147
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-msvc/package.json').version
|
|
135
|
-
if (bindingPackageVersion !== '
|
|
136
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
148
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
137
150
|
}
|
|
138
151
|
return binding
|
|
139
152
|
} catch (e) {
|
|
@@ -149,8 +162,8 @@ function requireNative() {
|
|
|
149
162
|
try {
|
|
150
163
|
const binding = require('@versatiles/versatiles-rs-win32-ia32-msvc')
|
|
151
164
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-ia32-msvc/package.json').version
|
|
152
|
-
if (bindingPackageVersion !== '
|
|
153
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
165
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
154
167
|
}
|
|
155
168
|
return binding
|
|
156
169
|
} catch (e) {
|
|
@@ -165,8 +178,8 @@ function requireNative() {
|
|
|
165
178
|
try {
|
|
166
179
|
const binding = require('@versatiles/versatiles-rs-win32-arm64-msvc')
|
|
167
180
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-arm64-msvc/package.json').version
|
|
168
|
-
if (bindingPackageVersion !== '
|
|
169
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
181
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
170
183
|
}
|
|
171
184
|
return binding
|
|
172
185
|
} catch (e) {
|
|
@@ -184,8 +197,8 @@ function requireNative() {
|
|
|
184
197
|
try {
|
|
185
198
|
const binding = require('@versatiles/versatiles-rs-darwin-universal')
|
|
186
199
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-universal/package.json').version
|
|
187
|
-
if (bindingPackageVersion !== '
|
|
188
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
200
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
189
202
|
}
|
|
190
203
|
return binding
|
|
191
204
|
} catch (e) {
|
|
@@ -200,8 +213,8 @@ function requireNative() {
|
|
|
200
213
|
try {
|
|
201
214
|
const binding = require('@versatiles/versatiles-rs-darwin-x64')
|
|
202
215
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-x64/package.json').version
|
|
203
|
-
if (bindingPackageVersion !== '
|
|
204
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
216
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
205
218
|
}
|
|
206
219
|
return binding
|
|
207
220
|
} catch (e) {
|
|
@@ -216,8 +229,8 @@ function requireNative() {
|
|
|
216
229
|
try {
|
|
217
230
|
const binding = require('@versatiles/versatiles-rs-darwin-arm64')
|
|
218
231
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-arm64/package.json').version
|
|
219
|
-
if (bindingPackageVersion !== '
|
|
220
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
232
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
221
234
|
}
|
|
222
235
|
return binding
|
|
223
236
|
} catch (e) {
|
|
@@ -236,8 +249,8 @@ function requireNative() {
|
|
|
236
249
|
try {
|
|
237
250
|
const binding = require('@versatiles/versatiles-rs-freebsd-x64')
|
|
238
251
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-x64/package.json').version
|
|
239
|
-
if (bindingPackageVersion !== '
|
|
240
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
252
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
241
254
|
}
|
|
242
255
|
return binding
|
|
243
256
|
} catch (e) {
|
|
@@ -252,8 +265,8 @@ function requireNative() {
|
|
|
252
265
|
try {
|
|
253
266
|
const binding = require('@versatiles/versatiles-rs-freebsd-arm64')
|
|
254
267
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-arm64/package.json').version
|
|
255
|
-
if (bindingPackageVersion !== '
|
|
256
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
268
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
257
270
|
}
|
|
258
271
|
return binding
|
|
259
272
|
} catch (e) {
|
|
@@ -273,8 +286,8 @@ function requireNative() {
|
|
|
273
286
|
try {
|
|
274
287
|
const binding = require('@versatiles/versatiles-rs-linux-x64-musl')
|
|
275
288
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-musl/package.json').version
|
|
276
|
-
if (bindingPackageVersion !== '
|
|
277
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
289
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
278
291
|
}
|
|
279
292
|
return binding
|
|
280
293
|
} catch (e) {
|
|
@@ -289,8 +302,8 @@ function requireNative() {
|
|
|
289
302
|
try {
|
|
290
303
|
const binding = require('@versatiles/versatiles-rs-linux-x64-gnu')
|
|
291
304
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-gnu/package.json').version
|
|
292
|
-
if (bindingPackageVersion !== '
|
|
293
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
305
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
294
307
|
}
|
|
295
308
|
return binding
|
|
296
309
|
} catch (e) {
|
|
@@ -307,8 +320,8 @@ function requireNative() {
|
|
|
307
320
|
try {
|
|
308
321
|
const binding = require('@versatiles/versatiles-rs-linux-arm64-musl')
|
|
309
322
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-musl/package.json').version
|
|
310
|
-
if (bindingPackageVersion !== '
|
|
311
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
323
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
312
325
|
}
|
|
313
326
|
return binding
|
|
314
327
|
} catch (e) {
|
|
@@ -323,8 +336,8 @@ function requireNative() {
|
|
|
323
336
|
try {
|
|
324
337
|
const binding = require('@versatiles/versatiles-rs-linux-arm64-gnu')
|
|
325
338
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-gnu/package.json').version
|
|
326
|
-
if (bindingPackageVersion !== '
|
|
327
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
339
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
328
341
|
}
|
|
329
342
|
return binding
|
|
330
343
|
} catch (e) {
|
|
@@ -341,8 +354,8 @@ function requireNative() {
|
|
|
341
354
|
try {
|
|
342
355
|
const binding = require('@versatiles/versatiles-rs-linux-arm-musleabihf')
|
|
343
356
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-musleabihf/package.json').version
|
|
344
|
-
if (bindingPackageVersion !== '
|
|
345
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
357
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
346
359
|
}
|
|
347
360
|
return binding
|
|
348
361
|
} catch (e) {
|
|
@@ -357,8 +370,8 @@ function requireNative() {
|
|
|
357
370
|
try {
|
|
358
371
|
const binding = require('@versatiles/versatiles-rs-linux-arm-gnueabihf')
|
|
359
372
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-gnueabihf/package.json').version
|
|
360
|
-
if (bindingPackageVersion !== '
|
|
361
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
373
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
362
375
|
}
|
|
363
376
|
return binding
|
|
364
377
|
} catch (e) {
|
|
@@ -375,8 +388,8 @@ function requireNative() {
|
|
|
375
388
|
try {
|
|
376
389
|
const binding = require('@versatiles/versatiles-rs-linux-loong64-musl')
|
|
377
390
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-musl/package.json').version
|
|
378
|
-
if (bindingPackageVersion !== '
|
|
379
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
391
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
380
393
|
}
|
|
381
394
|
return binding
|
|
382
395
|
} catch (e) {
|
|
@@ -391,8 +404,8 @@ function requireNative() {
|
|
|
391
404
|
try {
|
|
392
405
|
const binding = require('@versatiles/versatiles-rs-linux-loong64-gnu')
|
|
393
406
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-gnu/package.json').version
|
|
394
|
-
if (bindingPackageVersion !== '
|
|
395
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
407
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
396
409
|
}
|
|
397
410
|
return binding
|
|
398
411
|
} catch (e) {
|
|
@@ -409,8 +422,8 @@ function requireNative() {
|
|
|
409
422
|
try {
|
|
410
423
|
const binding = require('@versatiles/versatiles-rs-linux-riscv64-musl')
|
|
411
424
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-musl/package.json').version
|
|
412
|
-
if (bindingPackageVersion !== '
|
|
413
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
425
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
414
427
|
}
|
|
415
428
|
return binding
|
|
416
429
|
} catch (e) {
|
|
@@ -425,8 +438,8 @@ function requireNative() {
|
|
|
425
438
|
try {
|
|
426
439
|
const binding = require('@versatiles/versatiles-rs-linux-riscv64-gnu')
|
|
427
440
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-gnu/package.json').version
|
|
428
|
-
if (bindingPackageVersion !== '
|
|
429
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
441
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
430
443
|
}
|
|
431
444
|
return binding
|
|
432
445
|
} catch (e) {
|
|
@@ -442,8 +455,8 @@ function requireNative() {
|
|
|
442
455
|
try {
|
|
443
456
|
const binding = require('@versatiles/versatiles-rs-linux-ppc64-gnu')
|
|
444
457
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-ppc64-gnu/package.json').version
|
|
445
|
-
if (bindingPackageVersion !== '
|
|
446
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
458
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
447
460
|
}
|
|
448
461
|
return binding
|
|
449
462
|
} catch (e) {
|
|
@@ -458,8 +471,8 @@ function requireNative() {
|
|
|
458
471
|
try {
|
|
459
472
|
const binding = require('@versatiles/versatiles-rs-linux-s390x-gnu')
|
|
460
473
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-s390x-gnu/package.json').version
|
|
461
|
-
if (bindingPackageVersion !== '
|
|
462
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
474
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
463
476
|
}
|
|
464
477
|
return binding
|
|
465
478
|
} catch (e) {
|
|
@@ -478,8 +491,8 @@ function requireNative() {
|
|
|
478
491
|
try {
|
|
479
492
|
const binding = require('@versatiles/versatiles-rs-openharmony-arm64')
|
|
480
493
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm64/package.json').version
|
|
481
|
-
if (bindingPackageVersion !== '
|
|
482
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
494
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
483
496
|
}
|
|
484
497
|
return binding
|
|
485
498
|
} catch (e) {
|
|
@@ -494,8 +507,8 @@ function requireNative() {
|
|
|
494
507
|
try {
|
|
495
508
|
const binding = require('@versatiles/versatiles-rs-openharmony-x64')
|
|
496
509
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-x64/package.json').version
|
|
497
|
-
if (bindingPackageVersion !== '
|
|
498
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
510
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
499
512
|
}
|
|
500
513
|
return binding
|
|
501
514
|
} catch (e) {
|
|
@@ -510,8 +523,8 @@ function requireNative() {
|
|
|
510
523
|
try {
|
|
511
524
|
const binding = require('@versatiles/versatiles-rs-openharmony-arm')
|
|
512
525
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm/package.json').version
|
|
513
|
-
if (bindingPackageVersion !== '
|
|
514
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
526
|
+
if (bindingPackageVersion !== '5.0.0-rc.1' && 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 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
515
528
|
}
|
|
516
529
|
return binding
|
|
517
530
|
} catch (e) {
|
|
@@ -630,6 +643,7 @@ if (!nativeBinding || forceWasi) {
|
|
|
630
643
|
if (!candidateFailed) {
|
|
631
644
|
wasiBinding = require('./versatiles.wasi.cjs')
|
|
632
645
|
nativeBinding = wasiBinding
|
|
646
|
+
__napiLoadedBindingTarget = 'wasm32-wasi'
|
|
633
647
|
wasiBindingLoaded = true
|
|
634
648
|
}
|
|
635
649
|
} catch (err) {
|
|
@@ -650,12 +664,13 @@ if (!nativeBinding || forceWasi) {
|
|
|
650
664
|
if (!candidateFailed) {
|
|
651
665
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
652
666
|
const bindingPackageVersion = require('@versatiles/versatiles-rs-wasm32-wasi/package.json').version
|
|
653
|
-
if (bindingPackageVersion !== '
|
|
654
|
-
throw new Error(`WASI binding package version mismatch, expected
|
|
667
|
+
if (bindingPackageVersion !== '5.0.0-rc.1') {
|
|
668
|
+
throw new Error(`WASI binding package version mismatch, expected 5.0.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
655
669
|
}
|
|
656
670
|
}
|
|
657
671
|
wasiBinding = require('@versatiles/versatiles-rs-wasm32-wasi')
|
|
658
672
|
nativeBinding = wasiBinding
|
|
673
|
+
__napiLoadedBindingTarget = 'wasm32-wasi'
|
|
659
674
|
wasiBindingLoaded = true
|
|
660
675
|
}
|
|
661
676
|
} catch (err) {
|
|
@@ -716,3 +731,4 @@ export { parseVpl }
|
|
|
716
731
|
export { parseVplCst }
|
|
717
732
|
export { stringifyVpl }
|
|
718
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": "
|
|
3
|
+
"version": "5.0.0-rc.1",
|
|
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.
|
|
91
|
-
"@types/node": "^26.
|
|
92
|
-
"@vitest/ui": "^5.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.
|
|
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.
|
|
97
|
+
"prettier": "^3.9.8",
|
|
98
98
|
"tsx": "^4.23.13",
|
|
99
99
|
"typedoc": "^0.28.20",
|
|
100
100
|
"typescript": "^6.0.3",
|
|
101
101
|
"typescript-eslint": "^8.70.0",
|
|
102
|
-
"vitest": "^5.0.
|
|
102
|
+
"vitest": "^5.0.1"
|
|
103
103
|
},
|
|
104
104
|
"optionalDependencies": {
|
|
105
|
-
"@versatiles/versatiles-rs-darwin-arm64": "
|
|
106
|
-
"@versatiles/versatiles-rs-darwin-x64": "
|
|
107
|
-
"@versatiles/versatiles-rs-linux-arm64-gnu": "
|
|
108
|
-
"@versatiles/versatiles-rs-linux-arm64-musl": "
|
|
109
|
-
"@versatiles/versatiles-rs-linux-x64-gnu": "
|
|
110
|
-
"@versatiles/versatiles-rs-linux-x64-musl": "
|
|
111
|
-
"@versatiles/versatiles-rs-win32-arm64-msvc": "
|
|
112
|
-
"@versatiles/versatiles-rs-win32-x64-msvc": "
|
|
105
|
+
"@versatiles/versatiles-rs-darwin-arm64": "5.0.0-rc.1",
|
|
106
|
+
"@versatiles/versatiles-rs-darwin-x64": "5.0.0-rc.1",
|
|
107
|
+
"@versatiles/versatiles-rs-linux-arm64-gnu": "5.0.0-rc.1",
|
|
108
|
+
"@versatiles/versatiles-rs-linux-arm64-musl": "5.0.0-rc.1",
|
|
109
|
+
"@versatiles/versatiles-rs-linux-x64-gnu": "5.0.0-rc.1",
|
|
110
|
+
"@versatiles/versatiles-rs-linux-x64-musl": "5.0.0-rc.1",
|
|
111
|
+
"@versatiles/versatiles-rs-win32-arm64-msvc": "5.0.0-rc.1",
|
|
112
|
+
"@versatiles/versatiles-rs-win32-x64-msvc": "5.0.0-rc.1"
|
|
113
113
|
},
|
|
114
114
|
"allowScripts": {
|
|
115
115
|
"esbuild": true,
|
package/vpl.d.ts
CHANGED
|
@@ -406,7 +406,7 @@ export interface MetaUpdateOptions {
|
|
|
406
406
|
/** Name of the tileset. Defaults to the source's. */
|
|
407
407
|
name?: string;
|
|
408
408
|
/** What the tiles contain. Defaults to the source's. */
|
|
409
|
-
schema?: "rgb" | "rgba" | "dem/mapbox" | "dem/terrarium" | "dem/versatiles" | "openmaptiles" | "shortbread@1.0" | "other";
|
|
409
|
+
schema?: "rgb" | "rgba" | "dem/mapbox" | "dem/terrarium" | "dem/versatiles" | "openmaptiles" | "shortbread@1.0" | "shortbread@1.1" | "other";
|
|
410
410
|
/** Complete TileJSON document, as a JSON string. Defaults to the source's metadata. */
|
|
411
411
|
tilejson?: string;
|
|
412
412
|
/** Path to a file holding a complete TileJSON document. Defaults to the source's metadata. */
|
|
@@ -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 = {};
|