muhammara 2.2.0 → 2.5.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.
- package/CHANGELOG.md +30 -1
- package/README.md +2 -2
- package/muhammara.d.ts +258 -241
- package/muhammara.js +1 -1
- package/node_modules/@mapbox/node-pre-gyp/CHANGELOG.md +4 -0
- package/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js +1 -1
- package/node_modules/@mapbox/node-pre-gyp/package.json +10 -10
- package/node_modules/concat-map/package.json +1 -1
- package/node_modules/console-control-strings/package.json +1 -1
- package/node_modules/debug/README.md +3 -0
- package/node_modules/debug/package.json +5 -5
- package/node_modules/debug/src/common.js +1 -1
- package/node_modules/delegates/package.json +1 -1
- package/node_modules/detect-libc/README.md +124 -42
- package/node_modules/detect-libc/index.d.ts +11 -0
- package/node_modules/detect-libc/lib/detect-libc.js +166 -80
- package/node_modules/detect-libc/lib/process.js +16 -0
- package/node_modules/detect-libc/package.json +20 -19
- package/node_modules/fs.realpath/package.json +1 -1
- package/node_modules/glob/common.js +2 -0
- package/node_modules/glob/glob.js +4 -1
- package/node_modules/glob/package.json +9 -6
- package/node_modules/glob/sync.js +6 -3
- package/node_modules/has-unicode/package.json +1 -1
- package/node_modules/https-proxy-agent/dist/agent.js +2 -5
- package/node_modules/https-proxy-agent/dist/agent.js.map +1 -1
- package/node_modules/https-proxy-agent/package.json +5 -5
- package/node_modules/inflight/package.json +1 -1
- package/node_modules/minimatch/package.json +5 -5
- package/node_modules/minipass/LICENSE +1 -1
- package/node_modules/minipass/README.md +122 -7
- package/node_modules/minipass/index.d.ts +149 -0
- package/node_modules/minipass/index.js +191 -102
- package/node_modules/minipass/package.json +23 -7
- package/node_modules/node-fetch/package.json +5 -5
- package/node_modules/object-assign/package.json +1 -1
- package/node_modules/once/package.json +1 -1
- package/node_modules/path-is-absolute/package.json +1 -1
- package/node_modules/semver/README.md +3 -1
- package/node_modules/semver/bin/semver.js +19 -9
- package/node_modules/semver/classes/comparator.js +3 -2
- package/node_modules/semver/classes/index.js +1 -1
- package/node_modules/semver/classes/range.js +31 -22
- package/node_modules/semver/classes/semver.js +1 -1
- package/node_modules/semver/functions/cmp.js +8 -4
- package/node_modules/semver/functions/coerce.js +3 -2
- package/node_modules/semver/functions/inc.js +4 -1
- package/node_modules/semver/functions/parse.js +1 -1
- package/node_modules/semver/internal/constants.js +2 -2
- package/node_modules/semver/internal/identifiers.js +1 -1
- package/node_modules/semver/internal/parse-options.js +3 -3
- package/node_modules/semver/internal/re.js +3 -3
- package/node_modules/semver/package.json +46 -13
- package/node_modules/semver/ranges/min-version.js +2 -1
- package/node_modules/semver/ranges/outside.js +1 -1
- package/node_modules/semver/ranges/simplify.js +15 -12
- package/node_modules/semver/ranges/subset.js +53 -31
- package/node_modules/set-blocking/package.json +1 -1
- package/node_modules/tr46/package.json +1 -1
- package/node_modules/util-deprecate/package.json +1 -1
- package/node_modules/webidl-conversions/package.json +1 -1
- package/node_modules/whatwg-url/package.json +1 -1
- package/node_modules/wrappy/package.json +1 -1
- package/package.json +2 -1
- package/src/DocumentCopyingContextDriver.cpp +15 -15
- package/src/ObjectsContextDriver.cpp +1 -1
- package/node_modules/detect-libc/.npmignore +0 -7
- package/node_modules/detect-libc/bin/detect-libc.js +0 -18
- package/node_modules/semver/CHANGELOG.md +0 -111
package/muhammara.js
CHANGED
|
@@ -15,7 +15,7 @@ muhammara.PDFWriter.prototype.getEvents = function() {
|
|
|
15
15
|
return this.events;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
muhammara.PDFWriter.prototype.triggerDocumentExtensionEvent = function(eventName,eventParams) {
|
|
18
|
+
muhammara.PDFWriter.prototype.triggerDocumentExtensionEvent = function(eventName, eventParams) {
|
|
19
19
|
eventParams.writer = this;
|
|
20
20
|
this.getEvents().emit(eventName,eventParams);
|
|
21
21
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# node-pre-gyp changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.9
|
|
4
|
+
- Upgraded node-fetch to 2.6.7 to address [CVE-2022-0235](https://www.cve.org/CVERecord?id=CVE-2022-0235)
|
|
5
|
+
- Upgraded detect-libc to 2.0.0 to use non-blocking NodeJS(>=12) Report API
|
|
6
|
+
|
|
3
7
|
## 1.0.8
|
|
4
8
|
- Downgraded npmlog to maintain node v10 and v8 support (https://github.com/mapbox/node-pre-gyp/pull/624)
|
|
5
9
|
|
|
@@ -302,7 +302,7 @@ module.exports.evaluate = function(package_json, options, napi_build_version) {
|
|
|
302
302
|
target_platform: options.target_platform || process.platform,
|
|
303
303
|
arch: options.target_arch || process.arch,
|
|
304
304
|
target_arch: options.target_arch || process.arch,
|
|
305
|
-
libc: options.target_libc || detect_libc.
|
|
305
|
+
libc: options.target_libc || detect_libc.familySync() || 'unknown',
|
|
306
306
|
module_main: package_json.main,
|
|
307
307
|
toolset: options.toolset || '', // address https://github.com/mapbox/node-pre-gyp/issues/119
|
|
308
308
|
bucket: package_json.binary.bucket,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@mapbox/node-pre-gyp@^1.0.5",
|
|
3
|
-
"_id": "@mapbox/node-pre-gyp@1.0.
|
|
3
|
+
"_id": "@mapbox/node-pre-gyp@1.0.9",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-aDF3S3rK9Q2gey/WAttUlISduDItz5BU3306M9Eyv6/oS40aMprnopshtlKTykxRNIBEZuRMaZAnbrQ4QtKGyw==",
|
|
6
6
|
"_location": "/@mapbox/node-pre-gyp",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"_requiredBy": [
|
|
20
20
|
"/"
|
|
21
21
|
],
|
|
22
|
-
"_resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.
|
|
23
|
-
"_shasum": "
|
|
22
|
+
"_resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.9.tgz",
|
|
23
|
+
"_shasum": "09a8781a3a036151cdebbe8719d6f8b25d4058bc",
|
|
24
24
|
"_spec": "@mapbox/node-pre-gyp@^1.0.5",
|
|
25
25
|
"_where": "/home/runner/work/MuhammaraJS/MuhammaraJS",
|
|
26
26
|
"author": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
},
|
|
36
36
|
"bundleDependencies": false,
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"detect-libc": "^
|
|
38
|
+
"detect-libc": "^2.0.0",
|
|
39
39
|
"https-proxy-agent": "^5.0.0",
|
|
40
40
|
"make-dir": "^3.1.0",
|
|
41
|
-
"node-fetch": "^2.6.
|
|
41
|
+
"node-fetch": "^2.6.7",
|
|
42
42
|
"nopt": "^5.0.0",
|
|
43
43
|
"npmlog": "^5.0.1",
|
|
44
44
|
"rimraf": "^3.0.2",
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@mapbox/cloudfriend": "^5.1.0",
|
|
52
52
|
"@mapbox/eslint-config-mapbox": "^3.0.0",
|
|
53
|
-
"aws-sdk": "^2.
|
|
53
|
+
"aws-sdk": "^2.1087.0",
|
|
54
54
|
"codecov": "^3.8.3",
|
|
55
55
|
"eslint": "^7.32.0",
|
|
56
56
|
"eslint-plugin-node": "^11.1.0",
|
|
57
57
|
"mock-aws-s3": "^4.0.2",
|
|
58
58
|
"nock": "^12.0.3",
|
|
59
|
-
"node-addon-api": "^4.
|
|
59
|
+
"node-addon-api": "^4.3.0",
|
|
60
60
|
"nyc": "^15.1.0",
|
|
61
|
-
"tape": "^5.
|
|
61
|
+
"tape": "^5.5.2",
|
|
62
62
|
"tar-fs": "^2.1.1"
|
|
63
63
|
},
|
|
64
64
|
"homepage": "https://github.com/mapbox/node-pre-gyp#readme",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"update-crosswalk": "node scripts/abi_crosswalk.js",
|
|
94
94
|
"upload-coverage": "nyc report --reporter json && codecov --clear --flags=unit --file=./coverage/coverage-final.json"
|
|
95
95
|
},
|
|
96
|
-
"version": "1.0.
|
|
96
|
+
"version": "1.0.9"
|
|
97
97
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"_from": "concat-map@0.0.1",
|
|
3
3
|
"_id": "concat-map@0.0.1",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "
|
|
5
|
+
"_integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
|
|
6
6
|
"_location": "/concat-map",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"_from": "console-control-strings@^1.1.0",
|
|
3
3
|
"_id": "console-control-strings@1.1.0",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "
|
|
5
|
+
"_integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
|
|
6
6
|
"_location": "/console-control-strings",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -241,6 +241,9 @@ setInterval(function(){
|
|
|
241
241
|
}, 1200);
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
+
In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_.
|
|
245
|
+
|
|
246
|
+
<img width="647" src="https://user-images.githubusercontent.com/7143133/152083257-29034707-c42c-4959-8add-3cee850e6fcf.png">
|
|
244
247
|
|
|
245
248
|
## Output streams
|
|
246
249
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "debug@4",
|
|
3
|
-
"_id": "debug@4.3.
|
|
3
|
+
"_id": "debug@4.3.4",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512
|
|
5
|
+
"_integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
|
6
6
|
"_location": "/debug",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"/agent-base",
|
|
20
20
|
"/https-proxy-agent"
|
|
21
21
|
],
|
|
22
|
-
"_resolved": "https://registry.npmjs.org/debug/-/debug-4.3.
|
|
23
|
-
"_shasum": "
|
|
22
|
+
"_resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
|
23
|
+
"_shasum": "1319f6579357f2338d3337d2cdd4914bb5dcc865",
|
|
24
24
|
"_spec": "debug@4",
|
|
25
25
|
"_where": "/home/runner/work/MuhammaraJS/MuhammaraJS/node_modules/https-proxy-agent",
|
|
26
26
|
"author": {
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"test:coverage": "cat ./coverage/lcov.info | coveralls",
|
|
99
99
|
"test:node": "istanbul cover _mocha -- test.js"
|
|
100
100
|
},
|
|
101
|
-
"version": "4.3.
|
|
101
|
+
"version": "4.3.4"
|
|
102
102
|
}
|
|
@@ -179,7 +179,7 @@ function setup(env) {
|
|
|
179
179
|
namespaces = split[i].replace(/\*/g, '.*?');
|
|
180
180
|
|
|
181
181
|
if (namespaces[0] === '-') {
|
|
182
|
-
createDebug.skips.push(new RegExp('^' + namespaces.
|
|
182
|
+
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
183
183
|
} else {
|
|
184
184
|
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
185
185
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"_from": "delegates@^1.0.0",
|
|
3
3
|
"_id": "delegates@1.0.0",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "
|
|
5
|
+
"_integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
|
|
6
6
|
"_location": "/delegates",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
# detect-libc
|
|
2
2
|
|
|
3
|
-
Node.js module to detect the C standard library (libc)
|
|
4
|
-
|
|
3
|
+
Node.js module to detect details of the C standard library (libc)
|
|
4
|
+
implementation provided by a given Linux system.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
[prebuild](https://www.npmjs.com/package/prebuild),
|
|
8
|
-
[prebuild-ci](https://www.npmjs.com/package/prebuild-ci) and
|
|
9
|
-
[prebuild-install](https://www.npmjs.com/package/prebuild-install),
|
|
10
|
-
therefore allowing build and provision of pre-compiled binaries
|
|
11
|
-
for musl-based Linux e.g. Alpine as well as glibc-based.
|
|
6
|
+
Currently supports detection of GNU glibc and MUSL libc.
|
|
12
7
|
|
|
13
|
-
|
|
8
|
+
Provides asychronous and synchronous functions for the
|
|
9
|
+
family (e.g. `glibc`, `musl`) and version (e.g. `1.23`, `1.2.3`).
|
|
10
|
+
|
|
11
|
+
For previous v1.x releases, please see the
|
|
12
|
+
[v1](https://github.com/lovell/detect-libc/tree/v1) branch.
|
|
14
13
|
|
|
15
14
|
## Install
|
|
16
15
|
|
|
@@ -18,54 +17,137 @@ Currently supports libc detection of `glibc` and `musl`.
|
|
|
18
17
|
npm install detect-libc
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
##
|
|
20
|
+
## API
|
|
21
|
+
|
|
22
|
+
### GLIBC
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
const GLIBC: string = 'glibc';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
A String constant containing the value `glibc`.
|
|
29
|
+
|
|
30
|
+
### MUSL
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
const MUSL: string = 'musl';
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
A String constant containing the value `musl`.
|
|
37
|
+
|
|
38
|
+
### family
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
function family(): Promise<string | null>;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Resolves asychronously with:
|
|
22
45
|
|
|
23
|
-
|
|
46
|
+
* `glibc` or `musl` when the libc family can be determined
|
|
47
|
+
* `null` when the libc family cannot be determined
|
|
48
|
+
* `null` when run on a non-Linux platform
|
|
24
49
|
|
|
25
50
|
```js
|
|
26
|
-
const {
|
|
51
|
+
const { family, GLIBC, MUSL } = require('detect-libc');
|
|
52
|
+
|
|
53
|
+
switch (await family()) {
|
|
54
|
+
case GLIBC: ...
|
|
55
|
+
case MUSL: ...
|
|
56
|
+
case null: ...
|
|
57
|
+
}
|
|
27
58
|
```
|
|
28
59
|
|
|
29
|
-
|
|
30
|
-
* `MUSL` is a String containing the value "musl" for comparison with `family`.
|
|
31
|
-
* `family` is a String representing the system libc family.
|
|
32
|
-
* `version` is a String representing the system libc version number.
|
|
33
|
-
* `isNonGlibcLinux` is a Boolean representing whether the system is a non-glibc Linux, e.g. Alpine.
|
|
60
|
+
### familySync
|
|
34
61
|
|
|
35
|
-
|
|
62
|
+
```ts
|
|
63
|
+
function familySync(): string | null;
|
|
64
|
+
```
|
|
36
65
|
|
|
37
|
-
|
|
38
|
-
the child command will be run with the `LIBC` environment variable
|
|
39
|
-
set to the relevant value.
|
|
66
|
+
Synchronous version of `family()`.
|
|
40
67
|
|
|
41
|
-
|
|
68
|
+
```js
|
|
69
|
+
const { familySync, GLIBC, MUSL } = require('detect-libc');
|
|
42
70
|
|
|
43
|
-
|
|
71
|
+
switch (familySync()) {
|
|
72
|
+
case GLIBC: ...
|
|
73
|
+
case MUSL: ...
|
|
74
|
+
case null: ...
|
|
75
|
+
}
|
|
76
|
+
```
|
|
44
77
|
|
|
45
|
-
|
|
46
|
-
|
|
78
|
+
### version
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
function version(): Promise<string | null>;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Resolves asychronously with:
|
|
85
|
+
|
|
86
|
+
* The version when it can be determined
|
|
87
|
+
* `null` when the libc family cannot be determined
|
|
88
|
+
* `null` when run on a non-Linux platform
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
const { version } = require('detect-libc');
|
|
92
|
+
|
|
93
|
+
const v = await version();
|
|
94
|
+
if (v) {
|
|
95
|
+
const [major, minor, patch] = v.split('.');
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### versionSync
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
function versionSync(): string | null;
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Synchronous version of `version()`.
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
const { versionSync } = require('detect-libc');
|
|
109
|
+
|
|
110
|
+
const v = versionSync();
|
|
111
|
+
if (v) {
|
|
112
|
+
const [major, minor, patch] = v.split('.');
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### isNonGlibcLinux
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
function isNonGlibcLinux(): Promise<boolean>;
|
|
47
120
|
```
|
|
48
121
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
122
|
+
Resolves asychronously with:
|
|
123
|
+
|
|
124
|
+
* `false` when the libc family is `glibc`
|
|
125
|
+
* `true` when the libc family is not `glibc`
|
|
126
|
+
* `false` when run on a non-Linux platform
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
const { isNonGlibcLinux } = require('detect-libc');
|
|
130
|
+
|
|
131
|
+
if (await isNonGlibcLinux()) { ... }
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### isNonGlibcLinuxSync
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
function isNonGlibcLinuxSync(): boolean;
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Synchronous version of `isNonGlibcLinux()`.
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
const { isNonGlibcLinuxSync } = require('detect-libc');
|
|
144
|
+
|
|
145
|
+
if (isNonGlibcLinuxSync()) { ... }
|
|
64
146
|
```
|
|
65
147
|
|
|
66
|
-
##
|
|
148
|
+
## Licensing
|
|
67
149
|
|
|
68
|
-
Copyright 2017 Lovell Fuller
|
|
150
|
+
Copyright 2017, 2022 Lovell Fuller
|
|
69
151
|
|
|
70
152
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
71
153
|
you may not use this file except in compliance with the License.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const GLIBC: 'glibc';
|
|
2
|
+
export const MUSL: 'musl';
|
|
3
|
+
|
|
4
|
+
export function family(): Promise<string | null>;
|
|
5
|
+
export function familySync(): string | null;
|
|
6
|
+
|
|
7
|
+
export function isNonGlibcLinux(): Promise<boolean>;
|
|
8
|
+
export function isNonGlibcLinuxSync(): boolean;
|
|
9
|
+
|
|
10
|
+
export function version(): Promise<string | null>;
|
|
11
|
+
export function versionSync(): string | null;
|
|
@@ -1,92 +1,178 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var readdirSync = require('fs').readdirSync;
|
|
3
|
+
const childProcess = require('child_process');
|
|
4
|
+
const { isLinux, getReport } = require('./process');
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const command = 'getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true';
|
|
7
|
+
let commandOut = '';
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const safeCommand = () => {
|
|
10
|
+
if (!commandOut) {
|
|
11
|
+
return new Promise((resolve) => {
|
|
12
|
+
childProcess.exec(command, (err, out) => {
|
|
13
|
+
commandOut = err ? ' ' : out;
|
|
14
|
+
resolve(commandOut);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return commandOut;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const safeCommandSync = () => {
|
|
22
|
+
if (!commandOut) {
|
|
23
|
+
try {
|
|
24
|
+
commandOut = childProcess.execSync(command, { encoding: 'utf8' });
|
|
25
|
+
} catch (_err) {
|
|
26
|
+
commandOut = ' ';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return commandOut;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A String constant containing the value `glibc`.
|
|
34
|
+
* @type {string}
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
const GLIBC = 'glibc';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A String constant containing the value `musl`.
|
|
41
|
+
* @type {string}
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
const MUSL = 'musl';
|
|
45
|
+
|
|
46
|
+
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-');
|
|
47
|
+
|
|
48
|
+
const familyFromReport = () => {
|
|
49
|
+
const report = getReport();
|
|
50
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
51
|
+
return GLIBC;
|
|
52
|
+
}
|
|
53
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
54
|
+
if (report.sharedObjects.some(isFileMusl)) {
|
|
55
|
+
return MUSL;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const familyFromCommand = (out) => {
|
|
62
|
+
const [getconf, ldd1] = out.split(/[\r\n]+/);
|
|
63
|
+
if (getconf && getconf.includes(GLIBC)) {
|
|
64
|
+
return GLIBC;
|
|
65
|
+
}
|
|
66
|
+
if (ldd1 && ldd1.includes(MUSL)) {
|
|
67
|
+
return MUSL;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
13
70
|
};
|
|
14
71
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function versionFromMuslLdd (out) {
|
|
28
|
-
return out.split(/[\r\n]+/)[1].trim().split(/\s/)[1];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function safeReaddirSync (path) {
|
|
32
|
-
try {
|
|
33
|
-
return readdirSync(path);
|
|
34
|
-
} catch (e) {}
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var family = '';
|
|
39
|
-
var version = '';
|
|
40
|
-
var method = '';
|
|
41
|
-
|
|
42
|
-
if (platform === 'linux') {
|
|
43
|
-
// Try getconf
|
|
44
|
-
var glibc = spawnSync('getconf', ['GNU_LIBC_VERSION'], spawnOptions);
|
|
45
|
-
if (glibc.status === 0) {
|
|
46
|
-
family = GLIBC;
|
|
47
|
-
version = glibc.stdout.trim().split(' ')[1];
|
|
48
|
-
method = 'getconf';
|
|
49
|
-
} else {
|
|
50
|
-
// Try ldd
|
|
51
|
-
var ldd = spawnSync('ldd', ['--version'], spawnOptions);
|
|
52
|
-
if (ldd.status === 0 && ldd.stdout.indexOf(MUSL) !== -1) {
|
|
53
|
-
family = MUSL;
|
|
54
|
-
version = versionFromMuslLdd(ldd.stdout);
|
|
55
|
-
method = 'ldd';
|
|
56
|
-
} else if (ldd.status === 1 && ldd.stderr.indexOf(MUSL) !== -1) {
|
|
57
|
-
family = MUSL;
|
|
58
|
-
version = versionFromMuslLdd(ldd.stderr);
|
|
59
|
-
method = 'ldd';
|
|
60
|
-
} else {
|
|
61
|
-
// Try filesystem (family only)
|
|
62
|
-
var lib = safeReaddirSync('/lib');
|
|
63
|
-
if (lib.some(contains('-linux-gnu'))) {
|
|
64
|
-
family = GLIBC;
|
|
65
|
-
method = 'filesystem';
|
|
66
|
-
} else if (lib.some(contains('libc.musl-'))) {
|
|
67
|
-
family = MUSL;
|
|
68
|
-
method = 'filesystem';
|
|
69
|
-
} else if (lib.some(contains('ld-musl-'))) {
|
|
70
|
-
family = MUSL;
|
|
71
|
-
method = 'filesystem';
|
|
72
|
-
} else {
|
|
73
|
-
var usrSbin = safeReaddirSync('/usr/sbin');
|
|
74
|
-
if (usrSbin.some(contains('glibc'))) {
|
|
75
|
-
family = GLIBC;
|
|
76
|
-
method = 'filesystem';
|
|
77
|
-
}
|
|
78
|
-
}
|
|
72
|
+
/**
|
|
73
|
+
* Resolves with the libc family when it can be determined, `null` otherwise.
|
|
74
|
+
* @returns {Promise<?string>}
|
|
75
|
+
*/
|
|
76
|
+
const family = async () => {
|
|
77
|
+
let family = null;
|
|
78
|
+
if (isLinux()) {
|
|
79
|
+
family = familyFromReport();
|
|
80
|
+
if (!family) {
|
|
81
|
+
const out = await safeCommand();
|
|
82
|
+
family = familyFromCommand(out);
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
|
-
|
|
85
|
+
return family;
|
|
86
|
+
};
|
|
82
87
|
|
|
83
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Returns the libc family when it can be determined, `null` otherwise.
|
|
90
|
+
* @returns {?string}
|
|
91
|
+
*/
|
|
92
|
+
const familySync = () => {
|
|
93
|
+
let family = null;
|
|
94
|
+
if (isLinux()) {
|
|
95
|
+
family = familyFromReport();
|
|
96
|
+
if (!family) {
|
|
97
|
+
const out = safeCommandSync();
|
|
98
|
+
family = familyFromCommand(out);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return family;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Resolves `true` only when the platform is Linux and the libc family is not `glibc`.
|
|
106
|
+
* @returns {Promise<boolean>}
|
|
107
|
+
*/
|
|
108
|
+
const isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Returns `true` only when the platform is Linux and the libc family is not `glibc`.
|
|
112
|
+
* @returns {boolean}
|
|
113
|
+
*/
|
|
114
|
+
const isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC;
|
|
115
|
+
|
|
116
|
+
const versionFromReport = () => {
|
|
117
|
+
const report = getReport();
|
|
118
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
119
|
+
return report.header.glibcVersionRuntime;
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const versionSuffix = (s) => s.trim().split(/\s+/)[1];
|
|
125
|
+
|
|
126
|
+
const versionFromCommand = (out) => {
|
|
127
|
+
const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
|
|
128
|
+
if (getconf && getconf.includes(GLIBC)) {
|
|
129
|
+
return versionSuffix(getconf);
|
|
130
|
+
}
|
|
131
|
+
if (ldd1 && ldd2 && ldd1.includes(MUSL)) {
|
|
132
|
+
return versionSuffix(ldd2);
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Resolves with the libc version when it can be determined, `null` otherwise.
|
|
139
|
+
* @returns {Promise<?string>}
|
|
140
|
+
*/
|
|
141
|
+
const version = async () => {
|
|
142
|
+
let version = null;
|
|
143
|
+
if (isLinux()) {
|
|
144
|
+
version = versionFromReport();
|
|
145
|
+
if (!version) {
|
|
146
|
+
const out = await safeCommand();
|
|
147
|
+
version = versionFromCommand(out);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return version;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Returns the libc version when it can be determined, `null` otherwise.
|
|
155
|
+
* @returns {?string}
|
|
156
|
+
*/
|
|
157
|
+
const versionSync = () => {
|
|
158
|
+
let version = null;
|
|
159
|
+
if (isLinux()) {
|
|
160
|
+
version = versionFromReport();
|
|
161
|
+
if (!version) {
|
|
162
|
+
const out = safeCommandSync();
|
|
163
|
+
version = versionFromCommand(out);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return version;
|
|
167
|
+
};
|
|
84
168
|
|
|
85
169
|
module.exports = {
|
|
86
|
-
GLIBC
|
|
87
|
-
MUSL
|
|
88
|
-
family
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
170
|
+
GLIBC,
|
|
171
|
+
MUSL,
|
|
172
|
+
family,
|
|
173
|
+
familySync,
|
|
174
|
+
isNonGlibcLinux,
|
|
175
|
+
isNonGlibcLinuxSync,
|
|
176
|
+
version,
|
|
177
|
+
versionSync
|
|
92
178
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const isLinux = () => process.platform === 'linux';
|
|
4
|
+
|
|
5
|
+
let report = null;
|
|
6
|
+
const getReport = () => {
|
|
7
|
+
if (!report) {
|
|
8
|
+
/* istanbul ignore next */
|
|
9
|
+
report = isLinux() && process.report
|
|
10
|
+
? process.report.getReport()
|
|
11
|
+
: {};
|
|
12
|
+
}
|
|
13
|
+
return report;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
module.exports = { isLinux, getReport };
|