@ossiana/node-libcurl 1.2.8 → 1.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.
@@ -1,41 +1,37 @@
1
- const {
2
- readFileSync
3
- } = require('fs');
4
-
5
- const {
6
- platform,
7
- arch
8
- } = process;
1
+ const { readFileSync } = require("fs");
2
+
3
+ const { platform, arch } = process;
9
4
  let nativeBinding = null;
10
5
  let loadError = null;
11
6
 
12
7
  function isMusl() {
13
8
  // For Node 10
14
- if (!process.report || typeof process.report.getReport !== 'function') {
9
+ if (!process.report || typeof process.report.getReport !== "function") {
15
10
  try {
16
- const lddPath = require('child_process').execSync('which ldd').toString().trim();
11
+ const lddPath = require("child_process")
12
+ .execSync("which ldd")
13
+ .toString()
14
+ .trim();
17
15
 
18
- return readFileSync(lddPath, 'utf8').includes('musl');
16
+ return readFileSync(lddPath, "utf8").includes("musl");
19
17
  } catch (e) {
20
18
  return true;
21
19
  }
22
20
  } else {
23
- const {
24
- glibcVersionRuntime
25
- } = process.report.getReport().header;
21
+ const { glibcVersionRuntime } = process.report.getReport().header;
26
22
  return !glibcVersionRuntime;
27
23
  }
28
24
  }
29
25
 
30
26
  switch (platform) {
31
- case 'android':
27
+ case "android":
32
28
  throw new Error(`Unsupported architecture on Android ${arch}`);
33
29
 
34
- case 'win32':
30
+ case "win32":
35
31
  switch (arch) {
36
- case 'x64':
32
+ case "x64":
37
33
  try {
38
- nativeBinding = require('@ossiana/node-libcurl-win32-x64-msvc');
34
+ nativeBinding = require("@ossiana/node-libcurl-win32-x64-msvc");
39
35
  } catch (e) {
40
36
  loadError = e;
41
37
  }
@@ -48,34 +44,43 @@ switch (platform) {
48
44
 
49
45
  break;
50
46
 
51
- case 'darwin':
47
+ case "darwin":
52
48
  switch (arch) {
53
- case 'x64':
49
+ case "x64":
54
50
  try {
55
- nativeBinding = require('@ossiana/node-libcurl-darwin-x64');
51
+ nativeBinding = require("@ossiana/node-libcurl-darwin-x64");
56
52
  } catch (e) {
57
53
  loadError = e;
58
54
  }
59
55
 
60
56
  break;
57
+ case "arm64":
58
+ try {
59
+ nativeBinding = require("@ossiana/node-libcurl-darwin-arm64");
60
+ } catch (e) {
61
+ loadError = e;
62
+ }
61
63
 
64
+ break;
62
65
  default:
63
66
  throw new Error(`Unsupported architecture on macOS: ${arch}`);
64
67
  }
65
68
 
66
69
  break;
67
70
 
68
- case 'freebsd':
71
+ case "freebsd":
69
72
  throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
70
73
 
71
- case 'linux':
74
+ case "linux":
72
75
  switch (arch) {
73
- case 'x64':
76
+ case "x64":
74
77
  if (isMusl()) {
75
- throw new Error(`Unsupported architecture on Linux: ${arch} musl`);
78
+ throw new Error(
79
+ `Unsupported architecture on Linux: ${arch} musl`,
80
+ );
76
81
  } else {
77
82
  try {
78
- nativeBinding = require('@ossiana/node-libcurl-linux-x64-gnu');
83
+ nativeBinding = require("@ossiana/node-libcurl-linux-x64-gnu");
79
84
  } catch (e) {
80
85
  loadError = e;
81
86
  }
@@ -101,4 +106,4 @@ if (!nativeBinding) {
101
106
  throw new Error(`Failed to load native binding`);
102
107
  }
103
108
 
104
- module.exports = nativeBinding;
109
+ module.exports = nativeBinding;