@versatiles/versatiles-rs 4.7.0 → 4.9.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.
Files changed (7) hide show
  1. package/README.md +149 -4
  2. package/index.cjs +60 -54
  3. package/index.d.ts +270 -18
  4. package/index.js +61 -55
  5. package/package.json +9 -9
  6. package/vpl.d.ts +173 -5
  7. package/vpl.js +104 -31
package/index.js CHANGED
@@ -81,8 +81,8 @@ function requireNative() {
81
81
  try {
82
82
  const binding = require('@versatiles/versatiles-rs-android-arm64')
83
83
  const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm64/package.json').version
84
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
84
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
86
86
  }
87
87
  return binding
88
88
  } catch (e) {
@@ -97,8 +97,8 @@ function requireNative() {
97
97
  try {
98
98
  const binding = require('@versatiles/versatiles-rs-android-arm-eabi')
99
99
  const bindingPackageVersion = require('@versatiles/versatiles-rs-android-arm-eabi/package.json').version
100
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
100
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
102
102
  }
103
103
  return binding
104
104
  } catch (e) {
@@ -118,8 +118,8 @@ function requireNative() {
118
118
  try {
119
119
  const binding = require('@versatiles/versatiles-rs-win32-x64-gnu')
120
120
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-gnu/package.json').version
121
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
122
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
122
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
123
123
  }
124
124
  return binding
125
125
  } catch (e) {
@@ -134,8 +134,8 @@ function requireNative() {
134
134
  try {
135
135
  const binding = require('@versatiles/versatiles-rs-win32-x64-msvc')
136
136
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-x64-msvc/package.json').version
137
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
138
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
138
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
139
139
  }
140
140
  return binding
141
141
  } catch (e) {
@@ -151,8 +151,8 @@ function requireNative() {
151
151
  try {
152
152
  const binding = require('@versatiles/versatiles-rs-win32-ia32-msvc')
153
153
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-ia32-msvc/package.json').version
154
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
155
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
154
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
155
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
156
156
  }
157
157
  return binding
158
158
  } catch (e) {
@@ -167,8 +167,8 @@ function requireNative() {
167
167
  try {
168
168
  const binding = require('@versatiles/versatiles-rs-win32-arm64-msvc')
169
169
  const bindingPackageVersion = require('@versatiles/versatiles-rs-win32-arm64-msvc/package.json').version
170
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
170
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
172
  }
173
173
  return binding
174
174
  } catch (e) {
@@ -186,8 +186,8 @@ function requireNative() {
186
186
  try {
187
187
  const binding = require('@versatiles/versatiles-rs-darwin-universal')
188
188
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-universal/package.json').version
189
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
190
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
189
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
190
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
191
191
  }
192
192
  return binding
193
193
  } catch (e) {
@@ -202,8 +202,8 @@ function requireNative() {
202
202
  try {
203
203
  const binding = require('@versatiles/versatiles-rs-darwin-x64')
204
204
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-x64/package.json').version
205
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
206
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
205
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
206
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
207
207
  }
208
208
  return binding
209
209
  } catch (e) {
@@ -218,8 +218,8 @@ function requireNative() {
218
218
  try {
219
219
  const binding = require('@versatiles/versatiles-rs-darwin-arm64')
220
220
  const bindingPackageVersion = require('@versatiles/versatiles-rs-darwin-arm64/package.json').version
221
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
222
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
221
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
222
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
223
  }
224
224
  return binding
225
225
  } catch (e) {
@@ -238,8 +238,8 @@ function requireNative() {
238
238
  try {
239
239
  const binding = require('@versatiles/versatiles-rs-freebsd-x64')
240
240
  const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-x64/package.json').version
241
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
241
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
243
243
  }
244
244
  return binding
245
245
  } catch (e) {
@@ -254,8 +254,8 @@ function requireNative() {
254
254
  try {
255
255
  const binding = require('@versatiles/versatiles-rs-freebsd-arm64')
256
256
  const bindingPackageVersion = require('@versatiles/versatiles-rs-freebsd-arm64/package.json').version
257
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
258
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
257
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
258
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
259
259
  }
260
260
  return binding
261
261
  } catch (e) {
@@ -275,8 +275,8 @@ function requireNative() {
275
275
  try {
276
276
  const binding = require('@versatiles/versatiles-rs-linux-x64-musl')
277
277
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-musl/package.json').version
278
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
279
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
278
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
279
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
280
280
  }
281
281
  return binding
282
282
  } catch (e) {
@@ -291,8 +291,8 @@ function requireNative() {
291
291
  try {
292
292
  const binding = require('@versatiles/versatiles-rs-linux-x64-gnu')
293
293
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-x64-gnu/package.json').version
294
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
294
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
296
296
  }
297
297
  return binding
298
298
  } catch (e) {
@@ -309,8 +309,8 @@ function requireNative() {
309
309
  try {
310
310
  const binding = require('@versatiles/versatiles-rs-linux-arm64-musl')
311
311
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-musl/package.json').version
312
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
313
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
312
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
313
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
314
314
  }
315
315
  return binding
316
316
  } catch (e) {
@@ -325,8 +325,8 @@ function requireNative() {
325
325
  try {
326
326
  const binding = require('@versatiles/versatiles-rs-linux-arm64-gnu')
327
327
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm64-gnu/package.json').version
328
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
328
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
330
330
  }
331
331
  return binding
332
332
  } catch (e) {
@@ -343,8 +343,8 @@ function requireNative() {
343
343
  try {
344
344
  const binding = require('@versatiles/versatiles-rs-linux-arm-musleabihf')
345
345
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-musleabihf/package.json').version
346
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
347
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
346
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
347
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
348
348
  }
349
349
  return binding
350
350
  } catch (e) {
@@ -359,8 +359,8 @@ function requireNative() {
359
359
  try {
360
360
  const binding = require('@versatiles/versatiles-rs-linux-arm-gnueabihf')
361
361
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-arm-gnueabihf/package.json').version
362
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
362
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
364
364
  }
365
365
  return binding
366
366
  } catch (e) {
@@ -377,8 +377,8 @@ function requireNative() {
377
377
  try {
378
378
  const binding = require('@versatiles/versatiles-rs-linux-loong64-musl')
379
379
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-musl/package.json').version
380
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
381
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
380
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
381
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
382
382
  }
383
383
  return binding
384
384
  } catch (e) {
@@ -393,8 +393,8 @@ function requireNative() {
393
393
  try {
394
394
  const binding = require('@versatiles/versatiles-rs-linux-loong64-gnu')
395
395
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-loong64-gnu/package.json').version
396
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
397
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
396
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
397
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
398
398
  }
399
399
  return binding
400
400
  } catch (e) {
@@ -411,8 +411,8 @@ function requireNative() {
411
411
  try {
412
412
  const binding = require('@versatiles/versatiles-rs-linux-riscv64-musl')
413
413
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-musl/package.json').version
414
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
415
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
414
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
415
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
416
416
  }
417
417
  return binding
418
418
  } catch (e) {
@@ -427,8 +427,8 @@ function requireNative() {
427
427
  try {
428
428
  const binding = require('@versatiles/versatiles-rs-linux-riscv64-gnu')
429
429
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-riscv64-gnu/package.json').version
430
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
430
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
432
432
  }
433
433
  return binding
434
434
  } catch (e) {
@@ -444,8 +444,8 @@ function requireNative() {
444
444
  try {
445
445
  const binding = require('@versatiles/versatiles-rs-linux-ppc64-gnu')
446
446
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-ppc64-gnu/package.json').version
447
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
447
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
449
449
  }
450
450
  return binding
451
451
  } catch (e) {
@@ -460,8 +460,8 @@ function requireNative() {
460
460
  try {
461
461
  const binding = require('@versatiles/versatiles-rs-linux-s390x-gnu')
462
462
  const bindingPackageVersion = require('@versatiles/versatiles-rs-linux-s390x-gnu/package.json').version
463
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
463
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
465
  }
466
466
  return binding
467
467
  } catch (e) {
@@ -480,8 +480,8 @@ function requireNative() {
480
480
  try {
481
481
  const binding = require('@versatiles/versatiles-rs-openharmony-arm64')
482
482
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm64/package.json').version
483
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
484
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
483
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
484
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
485
485
  }
486
486
  return binding
487
487
  } catch (e) {
@@ -496,8 +496,8 @@ function requireNative() {
496
496
  try {
497
497
  const binding = require('@versatiles/versatiles-rs-openharmony-x64')
498
498
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-x64/package.json').version
499
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
500
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
499
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
500
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
501
501
  }
502
502
  return binding
503
503
  } catch (e) {
@@ -512,8 +512,8 @@ function requireNative() {
512
512
  try {
513
513
  const binding = require('@versatiles/versatiles-rs-openharmony-arm')
514
514
  const bindingPackageVersion = require('@versatiles/versatiles-rs-openharmony-arm/package.json').version
515
- if (bindingPackageVersion !== '4.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
516
- throw new Error(`Native binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
515
+ if (bindingPackageVersion !== '4.9.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
516
+ throw new Error(`Native binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
517
517
  }
518
518
  return binding
519
519
  } catch (e) {
@@ -652,8 +652,8 @@ if (!nativeBinding || forceWasi) {
652
652
  if (!candidateFailed) {
653
653
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
654
654
  const bindingPackageVersion = require('@versatiles/versatiles-rs-wasm32-wasi/package.json').version
655
- if (bindingPackageVersion !== '4.7.0') {
656
- throw new Error(`WASI binding package version mismatch, expected 4.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
655
+ if (bindingPackageVersion !== '4.9.0') {
656
+ throw new Error(`WASI binding package version mismatch, expected 4.9.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
657
657
  }
658
658
  }
659
659
  wasiBinding = require('@versatiles/versatiles-rs-wasm32-wasi')
@@ -703,11 +703,17 @@ if (!nativeBinding) {
703
703
  throw new Error(`Failed to load native binding`)
704
704
  }
705
705
 
706
- const { Progress, SourceType, TileCoord, TileServer, TileSource, convert, generateVplTypescript } = nativeBinding
706
+ const { Progress, SourceType, TileCoord, TileServer, TileSource, checkVpl, convert, generateVplTypescript, layerStats, parseVpl, parseVplCst, stringifyVpl, stringifyVplCst } = nativeBinding
707
707
  export { Progress }
708
708
  export { SourceType }
709
709
  export { TileCoord }
710
710
  export { TileServer }
711
711
  export { TileSource }
712
+ export { checkVpl }
712
713
  export { convert }
713
714
  export { generateVplTypescript }
715
+ export { layerStats }
716
+ export { parseVpl }
717
+ export { parseVplCst }
718
+ export { stringifyVpl }
719
+ export { stringifyVplCst }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versatiles/versatiles-rs",
3
- "version": "4.7.0",
3
+ "version": "4.9.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",
@@ -102,14 +102,14 @@
102
102
  "vitest": "^4.1.10"
103
103
  },
104
104
  "optionalDependencies": {
105
- "@versatiles/versatiles-rs-darwin-arm64": "4.7.0",
106
- "@versatiles/versatiles-rs-darwin-x64": "4.7.0",
107
- "@versatiles/versatiles-rs-linux-arm64-gnu": "4.7.0",
108
- "@versatiles/versatiles-rs-linux-arm64-musl": "4.7.0",
109
- "@versatiles/versatiles-rs-linux-x64-gnu": "4.7.0",
110
- "@versatiles/versatiles-rs-linux-x64-musl": "4.7.0",
111
- "@versatiles/versatiles-rs-win32-arm64-msvc": "4.7.0",
112
- "@versatiles/versatiles-rs-win32-x64-msvc": "4.7.0"
105
+ "@versatiles/versatiles-rs-darwin-arm64": "4.9.0",
106
+ "@versatiles/versatiles-rs-darwin-x64": "4.9.0",
107
+ "@versatiles/versatiles-rs-linux-arm64-gnu": "4.9.0",
108
+ "@versatiles/versatiles-rs-linux-arm64-musl": "4.9.0",
109
+ "@versatiles/versatiles-rs-linux-x64-gnu": "4.9.0",
110
+ "@versatiles/versatiles-rs-linux-x64-musl": "4.9.0",
111
+ "@versatiles/versatiles-rs-win32-arm64-msvc": "4.9.0",
112
+ "@versatiles/versatiles-rs-win32-x64-msvc": "4.9.0"
113
113
  },
114
114
  "allowScripts": {
115
115
  "esbuild": true,
package/vpl.d.ts CHANGED
@@ -1,4 +1,105 @@
1
1
  import { TileSource } from './index.js';
2
+ /** A pipeline step in the JSON form the native bindings exchange. */
3
+ export interface VplStep {
4
+ name: string;
5
+ params: Record<string, unknown>;
6
+ sources?: VplStep[][];
7
+ }
8
+ /** A VPL syntax error. `span` and `offset` are **byte** offsets into the parsed text. */
9
+ export interface VplSyntaxError {
10
+ span: {
11
+ start: number;
12
+ end: number;
13
+ };
14
+ message: string;
15
+ context: {
16
+ label: string;
17
+ offset: number;
18
+ }[];
19
+ /** The caret-annotated rendering, as printed by the CLI. */
20
+ trace: string;
21
+ }
22
+ /**
23
+ * A stretch of source text, with the whitespace and comments immediately before it.
24
+ *
25
+ * `span` holds **byte** offsets into the text this was parsed from, and covers `text`
26
+ * only. It is absent for tokens you build yourself, and stale after an edit.
27
+ */
28
+ export interface CstToken {
29
+ leading?: string;
30
+ text: string;
31
+ span?: {
32
+ start: number;
33
+ end: number;
34
+ };
35
+ }
36
+ /** An element of a separated list. The first element has no separator. */
37
+ export interface CstItem<T> {
38
+ separator?: CstToken;
39
+ value: T;
40
+ }
41
+ /** How a value was spelled: unquoted, `'single'`, or `\"double\"`. */
42
+ export type CstQuote = 'bare' | 'single' | 'double';
43
+ /** A value, keeping its quotes and escapes exactly as written. */
44
+ export interface CstString {
45
+ token: CstToken;
46
+ quote: CstQuote;
47
+ }
48
+ /** The right-hand side of a parameter: one value, or a bracketed list. */
49
+ export type CstValue = ({
50
+ kind: 'single';
51
+ } & CstString) | {
52
+ kind: 'array';
53
+ open: CstToken;
54
+ items: CstItem<CstString>[];
55
+ close: CstToken;
56
+ };
57
+ /** A single `key=value` parameter. */
58
+ export interface CstProperty {
59
+ key: CstToken;
60
+ equals: CstToken;
61
+ value: CstValue;
62
+ }
63
+ /** A bracketed list of child pipelines. */
64
+ export interface CstSources {
65
+ open: CstToken;
66
+ pipelines: CstItem<CstPipeline>[];
67
+ close: CstToken;
68
+ }
69
+ /** One operation, with its parameters in the order they were written. */
70
+ export interface CstNode {
71
+ name: CstToken;
72
+ properties?: CstProperty[];
73
+ sources?: CstSources;
74
+ }
75
+ /** Nodes separated by `|`. */
76
+ export interface CstPipeline {
77
+ nodes: CstItem<CstNode>[];
78
+ }
79
+ /**
80
+ * A whole VPL file, losslessly.
81
+ *
82
+ * Printing an unedited tree reproduces the source byte for byte — comments, indentation,
83
+ * parameter order and quote style included — so editing one value leaves the rest of a
84
+ * hand-written file untouched.
85
+ */
86
+ export interface CstFile {
87
+ pipeline: CstPipeline;
88
+ trailing?: string;
89
+ }
90
+ type CstParseResult = {
91
+ ok: true;
92
+ cst: CstFile;
93
+ } | {
94
+ ok: false;
95
+ error: VplSyntaxError;
96
+ };
97
+ /** Parse VPL text into a lossless syntax tree, returning the error rather than throwing. */
98
+ export declare function parseCstResult(vpl: string): CstParseResult;
99
+ /** Parse VPL text into a lossless syntax tree, throwing on a syntax error. */
100
+ export declare function parseCst(vpl: string): CstFile;
101
+ /** Write a lossless syntax tree back out as VPL text. */
102
+ export declare function stringifyCst(cst: CstFile): string;
2
103
  export interface FromColorOptions {
3
104
  /** Hex color in RGB or RGBA format (e.g., "FF5733" or "FF573380"). Defaults to "000000" (black). */
4
105
  color?: string;
@@ -8,8 +109,10 @@ export interface FromColorOptions {
8
109
  format?: "avif" | "bin" | "geojson" | "jpg" | "json" | "mvt" | "png" | "svg" | "topojson" | "webp";
9
110
  }
10
111
  export interface FromContainerOptions {
11
- /** The filename of the tile container (relative to the VPL file path), or a URL (http/https). For example: `filename="world.versatiles"` or `filename="https://example.com/world.versatiles"`. */
112
+ /** The filename of the tile container (relative to the VPL file path), or a URL (`http`, `https`, or `sftp`). For example: `filename="world.versatiles"` or `filename="https://example.com/world.versatiles"`. See `versatiles help source` for URL and authentication details. */
12
113
  filename: string;
114
+ /** The private key file to authenticate this `sftp://` source with, for example `ssh_identity="/home/deploy/.ssh/id_ed25519"`. A relative path resolves against the VPL file, like `filename`. It applies to this source alone and overrides `--ssh-identity` and `VERSATILES_SSH_IDENTITY`, which apply to every source — so one pipeline can read from two SFTP hosts that need different keys. Ignored for other schemes. Note that naming a key makes the VPL file specific to machines that have it. */
115
+ sshIdentity?: string;
13
116
  }
14
117
  export interface FromCsvOptions {
15
118
  /** Filename of the CSV file (relative to the VPL file path). */
@@ -83,6 +186,48 @@ export interface FromGeoOptions {
83
186
  /** If `true`, drop the GeoJSON / Shapefile `id` field from every feature before encoding. Useful for sources where the id is a string (e.g. USGS earthquakes — those would be silently dropped at MVT encode anyway, since MVT requires `uint64` ids), or when the id is just noise. Defaults to `false` — keep the id when it's a non-negative integer. */
84
187
  ignoreId?: boolean;
85
188
  }
189
+ export interface FromGridOptions {
190
+ /** EPSG code of the grid's coordinate reference system. Without GDAL: `3035` (ETRS89-LAEA, what European gridded statistics use), `3857` (web mercator) and `4326` (WGS84 lon/lat). */
191
+ epsg: number;
192
+ /** Edge length of a cell, in the CRS's own units — meters for a projected CRS, degrees for `epsg=4326`. For example: `size=1000` for the 1 km grid Eurostat publishes. */
193
+ size: number;
194
+ /** The area to cover, as `[west, south, east, north]` in WGS84 degrees. Required: an unbounded grid has no pyramid to derive, and at most cell sizes it is more tiles than can be written. */
195
+ bbox: [number, number, number, number];
196
+ /** Where the cell with index `(0, 0)` has its lower-left corner, in CRS units. Default: `[0,0]`, which is what published grids align to. */
197
+ offset?: unknown;
198
+ /** Roughly how many cells one tile may hold. Decides the lowest zoom level this source offers. Default: `1024`. */
199
+ maxCellsPerTile?: number;
200
+ /** Highest zoom level to generate. Defaults to three levels above the derived minimum, since further levels repeat the same cells. */
201
+ maxZoom?: number;
202
+ /** Ready-made id format. Either `"inspire"` (default), which produces `CRS3035RES1000mN2691000E4341000`, or `"geostat"`, which produces `1kmN2689E4337`. */
203
+ idPreset?: string;
204
+ /** Id format spelled out, for a grid whose publisher uses neither preset. `{x}` and `{y}` are the lower-left corner, each taking an optional divisor and zero-padded width: `E{x/100:04}N{y/100:04}` produces `E0643N4567`, the form Dutch grid statistics use. Overrides `id_preset`. */
205
+ idTemplate?: string;
206
+ /** Name of the string property holding the cell id. Default: `"id"`. */
207
+ idField?: string;
208
+ /** Names of the number properties holding the lower-left corner. Defaults: `"x"` and `"y"`, mirroring the `X_LLC` / `Y_LLC` columns Eurostat ships beside its ids. */
209
+ xField?: string;
210
+ /** See `x_field`. */
211
+ yField?: string;
212
+ /** How far a cell edge may stray from its true curve, in tile pixels. Only matters for a CRS whose straight lines bend in mercator; in `3857` and `4326` no vertices are added whatever this says. Default: `0.5`. */
213
+ densifyTolerance?: number;
214
+ /** Name of the layer in the generated tiles. Default: `"grid"`. */
215
+ layerName?: string;
216
+ }
217
+ export interface FromH3Options {
218
+ /** H3 resolution, `0` (cells of ~4,250,000 km²) to `15` (~0.9 m²). For example: `resolution=8` for cells of roughly 0.7 km². See <https://h3geo.org/docs/core-library/restable/> for the full table. */
219
+ resolution: number;
220
+ /** The area to cover, as `[west, south, east, north]` in WGS84 degrees. For example: `bbox=[13.0,52.3,13.8,52.7]` for Berlin. Required: a grid without bounds would be generated for the whole planet, which at most resolutions is more tiles than can be written. */
221
+ bbox: [number, number, number, number];
222
+ /** Roughly how many cells one tile may hold. Decides the lowest zoom level this source offers: below it a single tile would carry more cells than a tile can usefully hold. Default: `1024`. */
223
+ maxCellsPerTile?: number;
224
+ /** Highest zoom level to generate. Defaults to three levels above the derived minimum, since further levels repeat the same cells. */
225
+ maxZoom?: number;
226
+ /** Name of the layer in the generated tiles. Default: `"grid"`. */
227
+ layerName?: string;
228
+ /** Name of the string property holding the H3 index, e.g. `"8928308280fffff"`. Default: `"h3"`, matching how H3 datasets usually name the column. */
229
+ idField?: string;
230
+ }
86
231
  export interface FromStackedRasterOptions {
87
232
  /** The tile format to use for the output tiles. Default: format of the first source. */
88
233
  format?: "avif" | "bin" | "geojson" | "jpg" | "json" | "mvt" | "png" | "svg" | "topojson" | "webp";
@@ -104,6 +249,8 @@ export interface FromTilejsonOptions {
104
249
  export interface FilterOptions {
105
250
  /** Bounding box in WGS84: [min lng, min lat, max lng, max lat]. */
106
251
  bbox?: [number, number, number, number];
252
+ /** Ring of extra tiles to keep around `bbox`, in tiles per zoom level. Note that this is the one parameter here that *widens*: every other parameter narrows the tile set, but `bbox_border=2` keeps tiles the bbox alone would have dropped. Those tiles lie outside the crop, so the advertised bounds are extended to cover them and a client actually requests them. This matters wherever a cropped tileset is rendered rather than just stored: without a border, labels and geometry near the edge have no neighbouring tiles to be laid out against. Requires `bbox`; setting it alone is an error rather than a no-op. */
253
+ bboxBorder?: number;
107
254
  /** minimal zoom level */
108
255
  levelMin?: number;
109
256
  /** maximal zoom level */
@@ -141,6 +288,14 @@ export interface MetaUpdateOptions {
141
288
  /** Path to a file containing the `vector_layers` array as JSON, resolved relative to the VPL file. Use instead of `vector_layers`. Mutually exclusive with `vector_layers`. */
142
289
  vectorLayersFile?: string;
143
290
  }
291
+ export interface RemapCoordsOptions {
292
+ /** Mirror horizontally within each zoom level: `x` becomes `2^z - 1 - x`. No tile scheme uses this on its own; it is what makes the rotations reachable. Defaults to `false`. */
293
+ flipX?: boolean;
294
+ /** Mirror vertically within each zoom level: `y` becomes `2^z - 1 - y`. This is the TMS ↔ XYZ correction. Defaults to `false`. */
295
+ flipY?: boolean;
296
+ /** Exchange the axes: `(x, y)` becomes `(y, x)`, for sources laid out as `z/y/x`. Applied after the flips. Defaults to `false`. */
297
+ swapXy?: boolean;
298
+ }
144
299
  export interface DemOverviewOptions {
145
300
  /** Use this zoom level to build the overview. Defaults to the maximum zoom level of the source. */
146
301
  level?: number;
@@ -274,7 +429,11 @@ export declare class VPL {
274
429
  static fromDebug(options?: FromDebugOptions): VPL;
275
430
  /** Reads a GeoJSON or Shapefile and emits MVT vector tiles. */
276
431
  static fromGeo(options: FromGeoOptions): VPL;
277
- /** Merges multiple vector tile sources. */
432
+ /** Generates vector tiles containing the cells of a projected square grid, ready to be joined with data keyed on the cell id. */
433
+ static fromGrid(options: FromGridOptions): VPL;
434
+ /** Generates vector tiles containing H3 grid cells, ready to be joined with data keyed on the H3 index. */
435
+ static fromH3(options: FromH3Options): VPL;
436
+ /** Merges multiple vector tile sources. Each resulting tile will contain all the features and properties from all the sources. */
278
437
  static fromMergedVector(sources: VPL[]): VPL;
279
438
  /** Overlays multiple raster tile sources on top of each other. */
280
439
  static fromStackedRaster(sources: VPL[], options?: Omit<FromStackedRasterOptions, 'sources'>): VPL;
@@ -282,12 +441,14 @@ export declare class VPL {
282
441
  static fromStacked(sources: VPL[]): VPL;
283
442
  /** Reads a single tile file and uses it as a template for all tile requests. */
284
443
  static fromTile(options: FromTileOptions): VPL;
285
- /** Reads tiles from a remote tile server via a TileJSON endpoint. */
444
+ /** Reads tiles from a remote tile server via a TileJSON endpoint. The TileJSON is fetched from the given URL, and tiles are loaded individually using the URL template from the TileJSON `tiles` array. */
286
445
  static fromTilejson(options: FromTilejsonOptions): VPL;
287
446
  /** Filter tiles by bounding box, zoom levels, and/or the tile coordinates present in another container. */
288
447
  filter(options?: FilterOptions): VPL;
289
448
  /** Update metadata, see also <https://github.com/mapbox/tilejson-spec/tree/master/3.0.0> */
290
449
  metaUpdate(options?: MetaUpdateOptions): VPL;
450
+ /** Relabels tile coordinates, e.g. to correct a source that uses TMS row order or `z/y/x` paths. */
451
+ remapCoords(options?: RemapCoordsOptions): VPL;
291
452
  /** Generate lower-zoom DEM overview tiles by averaging 24-bit elevation values. */
292
453
  demOverview(options?: DemOverviewOptions): VPL;
293
454
  /** Quantize DEM (elevation) raster tiles by rounding to a per-tile power-of-two step. */
@@ -300,7 +461,7 @@ export declare class VPL {
300
461
  rasterFormat(options?: RasterFormatOptions): VPL;
301
462
  /** Adjust brightness, contrast and gamma of raster tiles. */
302
463
  rasterLevels(options?: RasterLevelsOptions): VPL;
303
- /** Apply a polygon mask from GeoJSON to raster tiles. */
464
+ /** Apply a polygon mask from GeoJSON to raster tiles. Pixels outside the polygon become transparent. */
304
465
  rasterMask(options: RasterMaskOptions): VPL;
305
466
  /** Raster overscale operation - generates tiles beyond the source's native resolution. */
306
467
  rasterOverscale(options?: RasterOverscaleOptions): VPL;
@@ -308,7 +469,7 @@ export declare class VPL {
308
469
  rasterOverview(options?: RasterOverviewOptions): VPL;
309
470
  /** Convert the size of tiles by splitting or merging them to a width of 256px or 512px. */
310
471
  rasterTileResize(options?: RasterTileResizeOptions): VPL;
311
- /** Drops vector features in selected layers that do not satisfy a boolean CEL expression. */
472
+ /** Drops vector features in selected layers that do not satisfy a boolean CEL expression. Features in layers outside `layer` pass through untouched. */
312
473
  vectorFilterFeatures(options: VectorFilterFeaturesOptions): VPL;
313
474
  /** Filters vector tile layers by name. */
314
475
  vectorFilterLayers(options: VectorFilterLayersOptions): VPL;
@@ -324,6 +485,13 @@ export declare class VPL {
324
485
  toString(): string;
325
486
  /** Convert this VPL pipeline to a JSON-serializable array of steps. */
326
487
  toJSON(): object[];
488
+ /** A syntax error, with byte offsets into the parsed text. */
489
+ static parseError(vpl: string): VplSyntaxError | undefined;
490
+ /** Rebuild a pipeline from the JSON form, nesting child pipelines as VPL. */
491
+ static fromJSON(steps: VplStep[]): VPL;
492
+ /** Parse VPL text, throwing on a syntax error. */
493
+ static parse(vpl: string): VPL;
327
494
  /** Execute this VPL pipeline and return a TileSource. */
328
495
  fromPath(dir?: string): Promise<TileSource>;
329
496
  }
497
+ export {};