@build-qube/takeoff-calculator 2.1.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. package/README.md +4 -0
  2. package/browser.js +1 -1
  3. package/index.d.ts +640 -271
  4. package/index.js +766 -750
  5. package/package.json +15 -13
package/index.js CHANGED
@@ -3,794 +3,810 @@
3
3
  // @ts-nocheck
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
- const { readFileSync } = require("node:fs");
6
+ const { readFileSync } = require('node:fs');
7
7
  let nativeBinding = null;
8
8
  const loadErrors = [];
9
9
 
10
10
  const isMusl = () => {
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;
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("libc.musl-") || f.includes("ld-musl-");
24
+ const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-');
25
25
 
26
26
  const isMuslFromFilesystem = () => {
27
- try {
28
- return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
29
- } catch {
30
- return null;
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
- 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;
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
- 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
- }
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
- 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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.0.4" &&
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.0.4 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
- }
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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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
- 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
- }
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
- 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`);
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;
784
+ module.exports.GeometryClient = nativeBinding.GeometryClient;
785
+ module.exports.FillRule = nativeBinding.FillRule;
786
+ module.exports.LineCap = nativeBinding.LineCap;
787
+ module.exports.LineJoin = nativeBinding.LineJoin;
788
+ module.exports.scaleGeometry = nativeBinding.scaleGeometry;
789
+ module.exports.SnapType = nativeBinding.SnapType;
790
+ module.exports.PdfPage = nativeBinding.PdfPage;
791
+ module.exports.PdfReader = nativeBinding.PdfReader;
792
+ module.exports.ImageOutputFormat = nativeBinding.ImageOutputFormat;
784
793
  module.exports.ContourWrapper = nativeBinding.ContourWrapper;
785
794
  module.exports.GroupWrapper = nativeBinding.GroupWrapper;
786
795
  module.exports.MeasurementWrapper = nativeBinding.MeasurementWrapper;
787
796
  module.exports.TakeoffStateHandler = nativeBinding.TakeoffStateHandler;
797
+ module.exports.VolumetricUnitResult = nativeBinding.VolumetricUnitResult;
798
+ module.exports.asyncMultiTwo = nativeBinding.asyncMultiTwo;
788
799
  module.exports.plus100 = nativeBinding.plus100;
789
800
  module.exports.plus200 = nativeBinding.plus200;
801
+ module.exports.withinAsyncRuntimeIfAvailable =
802
+ nativeBinding.withinAsyncRuntimeIfAvailable;
790
803
  module.exports.UnitValue = nativeBinding.UnitValue;
791
804
  module.exports.distance = nativeBinding.distance;
805
+ module.exports.generateRandomId = nativeBinding.generateRandomId;
792
806
  module.exports.getCentroid = nativeBinding.getCentroid;
793
807
  module.exports.MeasurementType = nativeBinding.MeasurementType;
808
+ module.exports.repositionMeasurementToCentroid =
809
+ nativeBinding.repositionMeasurementToCentroid;
794
810
  module.exports.simplifyPolyline = nativeBinding.simplifyPolyline;
795
811
  module.exports.Unit = nativeBinding.Unit;
796
812
  module.exports.UnitValueItemType = nativeBinding.UnitValueItemType;