pshenmic-dpp 2.0.0-dev.11 → 2.0.0-dev.13

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.
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ const path = require('node:path');
3
+ const { createRequire } = require('node:module');
4
+ function isMusl() {
5
+ if (process.platform !== 'linux')
6
+ return false;
7
+ const report = process.report?.getReport?.();
8
+ return !report?.header?.glibcVersionRuntime;
9
+ }
10
+ function getBinaryPath() {
11
+ const platform = process.platform;
12
+ const arch = process.arch;
13
+ let target = '';
14
+ if (platform === 'darwin') {
15
+ target = arch === 'arm64'
16
+ ? 'aarch64-apple-darwin'
17
+ : 'x86_64-apple-darwin';
18
+ }
19
+ else if (platform === 'linux') {
20
+ const libc = isMusl() ? 'musl' : 'gnu';
21
+ if (arch === 'arm64') {
22
+ target = `aarch64-unknown-linux-${libc}`;
23
+ }
24
+ else {
25
+ target = `x86_64-unknown-linux-${libc}`;
26
+ }
27
+ }
28
+ // else if (platform === 'win32') {
29
+ // if (arch === 'arm64') {
30
+ // target = 'aarch64-pc-windows-msvc';
31
+ // }
32
+ // else {
33
+ // target = 'x86_64-pc-windows-msvc';
34
+ // }
35
+ // }
36
+ else {
37
+ console.error(`Unsupported platform: ${platform} ${arch}. Using WebAssembly instead Node-API`);
38
+ return null;
39
+ }
40
+ console.log(`running on native dpp (${target})`);
41
+ return path.join('native', target, 'pshenmic_dpp.node');
42
+ }
43
+ const binaryPath = getBinaryPath();
44
+ let exportedModule;
45
+ if (binaryPath !== null) {
46
+ exportedModule = require(`./${binaryPath}`);
47
+ }
48
+ else {
49
+ exportedModule = require('./wasmCreation.cjs');
50
+ }
51
+ module.exports = exportedModule;
@@ -0,0 +1,2 @@
1
+ export = exportedModule;
2
+ declare let exportedModule: any;