File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
const path = require ( 'node:path' )
2
- const libPath = path . join ( __dirname , 'parser.so' )
2
+
3
+ function getNativePath ( ) {
4
+ if ( process . platform === 'win32' ) {
5
+ if ( process . arch === 'x64' ) {
6
+ return 'prebuilds/prebuild-Windows-X64/parser.so'
7
+ }
8
+
9
+ throw new Error ( `Unsupported architecture on Windows: ${ process . arch } ` )
10
+ } else if ( process . platform === 'darwin' ) {
11
+ if ( process . arch === 'arm64' ) {
12
+ return 'prebuilds/prebuild-macOS-ARM64/parser.so' ;
13
+ }
14
+
15
+ throw new Error ( `Unsupported architecture on macOS: ${ process . arch } ` )
16
+ } else if ( process . platform === 'linux' ) {
17
+ if ( process . arch === 'x64' ) {
18
+ return 'prebuilds/prebuild-Linux-X64/parser.so' ;
19
+ }
20
+
21
+ throw new Error ( `Unsupported architecture on Linux: ${ process . arch } ` )
22
+ }
23
+
24
+ throw new Error ( `Unsupported OS: ${ process . platform } , architecture: ${ process . arch } ` )
25
+ }
26
+
27
+ const libPath = path . join ( __dirname , getNativePath ( ) )
3
28
4
29
module . exports = {
5
30
libraryPath : libPath ,
You can’t perform that action at this time.
0 commit comments