@cratestack/cbor-node 0.11.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/native.d.mts CHANGED
@@ -1,5 +1,14 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+
4
+ /**
5
+ * Which binding artifact the generated loader actually loaded: `'native'` for
6
+ * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
7
+ * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
8
+ * can point the loader at a WASI artifact this package does not build itself.
9
+ */
10
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
11
+
3
12
  /**
4
13
  * `"application/cbor"`, mirrored from `CborCodec::CONTENT_TYPE`.
5
14
  * Exposed as a function (rather than duplicating the literal on the
package/native.mjs CHANGED
@@ -1,14 +1,16 @@
1
- // prettier-ignore
2
1
  /* eslint-disable */
3
2
  // @ts-nocheck
4
3
  /* auto-generated by NAPI-RS */
5
4
 
6
5
  import { createRequire } from 'module'
7
6
  const require = createRequire(import.meta.url)
8
- const __dirname = new URL('.', import.meta.url).pathname
9
7
 
10
8
  const { readFileSync } = require('fs')
11
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'
12
14
  const loadErrors = []
13
15
 
14
16
  const isMusl = () => {
@@ -67,7 +69,16 @@ const isMuslFromChildProcess = () => {
67
69
  function requireNative() {
68
70
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
69
71
  try {
70
- return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
72
+ const overrideBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
73
+ // The override may be a generated WASI loader, which already reports its
74
+ // own flavor. Adopt it: `module.exports` aliases this object, so claiming
75
+ // 'native' would both misreport the artifact and overwrite the loader's
76
+ // marker through the alias.
77
+ __napiLoadedBindingTarget =
78
+ overrideBinding && typeof overrideBinding.__napiBindingTarget === 'string'
79
+ ? overrideBinding.__napiBindingTarget
80
+ : 'native'
81
+ return overrideBinding
71
82
  } catch (err) {
72
83
  loadErrors.push(err)
73
84
  }
@@ -81,8 +92,8 @@ function requireNative() {
81
92
  try {
82
93
  const binding = require('@cratestack/cbor-node-android-arm64')
83
94
  const bindingPackageVersion = require('@cratestack/cbor-node-android-arm64/package.json').version
84
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
95
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
96
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
86
97
  }
87
98
  return binding
88
99
  } catch (e) {
@@ -97,8 +108,8 @@ function requireNative() {
97
108
  try {
98
109
  const binding = require('@cratestack/cbor-node-android-arm-eabi')
99
110
  const bindingPackageVersion = require('@cratestack/cbor-node-android-arm-eabi/package.json').version
100
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
111
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
112
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
102
113
  }
103
114
  return binding
104
115
  } catch (e) {
@@ -111,36 +122,36 @@ function requireNative() {
111
122
  if (process.arch === 'x64') {
112
123
  if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
113
124
  try {
114
- return require('./cratestack-cbor-node.win32-x64-gnu.node')
115
- } catch (e) {
116
- loadErrors.push(e)
117
- }
118
- try {
119
- const binding = require('@cratestack/cbor-node-win32-x64-gnu')
120
- const bindingPackageVersion = require('@cratestack/cbor-node-win32-x64-gnu/package.json').version
121
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
125
+ return require('./cratestack-cbor-node.win32-x64-gnu.node')
126
+ } catch (e) {
127
+ loadErrors.push(e)
128
+ }
129
+ try {
130
+ const binding = require('@cratestack/cbor-node-win32-x64-gnu')
131
+ const bindingPackageVersion = require('@cratestack/cbor-node-win32-x64-gnu/package.json').version
132
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
133
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
134
+ }
135
+ return binding
136
+ } catch (e) {
137
+ loadErrors.push(e)
123
138
  }
124
- return binding
125
- } catch (e) {
126
- loadErrors.push(e)
127
- }
128
139
  } else {
129
140
  try {
130
- return require('./cratestack-cbor-node.win32-x64-msvc.node')
131
- } catch (e) {
132
- loadErrors.push(e)
133
- }
134
- try {
135
- const binding = require('@cratestack/cbor-node-win32-x64-msvc')
136
- const bindingPackageVersion = require('@cratestack/cbor-node-win32-x64-msvc/package.json').version
137
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
141
+ return require('./cratestack-cbor-node.win32-x64-msvc.node')
142
+ } catch (e) {
143
+ loadErrors.push(e)
144
+ }
145
+ try {
146
+ const binding = require('@cratestack/cbor-node-win32-x64-msvc')
147
+ const bindingPackageVersion = require('@cratestack/cbor-node-win32-x64-msvc/package.json').version
148
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
149
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ }
151
+ return binding
152
+ } catch (e) {
153
+ loadErrors.push(e)
139
154
  }
140
- return binding
141
- } catch (e) {
142
- loadErrors.push(e)
143
- }
144
155
  }
145
156
  } else if (process.arch === 'ia32') {
146
157
  try {
@@ -151,8 +162,8 @@ function requireNative() {
151
162
  try {
152
163
  const binding = require('@cratestack/cbor-node-win32-ia32-msvc')
153
164
  const bindingPackageVersion = require('@cratestack/cbor-node-win32-ia32-msvc/package.json').version
154
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
165
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
166
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
156
167
  }
157
168
  return binding
158
169
  } catch (e) {
@@ -167,8 +178,8 @@ function requireNative() {
167
178
  try {
168
179
  const binding = require('@cratestack/cbor-node-win32-arm64-msvc')
169
180
  const bindingPackageVersion = require('@cratestack/cbor-node-win32-arm64-msvc/package.json').version
170
- if (bindingPackageVersion !== '0.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
- throw new Error(`Native binding package version mismatch, expected 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
181
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
182
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
183
  }
173
184
  return binding
174
185
  } catch (e) {
@@ -186,8 +197,8 @@ function requireNative() {
186
197
  try {
187
198
  const binding = require('@cratestack/cbor-node-darwin-universal')
188
199
  const bindingPackageVersion = require('@cratestack/cbor-node-darwin-universal/package.json').version
189
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
200
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
201
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
191
202
  }
192
203
  return binding
193
204
  } catch (e) {
@@ -202,8 +213,8 @@ function requireNative() {
202
213
  try {
203
214
  const binding = require('@cratestack/cbor-node-darwin-x64')
204
215
  const bindingPackageVersion = require('@cratestack/cbor-node-darwin-x64/package.json').version
205
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
216
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
217
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
207
218
  }
208
219
  return binding
209
220
  } catch (e) {
@@ -218,8 +229,8 @@ function requireNative() {
218
229
  try {
219
230
  const binding = require('@cratestack/cbor-node-darwin-arm64')
220
231
  const bindingPackageVersion = require('@cratestack/cbor-node-darwin-arm64/package.json').version
221
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
232
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
233
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
234
  }
224
235
  return binding
225
236
  } catch (e) {
@@ -238,8 +249,8 @@ function requireNative() {
238
249
  try {
239
250
  const binding = require('@cratestack/cbor-node-freebsd-x64')
240
251
  const bindingPackageVersion = require('@cratestack/cbor-node-freebsd-x64/package.json').version
241
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
252
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
253
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
243
254
  }
244
255
  return binding
245
256
  } catch (e) {
@@ -254,8 +265,8 @@ function requireNative() {
254
265
  try {
255
266
  const binding = require('@cratestack/cbor-node-freebsd-arm64')
256
267
  const bindingPackageVersion = require('@cratestack/cbor-node-freebsd-arm64/package.json').version
257
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
268
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
269
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
259
270
  }
260
271
  return binding
261
272
  } catch (e) {
@@ -275,8 +286,8 @@ function requireNative() {
275
286
  try {
276
287
  const binding = require('@cratestack/cbor-node-linux-x64-musl')
277
288
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-x64-musl/package.json').version
278
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
289
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
290
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
280
291
  }
281
292
  return binding
282
293
  } catch (e) {
@@ -291,8 +302,8 @@ function requireNative() {
291
302
  try {
292
303
  const binding = require('@cratestack/cbor-node-linux-x64-gnu')
293
304
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-x64-gnu/package.json').version
294
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
305
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
306
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
296
307
  }
297
308
  return binding
298
309
  } catch (e) {
@@ -309,8 +320,8 @@ function requireNative() {
309
320
  try {
310
321
  const binding = require('@cratestack/cbor-node-linux-arm64-musl')
311
322
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-arm64-musl/package.json').version
312
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
323
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
314
325
  }
315
326
  return binding
316
327
  } catch (e) {
@@ -325,8 +336,8 @@ function requireNative() {
325
336
  try {
326
337
  const binding = require('@cratestack/cbor-node-linux-arm64-gnu')
327
338
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-arm64-gnu/package.json').version
328
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
339
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
340
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
330
341
  }
331
342
  return binding
332
343
  } catch (e) {
@@ -343,8 +354,8 @@ function requireNative() {
343
354
  try {
344
355
  const binding = require('@cratestack/cbor-node-linux-arm-musleabihf')
345
356
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-arm-musleabihf/package.json').version
346
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
357
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
348
359
  }
349
360
  return binding
350
361
  } catch (e) {
@@ -359,8 +370,8 @@ function requireNative() {
359
370
  try {
360
371
  const binding = require('@cratestack/cbor-node-linux-arm-gnueabihf')
361
372
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-arm-gnueabihf/package.json').version
362
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
373
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
374
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
364
375
  }
365
376
  return binding
366
377
  } catch (e) {
@@ -377,8 +388,8 @@ function requireNative() {
377
388
  try {
378
389
  const binding = require('@cratestack/cbor-node-linux-loong64-musl')
379
390
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-loong64-musl/package.json').version
380
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
391
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
382
393
  }
383
394
  return binding
384
395
  } catch (e) {
@@ -393,8 +404,8 @@ function requireNative() {
393
404
  try {
394
405
  const binding = require('@cratestack/cbor-node-linux-loong64-gnu')
395
406
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-loong64-gnu/package.json').version
396
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
407
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
408
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
398
409
  }
399
410
  return binding
400
411
  } catch (e) {
@@ -411,8 +422,8 @@ function requireNative() {
411
422
  try {
412
423
  const binding = require('@cratestack/cbor-node-linux-riscv64-musl')
413
424
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-riscv64-musl/package.json').version
414
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
425
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
416
427
  }
417
428
  return binding
418
429
  } catch (e) {
@@ -427,8 +438,8 @@ function requireNative() {
427
438
  try {
428
439
  const binding = require('@cratestack/cbor-node-linux-riscv64-gnu')
429
440
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-riscv64-gnu/package.json').version
430
- if (bindingPackageVersion !== '0.11.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
- throw new Error(`Native binding package version mismatch, expected 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
441
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
442
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
432
443
  }
433
444
  return binding
434
445
  } catch (e) {
@@ -444,8 +455,8 @@ function requireNative() {
444
455
  try {
445
456
  const binding = require('@cratestack/cbor-node-linux-ppc64-gnu')
446
457
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-ppc64-gnu/package.json').version
447
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
458
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
459
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
449
460
  }
450
461
  return binding
451
462
  } catch (e) {
@@ -460,8 +471,8 @@ function requireNative() {
460
471
  try {
461
472
  const binding = require('@cratestack/cbor-node-linux-s390x-gnu')
462
473
  const bindingPackageVersion = require('@cratestack/cbor-node-linux-s390x-gnu/package.json').version
463
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
474
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
475
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
476
  }
466
477
  return binding
467
478
  } catch (e) {
@@ -480,8 +491,8 @@ function requireNative() {
480
491
  try {
481
492
  const binding = require('@cratestack/cbor-node-openharmony-arm64')
482
493
  const bindingPackageVersion = require('@cratestack/cbor-node-openharmony-arm64/package.json').version
483
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
494
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
495
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
485
496
  }
486
497
  return binding
487
498
  } catch (e) {
@@ -496,8 +507,8 @@ function requireNative() {
496
507
  try {
497
508
  const binding = require('@cratestack/cbor-node-openharmony-x64')
498
509
  const bindingPackageVersion = require('@cratestack/cbor-node-openharmony-x64/package.json').version
499
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
510
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
511
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
501
512
  }
502
513
  return binding
503
514
  } catch (e) {
@@ -512,8 +523,8 @@ function requireNative() {
512
523
  try {
513
524
  const binding = require('@cratestack/cbor-node-openharmony-arm')
514
525
  const bindingPackageVersion = require('@cratestack/cbor-node-openharmony-arm/package.json').version
515
- if (bindingPackageVersion !== '0.11.1' && 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 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
526
+ if (bindingPackageVersion !== '0.13.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
527
+ throw new Error(`Native binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
517
528
  }
518
529
  return binding
519
530
  } catch (e) {
@@ -554,7 +565,7 @@ function createLoadErrorChain(errors) {
554
565
  //
555
566
  // NAPI_RS_WASI_FLAVOR selects one exact generated flavor and implies strict
556
567
  // WASI loading. It never crosses into another flavor or falls back to native.
557
- const __napiWasiFlavors = ["wasm32-wasi"]
568
+ const __napiWasiFlavors = ['wasm32-wasi']
558
569
  const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR
559
570
  const __napiWasiFlavorRequested =
560
571
  typeof __napiWasiFlavor === 'string' && __napiWasiFlavor.length > 0
@@ -623,15 +634,16 @@ if (!nativeBinding || forceWasi) {
623
634
  }
624
635
  return null
625
636
  }
626
- if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
637
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
627
638
  let candidateError = null
628
639
  let candidateFailed = false
629
640
  try {
630
- candidateError = __napiWasiResolveCandidate('./cratestack-cbor-node.wasi.cjs', false, ["./cratestack-cbor-node.wasm32-wasi.debug.wasm","./cratestack-cbor-node.wasm32-wasi.wasm"])
641
+ candidateError = __napiWasiResolveCandidate('./cratestack-cbor-node.wasi.cjs', false, ['./cratestack-cbor-node.wasm32-wasi.debug.wasm', './cratestack-cbor-node.wasm32-wasi.wasm'])
631
642
  candidateFailed = candidateError !== null
632
643
  if (!candidateFailed) {
633
644
  wasiBinding = require('./cratestack-cbor-node.wasi.cjs')
634
645
  nativeBinding = wasiBinding
646
+ __napiLoadedBindingTarget = 'wasm32-wasi'
635
647
  wasiBindingLoaded = true
636
648
  }
637
649
  } catch (err) {
@@ -643,7 +655,7 @@ if (!nativeBinding || forceWasi) {
643
655
  loadErrors.push(candidateError)
644
656
  }
645
657
  }
646
- if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
658
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
647
659
  let candidateError = null
648
660
  let candidateFailed = false
649
661
  try {
@@ -652,12 +664,13 @@ if (!nativeBinding || forceWasi) {
652
664
  if (!candidateFailed) {
653
665
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
654
666
  const bindingPackageVersion = require('@cratestack/cbor-node-wasm32-wasi/package.json').version
655
- if (bindingPackageVersion !== '0.11.1') {
656
- throw new Error(`WASI binding package version mismatch, expected 0.11.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
667
+ if (bindingPackageVersion !== '0.13.0') {
668
+ throw new Error(`WASI binding package version mismatch, expected 0.13.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
657
669
  }
658
670
  }
659
671
  wasiBinding = require('@cratestack/cbor-node-wasm32-wasi')
660
672
  nativeBinding = wasiBinding
673
+ __napiLoadedBindingTarget = 'wasm32-wasi'
661
674
  wasiBindingLoaded = true
662
675
  }
663
676
  } catch (err) {
@@ -707,3 +720,4 @@ const { contentType, decode, encode } = nativeBinding
707
720
  export { contentType }
708
721
  export { decode }
709
722
  export { encode }
723
+ export const __napiBindingTarget = __napiLoadedBindingTarget
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratestack/cbor-node",
3
- "version": "0.11.1",
3
+ "version": "0.13.0",
4
4
  "description": "Native N-API CBOR codec for CrateStack's generated TypeScript clients, wrapping the framework's own cratestack-codec-cbor Rust crate (crates/cratestack-cbor-napi) for byte-identical wire behavior with the server and Rust client.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -60,21 +60,21 @@
60
60
  "prepublishOnly": "napi prepublish -t npm --skip-optional-publish"
61
61
  },
62
62
  "devDependencies": {
63
- "@cratestack/ts-types": "0.11.1",
64
- "@napi-rs/cli": "^3.8.6",
63
+ "@cratestack/ts-types": "0.13.0",
64
+ "@napi-rs/cli": "^3.10.4",
65
65
  "typescript": "^7.0.2",
66
- "vitest": "^4.1.11"
66
+ "vitest": "^5.0.1"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=24"
70
70
  },
71
71
  "optionalDependencies": {
72
- "@cratestack/cbor-node-darwin-x64": "0.11.1",
73
- "@cratestack/cbor-node-darwin-arm64": "0.11.1",
74
- "@cratestack/cbor-node-linux-x64-gnu": "0.11.1",
75
- "@cratestack/cbor-node-linux-arm64-gnu": "0.11.1",
76
- "@cratestack/cbor-node-linux-x64-musl": "0.11.1",
77
- "@cratestack/cbor-node-linux-arm64-musl": "0.11.1",
78
- "@cratestack/cbor-node-win32-x64-msvc": "0.11.1"
72
+ "@cratestack/cbor-node-darwin-x64": "0.13.0",
73
+ "@cratestack/cbor-node-darwin-arm64": "0.13.0",
74
+ "@cratestack/cbor-node-linux-x64-gnu": "0.13.0",
75
+ "@cratestack/cbor-node-linux-arm64-gnu": "0.13.0",
76
+ "@cratestack/cbor-node-linux-x64-musl": "0.13.0",
77
+ "@cratestack/cbor-node-linux-arm64-musl": "0.13.0",
78
+ "@cratestack/cbor-node-win32-x64-msvc": "0.13.0"
79
79
  }
80
- }
80
+ }