@abtnode/util 1.8.27 → 1.8.29
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/lib/axios.js +33 -3
- package/lib/get-folder-size.js +16 -1
- package/package.json +14 -12
package/lib/axios.js
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const axios = require('axios').default;
|
|
2
|
+
const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent');
|
|
3
|
+
|
|
4
|
+
function proxyInterceptor(config) {
|
|
5
|
+
/* istanbul ignore if */
|
|
6
|
+
if (config.socketPath != null) return config;
|
|
7
|
+
|
|
8
|
+
const { proxy } = config;
|
|
9
|
+
|
|
10
|
+
/* istanbul ignore if */
|
|
11
|
+
if (proxy === false) return config;
|
|
12
|
+
|
|
13
|
+
const httpProxyUrl = process.env.HTTP_PROXY || process.env.http_proxy;
|
|
14
|
+
const httpsProxyUrl = process.env.HTTPS_PROXY || process.env.https_proxy;
|
|
15
|
+
|
|
16
|
+
const proxyOptions = Object.assign(
|
|
17
|
+
{ keepAlive: true, keepAliveMsecs: 1000, maxSockets: 256, maxFreeSockets: 256 },
|
|
18
|
+
config.proxyOptions || {}
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
if (httpProxyUrl) {
|
|
22
|
+
config.proxy = false;
|
|
23
|
+
config.httpAgent = new HttpProxyAgent({ proxy: httpProxyUrl, ...proxyOptions });
|
|
24
|
+
}
|
|
25
|
+
if (httpsProxyUrl) {
|
|
26
|
+
config.proxy = false;
|
|
27
|
+
config.httpsAgent = new HttpsProxyAgent({ proxy: httpsProxyUrl, ...proxyOptions });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return config;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
axios.interceptors.request.use(proxyInterceptor);
|
|
4
34
|
|
|
5
35
|
module.exports = axios;
|
package/lib/get-folder-size.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
const getSize = require('get-folder-size');
|
|
1
2
|
const exec = require('child_process').execFile;
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
const getOnUnixLike = (dir) => {
|
|
4
5
|
const regex = /^(\d*)/;
|
|
5
6
|
|
|
6
7
|
return new Promise((resolve, reject) => {
|
|
@@ -16,3 +17,17 @@ module.exports = (dir) => {
|
|
|
16
17
|
});
|
|
17
18
|
});
|
|
18
19
|
};
|
|
20
|
+
|
|
21
|
+
const getOnWindows = (dir) => {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
getSize(dir, (err, size) => {
|
|
24
|
+
if (err) {
|
|
25
|
+
return reject(err);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return resolve(size);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
module.exports = process.platform === 'win32' ? getOnWindows : getOnUnixLike;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.
|
|
6
|
+
"version": "1.8.29",
|
|
7
7
|
"description": "ArcBlock's JavaScript utility",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@abtnode/constant": "1.8.
|
|
22
|
-
"@abtnode/logger": "1.8.
|
|
23
|
-
"@arcblock/jwt": "^1.17.
|
|
24
|
-
"@blocklet/constant": "1.8.
|
|
25
|
-
"@ocap/mcrypto": "1.17.
|
|
26
|
-
"@ocap/util": "1.17.
|
|
27
|
-
"@ocap/wallet": "1.17.
|
|
21
|
+
"@abtnode/constant": "1.8.29",
|
|
22
|
+
"@abtnode/logger": "1.8.29",
|
|
23
|
+
"@arcblock/jwt": "^1.17.23",
|
|
24
|
+
"@blocklet/constant": "1.8.29",
|
|
25
|
+
"@ocap/mcrypto": "1.17.23",
|
|
26
|
+
"@ocap/util": "1.17.23",
|
|
27
|
+
"@ocap/wallet": "1.17.23",
|
|
28
28
|
"axios": "^0.27.2",
|
|
29
29
|
"axios-mock-adapter": "^1.21.2",
|
|
30
30
|
"axon": "^2.0.3",
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
"flush-write-stream": "^2.0.0",
|
|
35
35
|
"folder-walker": "^3.2.0",
|
|
36
36
|
"form-data": "^4.0.0",
|
|
37
|
+
"get-folder-size": "^2.0.1",
|
|
37
38
|
"hasha": "^5.2.2",
|
|
39
|
+
"hpagent": "^1.1.0",
|
|
38
40
|
"internal-ip": "^6.2.0",
|
|
39
41
|
"is-docker": "^2.2.1",
|
|
40
42
|
"json-stable-stringify": "^1.0.1",
|
|
@@ -44,7 +46,7 @@
|
|
|
44
46
|
"public-ip": "^4.0.4",
|
|
45
47
|
"pump": "^3.0.0",
|
|
46
48
|
"read-last-lines": "^1.8.0",
|
|
47
|
-
"semver": "^7.3.
|
|
49
|
+
"semver": "^7.3.8",
|
|
48
50
|
"semver-sort": "^1.0.0",
|
|
49
51
|
"shelljs": "^0.8.5",
|
|
50
52
|
"stream-to-promise": "^3.0.0",
|
|
@@ -56,10 +58,10 @@
|
|
|
56
58
|
"which": "^2.0.2"
|
|
57
59
|
},
|
|
58
60
|
"devDependencies": {
|
|
59
|
-
"detect-port": "^1.
|
|
60
|
-
"express": "^4.18.
|
|
61
|
+
"detect-port": "^1.5.1",
|
|
62
|
+
"express": "^4.18.2",
|
|
61
63
|
"fs-extra": "^10.1.0",
|
|
62
64
|
"jest": "^27.5.1"
|
|
63
65
|
},
|
|
64
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "ee52d838f0cf97e551d53a6509cb0da7e5f31978"
|
|
65
67
|
}
|