@build-qube/takeoff-calculator 2.1.0 → 2.3.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/README.md +4 -0
- package/browser.js +1 -1
- package/index.d.ts +351 -270
- package/index.js +754 -750
- package/package.json +14 -13
package/index.js
CHANGED
|
@@ -3,781 +3,781 @@
|
|
|
3
3
|
// @ts-nocheck
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
-
const { readFileSync } = require(
|
|
6
|
+
const { readFileSync } = require('node:fs');
|
|
7
7
|
let nativeBinding = null;
|
|
8
8
|
const loadErrors = [];
|
|
9
9
|
|
|
10
10
|
const isMusl = () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
let musl = false;
|
|
12
|
+
if (process.platform === 'linux') {
|
|
13
|
+
musl = isMuslFromFilesystem();
|
|
14
|
+
if (musl === null) {
|
|
15
|
+
musl = isMuslFromReport();
|
|
16
|
+
}
|
|
17
|
+
if (musl === null) {
|
|
18
|
+
musl = isMuslFromChildProcess();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return musl;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const isFileMusl = (f) => f.includes(
|
|
24
|
+
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-');
|
|
25
25
|
|
|
26
26
|
const isMuslFromFilesystem = () => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
try {
|
|
28
|
+
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl');
|
|
29
|
+
} catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const isMuslFromReport = () => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
35
|
+
let report = null;
|
|
36
|
+
if (typeof process.report?.getReport === 'function') {
|
|
37
|
+
process.report.excludeNetwork = true;
|
|
38
|
+
report = process.report.getReport();
|
|
39
|
+
}
|
|
40
|
+
if (!report) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
47
|
+
if (report.sharedObjects.some(isFileMusl)) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
const isMuslFromChildProcess = () => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
try {
|
|
56
|
+
return require('child_process')
|
|
57
|
+
.execSync('ldd --version', { encoding: 'utf8' })
|
|
58
|
+
.includes('musl');
|
|
59
|
+
} catch (e) {
|
|
60
|
+
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
function requireNative() {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
66
|
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
67
|
+
try {
|
|
68
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
69
|
+
} catch (err) {
|
|
70
|
+
loadErrors.push(err);
|
|
71
|
+
}
|
|
72
|
+
} else if (process.platform === 'android') {
|
|
73
|
+
if (process.arch === 'arm64') {
|
|
74
|
+
try {
|
|
75
|
+
return require('./takeoff-calculator.android-arm64.node');
|
|
76
|
+
} catch (e) {
|
|
77
|
+
loadErrors.push(e);
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
const binding = require('@build-qube/takeoff-calculator-android-arm64');
|
|
81
|
+
const bindingPackageVersion =
|
|
82
|
+
require('@build-qube/takeoff-calculator-android-arm64/package.json').version;
|
|
83
|
+
if (
|
|
84
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
85
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
86
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
87
|
+
) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
return binding;
|
|
93
|
+
} catch (e) {
|
|
94
|
+
loadErrors.push(e);
|
|
95
|
+
}
|
|
96
|
+
} else if (process.arch === 'arm') {
|
|
97
|
+
try {
|
|
98
|
+
return require('./takeoff-calculator.android-arm-eabi.node');
|
|
99
|
+
} catch (e) {
|
|
100
|
+
loadErrors.push(e);
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
const binding = require('@build-qube/takeoff-calculator-android-arm-eabi');
|
|
104
|
+
const bindingPackageVersion =
|
|
105
|
+
require('@build-qube/takeoff-calculator-android-arm-eabi/package.json').version;
|
|
106
|
+
if (
|
|
107
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
108
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
109
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
110
|
+
) {
|
|
111
|
+
throw new Error(
|
|
112
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return binding;
|
|
116
|
+
} catch (e) {
|
|
117
|
+
loadErrors.push(e);
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
loadErrors.push(
|
|
121
|
+
new Error(`Unsupported architecture on Android ${process.arch}`),
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
} else if (process.platform === 'win32') {
|
|
125
|
+
if (process.arch === 'x64') {
|
|
126
|
+
if (
|
|
127
|
+
process.config?.variables?.shlib_suffix === 'dll.a' ||
|
|
128
|
+
process.config?.variables?.node_target_type === 'shared_library'
|
|
129
|
+
) {
|
|
130
|
+
try {
|
|
131
|
+
return require('./takeoff-calculator.win32-x64-gnu.node');
|
|
132
|
+
} catch (e) {
|
|
133
|
+
loadErrors.push(e);
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
const binding = require('@build-qube/takeoff-calculator-win32-x64-gnu');
|
|
137
|
+
const bindingPackageVersion =
|
|
138
|
+
require('@build-qube/takeoff-calculator-win32-x64-gnu/package.json').version;
|
|
139
|
+
if (
|
|
140
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
141
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
142
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
143
|
+
) {
|
|
144
|
+
throw new Error(
|
|
145
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
return binding;
|
|
149
|
+
} catch (e) {
|
|
150
|
+
loadErrors.push(e);
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
try {
|
|
154
|
+
return require('./takeoff-calculator.win32-x64-msvc.node');
|
|
155
|
+
} catch (e) {
|
|
156
|
+
loadErrors.push(e);
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const binding = require('@build-qube/takeoff-calculator-win32-x64-msvc');
|
|
160
|
+
const bindingPackageVersion =
|
|
161
|
+
require('@build-qube/takeoff-calculator-win32-x64-msvc/package.json').version;
|
|
162
|
+
if (
|
|
163
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
164
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
165
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
166
|
+
) {
|
|
167
|
+
throw new Error(
|
|
168
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
return binding;
|
|
172
|
+
} catch (e) {
|
|
173
|
+
loadErrors.push(e);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
} else if (process.arch === 'ia32') {
|
|
177
|
+
try {
|
|
178
|
+
return require('./takeoff-calculator.win32-ia32-msvc.node');
|
|
179
|
+
} catch (e) {
|
|
180
|
+
loadErrors.push(e);
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
const binding = require('@build-qube/takeoff-calculator-win32-ia32-msvc');
|
|
184
|
+
const bindingPackageVersion =
|
|
185
|
+
require('@build-qube/takeoff-calculator-win32-ia32-msvc/package.json').version;
|
|
186
|
+
if (
|
|
187
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
188
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
189
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
190
|
+
) {
|
|
191
|
+
throw new Error(
|
|
192
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
return binding;
|
|
196
|
+
} catch (e) {
|
|
197
|
+
loadErrors.push(e);
|
|
198
|
+
}
|
|
199
|
+
} else if (process.arch === 'arm64') {
|
|
200
|
+
try {
|
|
201
|
+
return require('./takeoff-calculator.win32-arm64-msvc.node');
|
|
202
|
+
} catch (e) {
|
|
203
|
+
loadErrors.push(e);
|
|
204
|
+
}
|
|
205
|
+
try {
|
|
206
|
+
const binding = require('@build-qube/takeoff-calculator-win32-arm64-msvc');
|
|
207
|
+
const bindingPackageVersion =
|
|
208
|
+
require('@build-qube/takeoff-calculator-win32-arm64-msvc/package.json').version;
|
|
209
|
+
if (
|
|
210
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
211
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
212
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
213
|
+
) {
|
|
214
|
+
throw new Error(
|
|
215
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
return binding;
|
|
219
|
+
} catch (e) {
|
|
220
|
+
loadErrors.push(e);
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
223
|
+
loadErrors.push(
|
|
224
|
+
new Error(`Unsupported architecture on Windows: ${process.arch}`),
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
} else if (process.platform === 'darwin') {
|
|
228
|
+
try {
|
|
229
|
+
return require('./takeoff-calculator.darwin-universal.node');
|
|
230
|
+
} catch (e) {
|
|
231
|
+
loadErrors.push(e);
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
const binding = require('@build-qube/takeoff-calculator-darwin-universal');
|
|
235
|
+
const bindingPackageVersion =
|
|
236
|
+
require('@build-qube/takeoff-calculator-darwin-universal/package.json').version;
|
|
237
|
+
if (
|
|
238
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
239
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
240
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
241
|
+
) {
|
|
242
|
+
throw new Error(
|
|
243
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
return binding;
|
|
247
|
+
} catch (e) {
|
|
248
|
+
loadErrors.push(e);
|
|
249
|
+
}
|
|
250
|
+
if (process.arch === 'x64') {
|
|
251
|
+
try {
|
|
252
|
+
return require('./takeoff-calculator.darwin-x64.node');
|
|
253
|
+
} catch (e) {
|
|
254
|
+
loadErrors.push(e);
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
const binding = require('@build-qube/takeoff-calculator-darwin-x64');
|
|
258
|
+
const bindingPackageVersion =
|
|
259
|
+
require('@build-qube/takeoff-calculator-darwin-x64/package.json').version;
|
|
260
|
+
if (
|
|
261
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
262
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
263
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
264
|
+
) {
|
|
265
|
+
throw new Error(
|
|
266
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
return binding;
|
|
270
|
+
} catch (e) {
|
|
271
|
+
loadErrors.push(e);
|
|
272
|
+
}
|
|
273
|
+
} else if (process.arch === 'arm64') {
|
|
274
|
+
try {
|
|
275
|
+
return require('./takeoff-calculator.darwin-arm64.node');
|
|
276
|
+
} catch (e) {
|
|
277
|
+
loadErrors.push(e);
|
|
278
|
+
}
|
|
279
|
+
try {
|
|
280
|
+
const binding = require('@build-qube/takeoff-calculator-darwin-arm64');
|
|
281
|
+
const bindingPackageVersion =
|
|
282
|
+
require('@build-qube/takeoff-calculator-darwin-arm64/package.json').version;
|
|
283
|
+
if (
|
|
284
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
285
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
286
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
287
|
+
) {
|
|
288
|
+
throw new Error(
|
|
289
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
return binding;
|
|
293
|
+
} catch (e) {
|
|
294
|
+
loadErrors.push(e);
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
297
|
+
loadErrors.push(
|
|
298
|
+
new Error(`Unsupported architecture on macOS: ${process.arch}`),
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
} else if (process.platform === 'freebsd') {
|
|
302
|
+
if (process.arch === 'x64') {
|
|
303
|
+
try {
|
|
304
|
+
return require('./takeoff-calculator.freebsd-x64.node');
|
|
305
|
+
} catch (e) {
|
|
306
|
+
loadErrors.push(e);
|
|
307
|
+
}
|
|
308
|
+
try {
|
|
309
|
+
const binding = require('@build-qube/takeoff-calculator-freebsd-x64');
|
|
310
|
+
const bindingPackageVersion =
|
|
311
|
+
require('@build-qube/takeoff-calculator-freebsd-x64/package.json').version;
|
|
312
|
+
if (
|
|
313
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
314
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
315
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
316
|
+
) {
|
|
317
|
+
throw new Error(
|
|
318
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
return binding;
|
|
322
|
+
} catch (e) {
|
|
323
|
+
loadErrors.push(e);
|
|
324
|
+
}
|
|
325
|
+
} else if (process.arch === 'arm64') {
|
|
326
|
+
try {
|
|
327
|
+
return require('./takeoff-calculator.freebsd-arm64.node');
|
|
328
|
+
} catch (e) {
|
|
329
|
+
loadErrors.push(e);
|
|
330
|
+
}
|
|
331
|
+
try {
|
|
332
|
+
const binding = require('@build-qube/takeoff-calculator-freebsd-arm64');
|
|
333
|
+
const bindingPackageVersion =
|
|
334
|
+
require('@build-qube/takeoff-calculator-freebsd-arm64/package.json').version;
|
|
335
|
+
if (
|
|
336
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
337
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
338
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
339
|
+
) {
|
|
340
|
+
throw new Error(
|
|
341
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
return binding;
|
|
345
|
+
} catch (e) {
|
|
346
|
+
loadErrors.push(e);
|
|
347
|
+
}
|
|
348
|
+
} else {
|
|
349
|
+
loadErrors.push(
|
|
350
|
+
new Error(`Unsupported architecture on FreeBSD: ${process.arch}`),
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
} else if (process.platform === 'linux') {
|
|
354
|
+
if (process.arch === 'x64') {
|
|
355
|
+
if (isMusl()) {
|
|
356
|
+
try {
|
|
357
|
+
return require('./takeoff-calculator.linux-x64-musl.node');
|
|
358
|
+
} catch (e) {
|
|
359
|
+
loadErrors.push(e);
|
|
360
|
+
}
|
|
361
|
+
try {
|
|
362
|
+
const binding = require('@build-qube/takeoff-calculator-linux-x64-musl');
|
|
363
|
+
const bindingPackageVersion =
|
|
364
|
+
require('@build-qube/takeoff-calculator-linux-x64-musl/package.json').version;
|
|
365
|
+
if (
|
|
366
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
367
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
368
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
369
|
+
) {
|
|
370
|
+
throw new Error(
|
|
371
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
return binding;
|
|
375
|
+
} catch (e) {
|
|
376
|
+
loadErrors.push(e);
|
|
377
|
+
}
|
|
378
|
+
} else {
|
|
379
|
+
try {
|
|
380
|
+
return require('./takeoff-calculator.linux-x64-gnu.node');
|
|
381
|
+
} catch (e) {
|
|
382
|
+
loadErrors.push(e);
|
|
383
|
+
}
|
|
384
|
+
try {
|
|
385
|
+
const binding = require('@build-qube/takeoff-calculator-linux-x64-gnu');
|
|
386
|
+
const bindingPackageVersion =
|
|
387
|
+
require('@build-qube/takeoff-calculator-linux-x64-gnu/package.json').version;
|
|
388
|
+
if (
|
|
389
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
390
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
391
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
392
|
+
) {
|
|
393
|
+
throw new Error(
|
|
394
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
return binding;
|
|
398
|
+
} catch (e) {
|
|
399
|
+
loadErrors.push(e);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
} else if (process.arch === 'arm64') {
|
|
403
|
+
if (isMusl()) {
|
|
404
|
+
try {
|
|
405
|
+
return require('./takeoff-calculator.linux-arm64-musl.node');
|
|
406
|
+
} catch (e) {
|
|
407
|
+
loadErrors.push(e);
|
|
408
|
+
}
|
|
409
|
+
try {
|
|
410
|
+
const binding = require('@build-qube/takeoff-calculator-linux-arm64-musl');
|
|
411
|
+
const bindingPackageVersion =
|
|
412
|
+
require('@build-qube/takeoff-calculator-linux-arm64-musl/package.json').version;
|
|
413
|
+
if (
|
|
414
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
415
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
416
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
417
|
+
) {
|
|
418
|
+
throw new Error(
|
|
419
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
return binding;
|
|
423
|
+
} catch (e) {
|
|
424
|
+
loadErrors.push(e);
|
|
425
|
+
}
|
|
426
|
+
} else {
|
|
427
|
+
try {
|
|
428
|
+
return require('./takeoff-calculator.linux-arm64-gnu.node');
|
|
429
|
+
} catch (e) {
|
|
430
|
+
loadErrors.push(e);
|
|
431
|
+
}
|
|
432
|
+
try {
|
|
433
|
+
const binding = require('@build-qube/takeoff-calculator-linux-arm64-gnu');
|
|
434
|
+
const bindingPackageVersion =
|
|
435
|
+
require('@build-qube/takeoff-calculator-linux-arm64-gnu/package.json').version;
|
|
436
|
+
if (
|
|
437
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
438
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
439
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
440
|
+
) {
|
|
441
|
+
throw new Error(
|
|
442
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
return binding;
|
|
446
|
+
} catch (e) {
|
|
447
|
+
loadErrors.push(e);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
} else if (process.arch === 'arm') {
|
|
451
|
+
if (isMusl()) {
|
|
452
|
+
try {
|
|
453
|
+
return require('./takeoff-calculator.linux-arm-musleabihf.node');
|
|
454
|
+
} catch (e) {
|
|
455
|
+
loadErrors.push(e);
|
|
456
|
+
}
|
|
457
|
+
try {
|
|
458
|
+
const binding = require('@build-qube/takeoff-calculator-linux-arm-musleabihf');
|
|
459
|
+
const bindingPackageVersion =
|
|
460
|
+
require('@build-qube/takeoff-calculator-linux-arm-musleabihf/package.json').version;
|
|
461
|
+
if (
|
|
462
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
463
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
464
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
465
|
+
) {
|
|
466
|
+
throw new Error(
|
|
467
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
return binding;
|
|
471
|
+
} catch (e) {
|
|
472
|
+
loadErrors.push(e);
|
|
473
|
+
}
|
|
474
|
+
} else {
|
|
475
|
+
try {
|
|
476
|
+
return require('./takeoff-calculator.linux-arm-gnueabihf.node');
|
|
477
|
+
} catch (e) {
|
|
478
|
+
loadErrors.push(e);
|
|
479
|
+
}
|
|
480
|
+
try {
|
|
481
|
+
const binding = require('@build-qube/takeoff-calculator-linux-arm-gnueabihf');
|
|
482
|
+
const bindingPackageVersion =
|
|
483
|
+
require('@build-qube/takeoff-calculator-linux-arm-gnueabihf/package.json').version;
|
|
484
|
+
if (
|
|
485
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
486
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
487
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
488
|
+
) {
|
|
489
|
+
throw new Error(
|
|
490
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
return binding;
|
|
494
|
+
} catch (e) {
|
|
495
|
+
loadErrors.push(e);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
} else if (process.arch === 'loong64') {
|
|
499
|
+
if (isMusl()) {
|
|
500
|
+
try {
|
|
501
|
+
return require('./takeoff-calculator.linux-loong64-musl.node');
|
|
502
|
+
} catch (e) {
|
|
503
|
+
loadErrors.push(e);
|
|
504
|
+
}
|
|
505
|
+
try {
|
|
506
|
+
const binding = require('@build-qube/takeoff-calculator-linux-loong64-musl');
|
|
507
|
+
const bindingPackageVersion =
|
|
508
|
+
require('@build-qube/takeoff-calculator-linux-loong64-musl/package.json').version;
|
|
509
|
+
if (
|
|
510
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
511
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
512
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
513
|
+
) {
|
|
514
|
+
throw new Error(
|
|
515
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
return binding;
|
|
519
|
+
} catch (e) {
|
|
520
|
+
loadErrors.push(e);
|
|
521
|
+
}
|
|
522
|
+
} else {
|
|
523
|
+
try {
|
|
524
|
+
return require('./takeoff-calculator.linux-loong64-gnu.node');
|
|
525
|
+
} catch (e) {
|
|
526
|
+
loadErrors.push(e);
|
|
527
|
+
}
|
|
528
|
+
try {
|
|
529
|
+
const binding = require('@build-qube/takeoff-calculator-linux-loong64-gnu');
|
|
530
|
+
const bindingPackageVersion =
|
|
531
|
+
require('@build-qube/takeoff-calculator-linux-loong64-gnu/package.json').version;
|
|
532
|
+
if (
|
|
533
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
534
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
535
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
536
|
+
) {
|
|
537
|
+
throw new Error(
|
|
538
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
return binding;
|
|
542
|
+
} catch (e) {
|
|
543
|
+
loadErrors.push(e);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
} else if (process.arch === 'riscv64') {
|
|
547
|
+
if (isMusl()) {
|
|
548
|
+
try {
|
|
549
|
+
return require('./takeoff-calculator.linux-riscv64-musl.node');
|
|
550
|
+
} catch (e) {
|
|
551
|
+
loadErrors.push(e);
|
|
552
|
+
}
|
|
553
|
+
try {
|
|
554
|
+
const binding = require('@build-qube/takeoff-calculator-linux-riscv64-musl');
|
|
555
|
+
const bindingPackageVersion =
|
|
556
|
+
require('@build-qube/takeoff-calculator-linux-riscv64-musl/package.json').version;
|
|
557
|
+
if (
|
|
558
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
559
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
560
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
561
|
+
) {
|
|
562
|
+
throw new Error(
|
|
563
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
return binding;
|
|
567
|
+
} catch (e) {
|
|
568
|
+
loadErrors.push(e);
|
|
569
|
+
}
|
|
570
|
+
} else {
|
|
571
|
+
try {
|
|
572
|
+
return require('./takeoff-calculator.linux-riscv64-gnu.node');
|
|
573
|
+
} catch (e) {
|
|
574
|
+
loadErrors.push(e);
|
|
575
|
+
}
|
|
576
|
+
try {
|
|
577
|
+
const binding = require('@build-qube/takeoff-calculator-linux-riscv64-gnu');
|
|
578
|
+
const bindingPackageVersion =
|
|
579
|
+
require('@build-qube/takeoff-calculator-linux-riscv64-gnu/package.json').version;
|
|
580
|
+
if (
|
|
581
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
582
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
583
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
584
|
+
) {
|
|
585
|
+
throw new Error(
|
|
586
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
return binding;
|
|
590
|
+
} catch (e) {
|
|
591
|
+
loadErrors.push(e);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
} else if (process.arch === 'ppc64') {
|
|
595
|
+
try {
|
|
596
|
+
return require('./takeoff-calculator.linux-ppc64-gnu.node');
|
|
597
|
+
} catch (e) {
|
|
598
|
+
loadErrors.push(e);
|
|
599
|
+
}
|
|
600
|
+
try {
|
|
601
|
+
const binding = require('@build-qube/takeoff-calculator-linux-ppc64-gnu');
|
|
602
|
+
const bindingPackageVersion =
|
|
603
|
+
require('@build-qube/takeoff-calculator-linux-ppc64-gnu/package.json').version;
|
|
604
|
+
if (
|
|
605
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
606
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
607
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
608
|
+
) {
|
|
609
|
+
throw new Error(
|
|
610
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
return binding;
|
|
614
|
+
} catch (e) {
|
|
615
|
+
loadErrors.push(e);
|
|
616
|
+
}
|
|
617
|
+
} else if (process.arch === 's390x') {
|
|
618
|
+
try {
|
|
619
|
+
return require('./takeoff-calculator.linux-s390x-gnu.node');
|
|
620
|
+
} catch (e) {
|
|
621
|
+
loadErrors.push(e);
|
|
622
|
+
}
|
|
623
|
+
try {
|
|
624
|
+
const binding = require('@build-qube/takeoff-calculator-linux-s390x-gnu');
|
|
625
|
+
const bindingPackageVersion =
|
|
626
|
+
require('@build-qube/takeoff-calculator-linux-s390x-gnu/package.json').version;
|
|
627
|
+
if (
|
|
628
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
629
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
630
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
631
|
+
) {
|
|
632
|
+
throw new Error(
|
|
633
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
return binding;
|
|
637
|
+
} catch (e) {
|
|
638
|
+
loadErrors.push(e);
|
|
639
|
+
}
|
|
640
|
+
} else {
|
|
641
|
+
loadErrors.push(
|
|
642
|
+
new Error(`Unsupported architecture on Linux: ${process.arch}`),
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
} else if (process.platform === 'openharmony') {
|
|
646
|
+
if (process.arch === 'arm64') {
|
|
647
|
+
try {
|
|
648
|
+
return require('./takeoff-calculator.openharmony-arm64.node');
|
|
649
|
+
} catch (e) {
|
|
650
|
+
loadErrors.push(e);
|
|
651
|
+
}
|
|
652
|
+
try {
|
|
653
|
+
const binding = require('@build-qube/takeoff-calculator-openharmony-arm64');
|
|
654
|
+
const bindingPackageVersion =
|
|
655
|
+
require('@build-qube/takeoff-calculator-openharmony-arm64/package.json').version;
|
|
656
|
+
if (
|
|
657
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
658
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
659
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
660
|
+
) {
|
|
661
|
+
throw new Error(
|
|
662
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
return binding;
|
|
666
|
+
} catch (e) {
|
|
667
|
+
loadErrors.push(e);
|
|
668
|
+
}
|
|
669
|
+
} else if (process.arch === 'x64') {
|
|
670
|
+
try {
|
|
671
|
+
return require('./takeoff-calculator.openharmony-x64.node');
|
|
672
|
+
} catch (e) {
|
|
673
|
+
loadErrors.push(e);
|
|
674
|
+
}
|
|
675
|
+
try {
|
|
676
|
+
const binding = require('@build-qube/takeoff-calculator-openharmony-x64');
|
|
677
|
+
const bindingPackageVersion =
|
|
678
|
+
require('@build-qube/takeoff-calculator-openharmony-x64/package.json').version;
|
|
679
|
+
if (
|
|
680
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
681
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
682
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
683
|
+
) {
|
|
684
|
+
throw new Error(
|
|
685
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
return binding;
|
|
689
|
+
} catch (e) {
|
|
690
|
+
loadErrors.push(e);
|
|
691
|
+
}
|
|
692
|
+
} else if (process.arch === 'arm') {
|
|
693
|
+
try {
|
|
694
|
+
return require('./takeoff-calculator.openharmony-arm.node');
|
|
695
|
+
} catch (e) {
|
|
696
|
+
loadErrors.push(e);
|
|
697
|
+
}
|
|
698
|
+
try {
|
|
699
|
+
const binding = require('@build-qube/takeoff-calculator-openharmony-arm');
|
|
700
|
+
const bindingPackageVersion =
|
|
701
|
+
require('@build-qube/takeoff-calculator-openharmony-arm/package.json').version;
|
|
702
|
+
if (
|
|
703
|
+
bindingPackageVersion !== '2.2.0' &&
|
|
704
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
705
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
706
|
+
) {
|
|
707
|
+
throw new Error(
|
|
708
|
+
`Native binding package version mismatch, expected 2.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
return binding;
|
|
712
|
+
} catch (e) {
|
|
713
|
+
loadErrors.push(e);
|
|
714
|
+
}
|
|
715
|
+
} else {
|
|
716
|
+
loadErrors.push(
|
|
717
|
+
new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`),
|
|
718
|
+
);
|
|
719
|
+
}
|
|
720
|
+
} else {
|
|
721
|
+
loadErrors.push(
|
|
722
|
+
new Error(
|
|
723
|
+
`Unsupported OS: ${process.platform}, architecture: ${process.arch}`,
|
|
724
|
+
),
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
727
|
}
|
|
728
728
|
|
|
729
729
|
nativeBinding = requireNative();
|
|
730
730
|
|
|
731
731
|
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
732
|
+
let wasiBinding = null;
|
|
733
|
+
let wasiBindingError = null;
|
|
734
|
+
try {
|
|
735
|
+
wasiBinding = require('./takeoff-calculator.wasi.cjs');
|
|
736
|
+
nativeBinding = wasiBinding;
|
|
737
|
+
} catch (err) {
|
|
738
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
739
|
+
wasiBindingError = err;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
743
|
+
try {
|
|
744
|
+
wasiBinding = require('@build-qube/takeoff-calculator-wasm32-wasi');
|
|
745
|
+
nativeBinding = wasiBinding;
|
|
746
|
+
} catch (err) {
|
|
747
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
748
|
+
if (!wasiBindingError) {
|
|
749
|
+
wasiBindingError = err;
|
|
750
|
+
} else {
|
|
751
|
+
wasiBindingError.cause = err;
|
|
752
|
+
}
|
|
753
|
+
loadErrors.push(err);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
|
758
|
+
const error = new Error(
|
|
759
|
+
'WASI binding not found and NAPI_RS_FORCE_WASI is set to error',
|
|
760
|
+
);
|
|
761
|
+
error.cause = wasiBindingError;
|
|
762
|
+
throw error;
|
|
763
|
+
}
|
|
764
764
|
}
|
|
765
765
|
|
|
766
766
|
if (!nativeBinding) {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
767
|
+
if (loadErrors.length > 0) {
|
|
768
|
+
throw new Error(
|
|
769
|
+
`Cannot find native binding. ` +
|
|
770
|
+
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
771
|
+
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
772
|
+
{
|
|
773
|
+
cause: loadErrors.reduce((err, cur) => {
|
|
774
|
+
cur.cause = err;
|
|
775
|
+
return cur;
|
|
776
|
+
}),
|
|
777
|
+
},
|
|
778
|
+
);
|
|
779
|
+
}
|
|
780
|
+
throw new Error(`Failed to load native binding`);
|
|
781
781
|
}
|
|
782
782
|
|
|
783
783
|
module.exports = nativeBinding;
|
|
@@ -785,12 +785,16 @@ module.exports.ContourWrapper = nativeBinding.ContourWrapper;
|
|
|
785
785
|
module.exports.GroupWrapper = nativeBinding.GroupWrapper;
|
|
786
786
|
module.exports.MeasurementWrapper = nativeBinding.MeasurementWrapper;
|
|
787
787
|
module.exports.TakeoffStateHandler = nativeBinding.TakeoffStateHandler;
|
|
788
|
+
module.exports.VolumetricUnitResult = nativeBinding.VolumetricUnitResult;
|
|
788
789
|
module.exports.plus100 = nativeBinding.plus100;
|
|
789
790
|
module.exports.plus200 = nativeBinding.plus200;
|
|
790
791
|
module.exports.UnitValue = nativeBinding.UnitValue;
|
|
791
792
|
module.exports.distance = nativeBinding.distance;
|
|
793
|
+
module.exports.generateRandomId = nativeBinding.generateRandomId;
|
|
792
794
|
module.exports.getCentroid = nativeBinding.getCentroid;
|
|
793
795
|
module.exports.MeasurementType = nativeBinding.MeasurementType;
|
|
796
|
+
module.exports.repositionMeasurementToCentroid =
|
|
797
|
+
nativeBinding.repositionMeasurementToCentroid;
|
|
794
798
|
module.exports.simplifyPolyline = nativeBinding.simplifyPolyline;
|
|
795
799
|
module.exports.Unit = nativeBinding.Unit;
|
|
796
800
|
module.exports.UnitValueItemType = nativeBinding.UnitValueItemType;
|