qrbit 1.0.0 → 1.1.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/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  A fast QR code generator with logo embedding support, built with Rust and native node packages for best performance while avoiding additional modules (example: canvas).
12
12
 
13
- ## Features
13
+ # Features
14
14
 
15
15
  - **Fast**: Built with Rust (for logos) for maximum performance and caching 🚀
16
16
  - **Fast SVG**: High performance SVG support via `QrCode` when no logo is needed
@@ -22,7 +22,19 @@ A fast QR code generator with logo embedding support, built with Rust and native
22
22
  - **Well-tested**: Comprehensive test coverage with Vitest
23
23
  - **Maintained**: Actively maintained with regular updates
24
24
 
25
- ## Installation
25
+ # Table of Contents
26
+ - [Installation](#installation)
27
+ - [Reqirements](#requirements)
28
+ - [API](#api)
29
+ - [Constructor](#constructoroptions-qroptions)
30
+ - [Properties](#properties)
31
+ - [Methods](#methods)
32
+ - [Benchmarks](#benchmarks)
33
+ - [Examples](#examples)
34
+ - [Contributing](#contributing)
35
+ - [License and Copyright](#license-and-copyright)
36
+
37
+ # Installation
26
38
 
27
39
  ```bash
28
40
  npm install qrbit
@@ -31,7 +43,7 @@ npm install qrbit
31
43
  # Requirements
32
44
 
33
45
  - Node.js >= 18
34
- - Supported platforms: Windows, macOS, Linux (x86, x64, ARM64)
46
+ - Supported platforms: Windows (x86, x64), macOS (Arm, Intel), Linux (x64)
35
47
 
36
48
  # Usage
37
49
 
@@ -0,0 +1,565 @@
1
+ // prettier-ignore
2
+ /* eslint-disable */
3
+ // @ts-nocheck
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ const { createRequire } = require('node:module')
7
+ require = createRequire(__filename)
8
+
9
+ const { readFileSync } = require('node:fs')
10
+ let nativeBinding = null
11
+ const loadErrors = []
12
+
13
+ const isMusl = () => {
14
+ let musl = false
15
+ if (process.platform === 'linux') {
16
+ musl = isMuslFromFilesystem()
17
+ if (musl === null) {
18
+ musl = isMuslFromReport()
19
+ }
20
+ if (musl === null) {
21
+ musl = isMuslFromChildProcess()
22
+ }
23
+ }
24
+ return musl
25
+ }
26
+
27
+ const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
28
+
29
+ const isMuslFromFilesystem = () => {
30
+ try {
31
+ return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
32
+ } catch {
33
+ return null
34
+ }
35
+ }
36
+
37
+ const isMuslFromReport = () => {
38
+ let report = null
39
+ if (typeof process.report?.getReport === 'function') {
40
+ process.report.excludeNetwork = true
41
+ report = process.report.getReport()
42
+ }
43
+ if (!report) {
44
+ return null
45
+ }
46
+ if (report.header && report.header.glibcVersionRuntime) {
47
+ return false
48
+ }
49
+ if (Array.isArray(report.sharedObjects)) {
50
+ if (report.sharedObjects.some(isFileMusl)) {
51
+ return true
52
+ }
53
+ }
54
+ return false
55
+ }
56
+
57
+ const isMuslFromChildProcess = () => {
58
+ try {
59
+ return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
60
+ } catch (e) {
61
+ // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
62
+ return false
63
+ }
64
+ }
65
+
66
+ function requireNative() {
67
+ if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
68
+ try {
69
+ return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
70
+ } catch (err) {
71
+ loadErrors.push(err)
72
+ }
73
+ } else if (process.platform === 'android') {
74
+ if (process.arch === 'arm64') {
75
+ try {
76
+ return require('./qrbit.android-arm64.node')
77
+ } catch (e) {
78
+ loadErrors.push(e)
79
+ }
80
+ try {
81
+ const binding = require('qrbit-android-arm64')
82
+ const bindingPackageVersion = require('qrbit-android-arm64/package.json').version
83
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
84
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
85
+ }
86
+ return binding
87
+ } catch (e) {
88
+ loadErrors.push(e)
89
+ }
90
+ } else if (process.arch === 'arm') {
91
+ try {
92
+ return require('./qrbit.android-arm-eabi.node')
93
+ } catch (e) {
94
+ loadErrors.push(e)
95
+ }
96
+ try {
97
+ const binding = require('qrbit-android-arm-eabi')
98
+ const bindingPackageVersion = require('qrbit-android-arm-eabi/package.json').version
99
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
100
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
+ }
102
+ return binding
103
+ } catch (e) {
104
+ loadErrors.push(e)
105
+ }
106
+ } else {
107
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
108
+ }
109
+ } else if (process.platform === 'win32') {
110
+ if (process.arch === 'x64') {
111
+ try {
112
+ return require('./qrbit.win32-x64-msvc.node')
113
+ } catch (e) {
114
+ loadErrors.push(e)
115
+ }
116
+ try {
117
+ const binding = require('qrbit-win32-x64-msvc')
118
+ const bindingPackageVersion = require('qrbit-win32-x64-msvc/package.json').version
119
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
120
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
+ }
122
+ return binding
123
+ } catch (e) {
124
+ loadErrors.push(e)
125
+ }
126
+ } else if (process.arch === 'ia32') {
127
+ try {
128
+ return require('./qrbit.win32-ia32-msvc.node')
129
+ } catch (e) {
130
+ loadErrors.push(e)
131
+ }
132
+ try {
133
+ const binding = require('qrbit-win32-ia32-msvc')
134
+ const bindingPackageVersion = require('qrbit-win32-ia32-msvc/package.json').version
135
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
136
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
+ }
138
+ return binding
139
+ } catch (e) {
140
+ loadErrors.push(e)
141
+ }
142
+ } else if (process.arch === 'arm64') {
143
+ try {
144
+ return require('./qrbit.win32-arm64-msvc.node')
145
+ } catch (e) {
146
+ loadErrors.push(e)
147
+ }
148
+ try {
149
+ const binding = require('qrbit-win32-arm64-msvc')
150
+ const bindingPackageVersion = require('qrbit-win32-arm64-msvc/package.json').version
151
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
152
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
153
+ }
154
+ return binding
155
+ } catch (e) {
156
+ loadErrors.push(e)
157
+ }
158
+ } else {
159
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
160
+ }
161
+ } else if (process.platform === 'darwin') {
162
+ try {
163
+ return require('./qrbit.darwin-universal.node')
164
+ } catch (e) {
165
+ loadErrors.push(e)
166
+ }
167
+ try {
168
+ const binding = require('qrbit-darwin-universal')
169
+ const bindingPackageVersion = require('qrbit-darwin-universal/package.json').version
170
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
+ }
173
+ return binding
174
+ } catch (e) {
175
+ loadErrors.push(e)
176
+ }
177
+ if (process.arch === 'x64') {
178
+ try {
179
+ return require('./qrbit.darwin-x64.node')
180
+ } catch (e) {
181
+ loadErrors.push(e)
182
+ }
183
+ try {
184
+ const binding = require('qrbit-darwin-x64')
185
+ const bindingPackageVersion = require('qrbit-darwin-x64/package.json').version
186
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
187
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
188
+ }
189
+ return binding
190
+ } catch (e) {
191
+ loadErrors.push(e)
192
+ }
193
+ } else if (process.arch === 'arm64') {
194
+ try {
195
+ return require('./qrbit.darwin-arm64.node')
196
+ } catch (e) {
197
+ loadErrors.push(e)
198
+ }
199
+ try {
200
+ const binding = require('qrbit-darwin-arm64')
201
+ const bindingPackageVersion = require('qrbit-darwin-arm64/package.json').version
202
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
+ }
205
+ return binding
206
+ } catch (e) {
207
+ loadErrors.push(e)
208
+ }
209
+ } else {
210
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
211
+ }
212
+ } else if (process.platform === 'freebsd') {
213
+ if (process.arch === 'x64') {
214
+ try {
215
+ return require('./qrbit.freebsd-x64.node')
216
+ } catch (e) {
217
+ loadErrors.push(e)
218
+ }
219
+ try {
220
+ const binding = require('qrbit-freebsd-x64')
221
+ const bindingPackageVersion = require('qrbit-freebsd-x64/package.json').version
222
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
224
+ }
225
+ return binding
226
+ } catch (e) {
227
+ loadErrors.push(e)
228
+ }
229
+ } else if (process.arch === 'arm64') {
230
+ try {
231
+ return require('./qrbit.freebsd-arm64.node')
232
+ } catch (e) {
233
+ loadErrors.push(e)
234
+ }
235
+ try {
236
+ const binding = require('qrbit-freebsd-arm64')
237
+ const bindingPackageVersion = require('qrbit-freebsd-arm64/package.json').version
238
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
239
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
240
+ }
241
+ return binding
242
+ } catch (e) {
243
+ loadErrors.push(e)
244
+ }
245
+ } else {
246
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
247
+ }
248
+ } else if (process.platform === 'linux') {
249
+ if (process.arch === 'x64') {
250
+ if (isMusl()) {
251
+ try {
252
+ return require('./qrbit.linux-x64-musl.node')
253
+ } catch (e) {
254
+ loadErrors.push(e)
255
+ }
256
+ try {
257
+ const binding = require('qrbit-linux-x64-musl')
258
+ const bindingPackageVersion = require('qrbit-linux-x64-musl/package.json').version
259
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
260
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
261
+ }
262
+ return binding
263
+ } catch (e) {
264
+ loadErrors.push(e)
265
+ }
266
+ } else {
267
+ try {
268
+ return require('./qrbit.linux-x64-gnu.node')
269
+ } catch (e) {
270
+ loadErrors.push(e)
271
+ }
272
+ try {
273
+ const binding = require('qrbit-linux-x64-gnu')
274
+ const bindingPackageVersion = require('qrbit-linux-x64-gnu/package.json').version
275
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
276
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
277
+ }
278
+ return binding
279
+ } catch (e) {
280
+ loadErrors.push(e)
281
+ }
282
+ }
283
+ } else if (process.arch === 'arm64') {
284
+ if (isMusl()) {
285
+ try {
286
+ return require('./qrbit.linux-arm64-musl.node')
287
+ } catch (e) {
288
+ loadErrors.push(e)
289
+ }
290
+ try {
291
+ const binding = require('qrbit-linux-arm64-musl')
292
+ const bindingPackageVersion = require('qrbit-linux-arm64-musl/package.json').version
293
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
294
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
295
+ }
296
+ return binding
297
+ } catch (e) {
298
+ loadErrors.push(e)
299
+ }
300
+ } else {
301
+ try {
302
+ return require('./qrbit.linux-arm64-gnu.node')
303
+ } catch (e) {
304
+ loadErrors.push(e)
305
+ }
306
+ try {
307
+ const binding = require('qrbit-linux-arm64-gnu')
308
+ const bindingPackageVersion = require('qrbit-linux-arm64-gnu/package.json').version
309
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
311
+ }
312
+ return binding
313
+ } catch (e) {
314
+ loadErrors.push(e)
315
+ }
316
+ }
317
+ } else if (process.arch === 'arm') {
318
+ if (isMusl()) {
319
+ try {
320
+ return require('./qrbit.linux-arm-musleabihf.node')
321
+ } catch (e) {
322
+ loadErrors.push(e)
323
+ }
324
+ try {
325
+ const binding = require('qrbit-linux-arm-musleabihf')
326
+ const bindingPackageVersion = require('qrbit-linux-arm-musleabihf/package.json').version
327
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
328
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
329
+ }
330
+ return binding
331
+ } catch (e) {
332
+ loadErrors.push(e)
333
+ }
334
+ } else {
335
+ try {
336
+ return require('./qrbit.linux-arm-gnueabihf.node')
337
+ } catch (e) {
338
+ loadErrors.push(e)
339
+ }
340
+ try {
341
+ const binding = require('qrbit-linux-arm-gnueabihf')
342
+ const bindingPackageVersion = require('qrbit-linux-arm-gnueabihf/package.json').version
343
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
344
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
345
+ }
346
+ return binding
347
+ } catch (e) {
348
+ loadErrors.push(e)
349
+ }
350
+ }
351
+ } else if (process.arch === 'loong64') {
352
+ if (isMusl()) {
353
+ try {
354
+ return require('./qrbit.linux-loong64-musl.node')
355
+ } catch (e) {
356
+ loadErrors.push(e)
357
+ }
358
+ try {
359
+ const binding = require('qrbit-linux-loong64-musl')
360
+ const bindingPackageVersion = require('qrbit-linux-loong64-musl/package.json').version
361
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
362
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
+ }
364
+ return binding
365
+ } catch (e) {
366
+ loadErrors.push(e)
367
+ }
368
+ } else {
369
+ try {
370
+ return require('./qrbit.linux-loong64-gnu.node')
371
+ } catch (e) {
372
+ loadErrors.push(e)
373
+ }
374
+ try {
375
+ const binding = require('qrbit-linux-loong64-gnu')
376
+ const bindingPackageVersion = require('qrbit-linux-loong64-gnu/package.json').version
377
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
378
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
379
+ }
380
+ return binding
381
+ } catch (e) {
382
+ loadErrors.push(e)
383
+ }
384
+ }
385
+ } else if (process.arch === 'riscv64') {
386
+ if (isMusl()) {
387
+ try {
388
+ return require('./qrbit.linux-riscv64-musl.node')
389
+ } catch (e) {
390
+ loadErrors.push(e)
391
+ }
392
+ try {
393
+ const binding = require('qrbit-linux-riscv64-musl')
394
+ const bindingPackageVersion = require('qrbit-linux-riscv64-musl/package.json').version
395
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
396
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
397
+ }
398
+ return binding
399
+ } catch (e) {
400
+ loadErrors.push(e)
401
+ }
402
+ } else {
403
+ try {
404
+ return require('./qrbit.linux-riscv64-gnu.node')
405
+ } catch (e) {
406
+ loadErrors.push(e)
407
+ }
408
+ try {
409
+ const binding = require('qrbit-linux-riscv64-gnu')
410
+ const bindingPackageVersion = require('qrbit-linux-riscv64-gnu/package.json').version
411
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
412
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
413
+ }
414
+ return binding
415
+ } catch (e) {
416
+ loadErrors.push(e)
417
+ }
418
+ }
419
+ } else if (process.arch === 'ppc64') {
420
+ try {
421
+ return require('./qrbit.linux-ppc64-gnu.node')
422
+ } catch (e) {
423
+ loadErrors.push(e)
424
+ }
425
+ try {
426
+ const binding = require('qrbit-linux-ppc64-gnu')
427
+ const bindingPackageVersion = require('qrbit-linux-ppc64-gnu/package.json').version
428
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
429
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
430
+ }
431
+ return binding
432
+ } catch (e) {
433
+ loadErrors.push(e)
434
+ }
435
+ } else if (process.arch === 's390x') {
436
+ try {
437
+ return require('./qrbit.linux-s390x-gnu.node')
438
+ } catch (e) {
439
+ loadErrors.push(e)
440
+ }
441
+ try {
442
+ const binding = require('qrbit-linux-s390x-gnu')
443
+ const bindingPackageVersion = require('qrbit-linux-s390x-gnu/package.json').version
444
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
445
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
446
+ }
447
+ return binding
448
+ } catch (e) {
449
+ loadErrors.push(e)
450
+ }
451
+ } else {
452
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
453
+ }
454
+ } else if (process.platform === 'openharmony') {
455
+ if (process.arch === 'arm64') {
456
+ try {
457
+ return require('./qrbit.openharmony-arm64.node')
458
+ } catch (e) {
459
+ loadErrors.push(e)
460
+ }
461
+ try {
462
+ const binding = require('qrbit-openharmony-arm64')
463
+ const bindingPackageVersion = require('qrbit-openharmony-arm64/package.json').version
464
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
465
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
466
+ }
467
+ return binding
468
+ } catch (e) {
469
+ loadErrors.push(e)
470
+ }
471
+ } else if (process.arch === 'x64') {
472
+ try {
473
+ return require('./qrbit.openharmony-x64.node')
474
+ } catch (e) {
475
+ loadErrors.push(e)
476
+ }
477
+ try {
478
+ const binding = require('qrbit-openharmony-x64')
479
+ const bindingPackageVersion = require('qrbit-openharmony-x64/package.json').version
480
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
481
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
482
+ }
483
+ return binding
484
+ } catch (e) {
485
+ loadErrors.push(e)
486
+ }
487
+ } else if (process.arch === 'arm') {
488
+ try {
489
+ return require('./qrbit.openharmony-arm.node')
490
+ } catch (e) {
491
+ loadErrors.push(e)
492
+ }
493
+ try {
494
+ const binding = require('qrbit-openharmony-arm')
495
+ const bindingPackageVersion = require('qrbit-openharmony-arm/package.json').version
496
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
497
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
498
+ }
499
+ return binding
500
+ } catch (e) {
501
+ loadErrors.push(e)
502
+ }
503
+ } else {
504
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
505
+ }
506
+ } else {
507
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
508
+ }
509
+ }
510
+
511
+ nativeBinding = requireNative()
512
+
513
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
514
+ let wasiBinding = null
515
+ let wasiBindingError = null
516
+ try {
517
+ wasiBinding = require('./qrbit.wasi.cjs')
518
+ nativeBinding = wasiBinding
519
+ } catch (err) {
520
+ if (process.env.NAPI_RS_FORCE_WASI) {
521
+ wasiBindingError = err
522
+ }
523
+ }
524
+ if (!nativeBinding) {
525
+ try {
526
+ wasiBinding = require('qrbit-wasm32-wasi')
527
+ nativeBinding = wasiBinding
528
+ } catch (err) {
529
+ if (process.env.NAPI_RS_FORCE_WASI) {
530
+ wasiBindingError.cause = err
531
+ loadErrors.push(err)
532
+ }
533
+ }
534
+ }
535
+ if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
536
+ const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
537
+ error.cause = wasiBindingError
538
+ throw error
539
+ }
540
+ }
541
+
542
+ if (!nativeBinding) {
543
+ if (loadErrors.length > 0) {
544
+ throw new Error(
545
+ `Cannot find native binding. ` +
546
+ `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
547
+ 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
548
+ {
549
+ cause: loadErrors.reduce((err, cur) => {
550
+ cur.cause = err
551
+ return cur
552
+ }),
553
+ },
554
+ )
555
+ }
556
+ throw new Error(`Failed to load native binding`)
557
+ }
558
+
559
+ module.exports = nativeBinding
560
+ module.exports.convertSvgToPng = nativeBinding.convertSvgToPng
561
+ module.exports.generateQr = nativeBinding.generateQr
562
+ module.exports.generateQrPng = nativeBinding.generateQrPng
563
+ module.exports.generateQrPngWithBuffer = nativeBinding.generateQrPngWithBuffer
564
+ module.exports.generateQrSvg = nativeBinding.generateQrSvg
565
+ module.exports.generateQrSvgWithBuffer = nativeBinding.generateQrSvgWithBuffer
@@ -0,0 +1,40 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ export declare function convertSvgToPng(svgContent: string, width?: number | undefined | null, height?: number | undefined | null): Buffer
4
+
5
+ export declare function generateQr(options: QrOptions): QrResult
6
+
7
+ export declare function generateQrPng(options: QrOptions): Buffer
8
+
9
+ export declare function generateQrPngWithBuffer(options: QrOptionsWithBuffer): Buffer
10
+
11
+ export declare function generateQrSvg(options: QrOptions): string
12
+
13
+ export declare function generateQrSvgWithBuffer(options: QrOptionsWithBuffer): string
14
+
15
+ export interface QrOptions {
16
+ text: string
17
+ size?: number
18
+ margin?: number
19
+ logoPath?: string
20
+ logoSizeRatio?: number
21
+ backgroundColor?: string
22
+ foregroundColor?: string
23
+ }
24
+
25
+ export interface QrOptionsWithBuffer {
26
+ text: string
27
+ size?: number
28
+ margin?: number
29
+ logoBuffer?: Buffer
30
+ logoSizeRatio?: number
31
+ backgroundColor?: string
32
+ foregroundColor?: string
33
+ }
34
+
35
+ export interface QrResult {
36
+ svg?: string
37
+ png?: Buffer
38
+ width: number
39
+ height: number
40
+ }
package/dist/native.js CHANGED
@@ -81,8 +81,8 @@ function requireNative() {
81
81
  try {
82
82
  const binding = require('qrbit-android-arm64')
83
83
  const bindingPackageVersion = require('qrbit-android-arm64/package.json').version
84
- if (bindingPackageVersion !== '1.0.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 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
84
+ if (bindingPackageVersion !== '1.1.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 1.1.1 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('qrbit-android-arm-eabi')
99
99
  const bindingPackageVersion = require('qrbit-android-arm-eabi/package.json').version
100
- if (bindingPackageVersion !== '1.0.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 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
100
+ if (bindingPackageVersion !== '1.1.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 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
102
102
  }
103
103
  return binding
104
104
  } catch (e) {
@@ -117,8 +117,8 @@ function requireNative() {
117
117
  try {
118
118
  const binding = require('qrbit-win32-x64-msvc')
119
119
  const bindingPackageVersion = require('qrbit-win32-x64-msvc/package.json').version
120
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
120
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
122
122
  }
123
123
  return binding
124
124
  } catch (e) {
@@ -133,8 +133,8 @@ function requireNative() {
133
133
  try {
134
134
  const binding = require('qrbit-win32-ia32-msvc')
135
135
  const bindingPackageVersion = require('qrbit-win32-ia32-msvc/package.json').version
136
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
136
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
138
138
  }
139
139
  return binding
140
140
  } catch (e) {
@@ -149,8 +149,8 @@ function requireNative() {
149
149
  try {
150
150
  const binding = require('qrbit-win32-arm64-msvc')
151
151
  const bindingPackageVersion = require('qrbit-win32-arm64-msvc/package.json').version
152
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
153
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
153
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
154
154
  }
155
155
  return binding
156
156
  } catch (e) {
@@ -168,8 +168,8 @@ function requireNative() {
168
168
  try {
169
169
  const binding = require('qrbit-darwin-universal')
170
170
  const bindingPackageVersion = require('qrbit-darwin-universal/package.json').version
171
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
172
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
171
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
172
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
173
173
  }
174
174
  return binding
175
175
  } catch (e) {
@@ -184,8 +184,8 @@ function requireNative() {
184
184
  try {
185
185
  const binding = require('qrbit-darwin-x64')
186
186
  const bindingPackageVersion = require('qrbit-darwin-x64/package.json').version
187
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
188
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
188
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
189
189
  }
190
190
  return binding
191
191
  } catch (e) {
@@ -200,8 +200,8 @@ function requireNative() {
200
200
  try {
201
201
  const binding = require('qrbit-darwin-arm64')
202
202
  const bindingPackageVersion = require('qrbit-darwin-arm64/package.json').version
203
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
204
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
204
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
205
205
  }
206
206
  return binding
207
207
  } catch (e) {
@@ -220,8 +220,8 @@ function requireNative() {
220
220
  try {
221
221
  const binding = require('qrbit-freebsd-x64')
222
222
  const bindingPackageVersion = require('qrbit-freebsd-x64/package.json').version
223
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
224
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
224
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
225
225
  }
226
226
  return binding
227
227
  } catch (e) {
@@ -236,8 +236,8 @@ function requireNative() {
236
236
  try {
237
237
  const binding = require('qrbit-freebsd-arm64')
238
238
  const bindingPackageVersion = require('qrbit-freebsd-arm64/package.json').version
239
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
240
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
240
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
241
241
  }
242
242
  return binding
243
243
  } catch (e) {
@@ -257,8 +257,8 @@ function requireNative() {
257
257
  try {
258
258
  const binding = require('qrbit-linux-x64-musl')
259
259
  const bindingPackageVersion = require('qrbit-linux-x64-musl/package.json').version
260
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
261
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
260
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
261
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
262
262
  }
263
263
  return binding
264
264
  } catch (e) {
@@ -273,8 +273,8 @@ function requireNative() {
273
273
  try {
274
274
  const binding = require('qrbit-linux-x64-gnu')
275
275
  const bindingPackageVersion = require('qrbit-linux-x64-gnu/package.json').version
276
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
277
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
277
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
278
278
  }
279
279
  return binding
280
280
  } catch (e) {
@@ -291,8 +291,8 @@ function requireNative() {
291
291
  try {
292
292
  const binding = require('qrbit-linux-arm64-musl')
293
293
  const bindingPackageVersion = require('qrbit-linux-arm64-musl/package.json').version
294
- if (bindingPackageVersion !== '1.0.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 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
294
+ if (bindingPackageVersion !== '1.1.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 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
296
296
  }
297
297
  return binding
298
298
  } catch (e) {
@@ -307,8 +307,8 @@ function requireNative() {
307
307
  try {
308
308
  const binding = require('qrbit-linux-arm64-gnu')
309
309
  const bindingPackageVersion = require('qrbit-linux-arm64-gnu/package.json').version
310
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
311
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
311
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
312
312
  }
313
313
  return binding
314
314
  } catch (e) {
@@ -325,8 +325,8 @@ function requireNative() {
325
325
  try {
326
326
  const binding = require('qrbit-linux-arm-musleabihf')
327
327
  const bindingPackageVersion = require('qrbit-linux-arm-musleabihf/package.json').version
328
- if (bindingPackageVersion !== '1.0.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 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
328
+ if (bindingPackageVersion !== '1.1.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 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
330
330
  }
331
331
  return binding
332
332
  } catch (e) {
@@ -341,8 +341,8 @@ function requireNative() {
341
341
  try {
342
342
  const binding = require('qrbit-linux-arm-gnueabihf')
343
343
  const bindingPackageVersion = require('qrbit-linux-arm-gnueabihf/package.json').version
344
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
345
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
345
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
346
346
  }
347
347
  return binding
348
348
  } catch (e) {
@@ -359,8 +359,8 @@ function requireNative() {
359
359
  try {
360
360
  const binding = require('qrbit-linux-loong64-musl')
361
361
  const bindingPackageVersion = require('qrbit-linux-loong64-musl/package.json').version
362
- if (bindingPackageVersion !== '1.0.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 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
362
+ if (bindingPackageVersion !== '1.1.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 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
364
364
  }
365
365
  return binding
366
366
  } catch (e) {
@@ -375,8 +375,8 @@ function requireNative() {
375
375
  try {
376
376
  const binding = require('qrbit-linux-loong64-gnu')
377
377
  const bindingPackageVersion = require('qrbit-linux-loong64-gnu/package.json').version
378
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
379
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
379
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
380
380
  }
381
381
  return binding
382
382
  } catch (e) {
@@ -393,8 +393,8 @@ function requireNative() {
393
393
  try {
394
394
  const binding = require('qrbit-linux-riscv64-musl')
395
395
  const bindingPackageVersion = require('qrbit-linux-riscv64-musl/package.json').version
396
- if (bindingPackageVersion !== '1.0.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 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
396
+ if (bindingPackageVersion !== '1.1.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 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
398
398
  }
399
399
  return binding
400
400
  } catch (e) {
@@ -409,8 +409,8 @@ function requireNative() {
409
409
  try {
410
410
  const binding = require('qrbit-linux-riscv64-gnu')
411
411
  const bindingPackageVersion = require('qrbit-linux-riscv64-gnu/package.json').version
412
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
413
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
413
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
414
414
  }
415
415
  return binding
416
416
  } catch (e) {
@@ -426,8 +426,8 @@ function requireNative() {
426
426
  try {
427
427
  const binding = require('qrbit-linux-ppc64-gnu')
428
428
  const bindingPackageVersion = require('qrbit-linux-ppc64-gnu/package.json').version
429
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
430
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
429
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
430
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
431
431
  }
432
432
  return binding
433
433
  } catch (e) {
@@ -442,8 +442,8 @@ function requireNative() {
442
442
  try {
443
443
  const binding = require('qrbit-linux-s390x-gnu')
444
444
  const bindingPackageVersion = require('qrbit-linux-s390x-gnu/package.json').version
445
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
446
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
446
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
447
447
  }
448
448
  return binding
449
449
  } catch (e) {
@@ -462,8 +462,8 @@ function requireNative() {
462
462
  try {
463
463
  const binding = require('qrbit-openharmony-arm64')
464
464
  const bindingPackageVersion = require('qrbit-openharmony-arm64/package.json').version
465
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
466
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
466
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
467
467
  }
468
468
  return binding
469
469
  } catch (e) {
@@ -478,8 +478,8 @@ function requireNative() {
478
478
  try {
479
479
  const binding = require('qrbit-openharmony-x64')
480
480
  const bindingPackageVersion = require('qrbit-openharmony-x64/package.json').version
481
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
482
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
482
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
483
483
  }
484
484
  return binding
485
485
  } catch (e) {
@@ -494,8 +494,8 @@ function requireNative() {
494
494
  try {
495
495
  const binding = require('qrbit-openharmony-arm')
496
496
  const bindingPackageVersion = require('qrbit-openharmony-arm/package.json').version
497
- if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
498
- throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
+ if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
498
+ throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
499
499
  }
500
500
  return binding
501
501
  } catch (e) {
package/dist/qrbit.cjs CHANGED
@@ -40,7 +40,7 @@ var import_node_path = __toESM(require("path"), 1);
40
40
  var import_cacheable = require("cacheable");
41
41
  var import_hookified = require("hookified");
42
42
  var import_qrcode = __toESM(require("qrcode"), 1);
43
- var import_native = require("./native.js");
43
+ var import_native = require("./native.cjs");
44
44
  var QrBitEvents = /* @__PURE__ */ ((QrBitEvents2) => {
45
45
  QrBitEvents2["warn"] = "warn";
46
46
  QrBitEvents2["info"] = "info";
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qrbit",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "A fast QR code generator with logo embedding support",
5
5
  "type": "module",
6
6
  "main": "dist/qrbit.cjs",
@@ -18,9 +18,11 @@
18
18
  ],
19
19
  "scripts": {
20
20
  "build:napi:release": "napi build --platform --release --esm --output-dir src --js native.js --dts native.d.ts",
21
- "build:release": "pnpm build:napi:release && pnpm build:ts && pnpm build:copy",
21
+ "build:napi:release:cjs": "napi build --platform --release --output-dir src --js native.cjs --dts native.d.cts",
22
+ "build:release": "pnpm build:napi:release && pnpm build:napi:release:cjs && pnpm build:ts && pnpm build:copy",
22
23
  "build:napi:debug": "napi build --platform --esm --output-dir src --js native.js --dts native.d.ts",
23
- "build": "pnpm build:napi:debug && pnpm build:ts && pnpm build:copy",
24
+ "build:napi:debug:cjs": "napi build --platform --output-dir src --js native.cjs --dts native.d.cts",
25
+ "build": "pnpm build:napi:debug && pnpm build:napi:debug:cjs && pnpm build:ts && pnpm build:copy",
24
26
  "build:linux": "napi build --platform --release --target x86_64-unknown-linux-gnu",
25
27
  "build:ts": "tsup",
26
28
  "build:copy": "cp src/qrbit.*.node dist/ && cp src/native.* dist/",
@@ -46,6 +48,7 @@
46
48
  "@types/node": "^24.3.1",
47
49
  "@types/qrcode": "^1.5.5",
48
50
  "@vitest/coverage-v8": "^3.2.4",
51
+ "rimraf": "^6.0.1",
49
52
  "tinybench": "^5.0.1",
50
53
  "tsup": "^8.5.0",
51
54
  "tsx": "^4.20.5",
@@ -90,7 +93,6 @@
90
93
  "dependencies": {
91
94
  "cacheable": "^1.10.4",
92
95
  "hookified": "^1.12.0",
93
- "qrcode": "^1.5.4",
94
- "rimraf": "^6.0.1"
96
+ "qrcode": "^1.5.4"
95
97
  }
96
98
  }