node-abi 2.19.1 → 2.21.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/.github/workflows/update-abi.yml +1 -1
- package/abi_registry.json +57 -43
- package/index.js +17 -4
- package/package.json +1 -1
- package/scripts/update-abi-registry.js +68 -48
- package/test/index.js +11 -1
package/abi_registry.json
CHANGED
|
@@ -6,87 +6,101 @@
|
|
|
6
6
|
"future": false,
|
|
7
7
|
"abi": "67"
|
|
8
8
|
},
|
|
9
|
-
{
|
|
10
|
-
"runtime": "electron",
|
|
11
|
-
"target": "5.0.0",
|
|
12
|
-
"lts": false,
|
|
13
|
-
"future": false,
|
|
14
|
-
"abi": "70"
|
|
15
|
-
},
|
|
16
9
|
{
|
|
17
10
|
"runtime": "node",
|
|
18
11
|
"target": "12.0.0",
|
|
19
12
|
"lts": [
|
|
20
13
|
"2019-10-21",
|
|
21
|
-
"2020-
|
|
14
|
+
"2020-11-30"
|
|
22
15
|
],
|
|
23
16
|
"future": false,
|
|
24
|
-
"abi": "
|
|
17
|
+
"abi": "72"
|
|
25
18
|
},
|
|
26
19
|
{
|
|
27
|
-
"runtime": "
|
|
28
|
-
"target": "
|
|
20
|
+
"runtime": "node",
|
|
21
|
+
"target": "13.0.0",
|
|
29
22
|
"lts": false,
|
|
30
23
|
"future": false,
|
|
31
|
-
"abi": "
|
|
24
|
+
"abi": "79"
|
|
32
25
|
},
|
|
33
26
|
{
|
|
34
|
-
"runtime": "
|
|
35
|
-
"target": "
|
|
36
|
-
"lts":
|
|
27
|
+
"runtime": "node",
|
|
28
|
+
"target": "14.0.0",
|
|
29
|
+
"lts": [
|
|
30
|
+
"2020-10-27",
|
|
31
|
+
"2021-10-19"
|
|
32
|
+
],
|
|
37
33
|
"future": false,
|
|
38
|
-
"abi": "
|
|
34
|
+
"abi": "83"
|
|
39
35
|
},
|
|
40
36
|
{
|
|
41
|
-
"runtime": "
|
|
42
|
-
"target": "
|
|
37
|
+
"runtime": "node",
|
|
38
|
+
"target": "15.0.0",
|
|
43
39
|
"lts": false,
|
|
44
40
|
"future": false,
|
|
45
|
-
"abi": "
|
|
41
|
+
"abi": "88"
|
|
46
42
|
},
|
|
47
43
|
{
|
|
48
|
-
"
|
|
49
|
-
"target": "13.0.0",
|
|
50
|
-
"lts": false,
|
|
44
|
+
"abi": "70",
|
|
51
45
|
"future": false,
|
|
52
|
-
"
|
|
46
|
+
"lts": false,
|
|
47
|
+
"runtime": "electron",
|
|
48
|
+
"target": "5.0.0-beta.9"
|
|
53
49
|
},
|
|
54
50
|
{
|
|
55
|
-
"
|
|
56
|
-
"target": "9.0.0",
|
|
57
|
-
"lts": false,
|
|
51
|
+
"abi": "73",
|
|
58
52
|
"future": false,
|
|
59
|
-
"
|
|
53
|
+
"lts": false,
|
|
54
|
+
"runtime": "electron",
|
|
55
|
+
"target": "6.0.0-beta.1"
|
|
60
56
|
},
|
|
61
57
|
{
|
|
62
|
-
"
|
|
63
|
-
"target": "14.0.0",
|
|
64
|
-
"lts": [
|
|
65
|
-
"2020-10-27",
|
|
66
|
-
"2021-10-19"
|
|
67
|
-
],
|
|
58
|
+
"abi": "75",
|
|
68
59
|
"future": false,
|
|
69
|
-
"
|
|
60
|
+
"lts": false,
|
|
61
|
+
"runtime": "electron",
|
|
62
|
+
"target": "7.0.0-beta.1"
|
|
70
63
|
},
|
|
71
64
|
{
|
|
65
|
+
"abi": "76",
|
|
66
|
+
"future": false,
|
|
67
|
+
"lts": false,
|
|
72
68
|
"runtime": "electron",
|
|
73
|
-
"target": "
|
|
69
|
+
"target": "8.0.0-beta.1"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"abi": "80",
|
|
73
|
+
"future": false,
|
|
74
74
|
"lts": false,
|
|
75
|
-
"
|
|
76
|
-
"
|
|
75
|
+
"runtime": "electron",
|
|
76
|
+
"target": "9.0.0-beta.2"
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
|
-
"
|
|
80
|
-
"
|
|
79
|
+
"abi": "82",
|
|
80
|
+
"future": false,
|
|
81
81
|
"lts": false,
|
|
82
|
-
"
|
|
83
|
-
"
|
|
82
|
+
"runtime": "electron",
|
|
83
|
+
"target": "10.0.0-beta.1"
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
+
"abi": "85",
|
|
87
|
+
"future": false,
|
|
88
|
+
"lts": false,
|
|
86
89
|
"runtime": "electron",
|
|
87
|
-
"target": "11.0.0-beta.
|
|
90
|
+
"target": "11.0.0-beta.11"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"abi": "87",
|
|
94
|
+
"future": false,
|
|
88
95
|
"lts": false,
|
|
96
|
+
"runtime": "electron",
|
|
97
|
+
"target": "12.0.0-beta.1"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"abi": "89",
|
|
89
101
|
"future": true,
|
|
90
|
-
"
|
|
102
|
+
"lts": false,
|
|
103
|
+
"runtime": "electron",
|
|
104
|
+
"target": "13.0.0-beta.2"
|
|
91
105
|
}
|
|
92
106
|
]
|
package/index.js
CHANGED
|
@@ -43,11 +43,24 @@ function getTarget (abi, runtime) {
|
|
|
43
43
|
.map(function (t) {
|
|
44
44
|
return t.target
|
|
45
45
|
})
|
|
46
|
-
if (match.length)
|
|
46
|
+
if (match.length) {
|
|
47
|
+
var betaSeparatorIndex = match[0].indexOf("-")
|
|
48
|
+
return betaSeparatorIndex > -1
|
|
49
|
+
? match[0].substring(0, betaSeparatorIndex)
|
|
50
|
+
: match[0]
|
|
51
|
+
}
|
|
47
52
|
|
|
48
53
|
throw new Error('Could not detect target for abi ' + abi + ' and runtime ' + runtime)
|
|
49
54
|
}
|
|
50
55
|
|
|
56
|
+
function sortByTargetFn (a, b) {
|
|
57
|
+
var abiComp = Number(a.abi) - Number(b.abi)
|
|
58
|
+
if (abiComp !== 0) return abiComp
|
|
59
|
+
if (a.target < b.target) return -1
|
|
60
|
+
if (a.target > b.target) return 1
|
|
61
|
+
return 0
|
|
62
|
+
}
|
|
63
|
+
|
|
51
64
|
function loadGeneratedTargets () {
|
|
52
65
|
var registry = require('./abi_registry.json')
|
|
53
66
|
var targets = {
|
|
@@ -80,9 +93,9 @@ function loadGeneratedTargets () {
|
|
|
80
93
|
}
|
|
81
94
|
})
|
|
82
95
|
|
|
83
|
-
targets.supported.sort()
|
|
84
|
-
targets.additional.sort()
|
|
85
|
-
targets.future.sort()
|
|
96
|
+
targets.supported.sort(sortByTargetFn)
|
|
97
|
+
targets.additional.sort(sortByTargetFn)
|
|
98
|
+
targets.future.sort(sortByTargetFn)
|
|
86
99
|
|
|
87
100
|
return targets
|
|
88
101
|
}
|
package/package.json
CHANGED
|
@@ -8,8 +8,8 @@ async function getJSONFromCDN (urlPath) {
|
|
|
8
8
|
return JSON.parse(response.body)
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
async function
|
|
12
|
-
return (await getJSONFromCDN('electron/releases/lite.json'))
|
|
11
|
+
async function fetchElectronReleases () {
|
|
12
|
+
return (await getJSONFromCDN('electron/releases/lite.json'))
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
async function fetchNodeVersions () {
|
|
@@ -34,58 +34,78 @@ async function fetchNodeVersions () {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
async function fetchAbiVersions () {
|
|
37
|
-
return (await getJSONFromCDN('nodejs/node/doc/abi_version_registry.json'))
|
|
37
|
+
return (await getJSONFromCDN('nodejs/node/doc/abi_version_registry.json'))
|
|
38
|
+
.NODE_MODULE_VERSION
|
|
39
|
+
.filter(({ modules }) => modules > 66)
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
function electronReleasesToTargets (releases) {
|
|
43
|
+
const versions = releases.map(({ version }) => version)
|
|
44
|
+
const versionsByModules = releases
|
|
45
|
+
.filter(release => release.deps && Number(release.deps.modules) >= 70)
|
|
46
|
+
.map(({ version, deps: { modules } }) => ({
|
|
47
|
+
version,
|
|
48
|
+
modules,
|
|
49
|
+
}))
|
|
50
|
+
.reduce(
|
|
51
|
+
(acc, { modules, version }) => ({
|
|
52
|
+
...acc,
|
|
53
|
+
[modules]: version,
|
|
54
|
+
}),
|
|
55
|
+
{}
|
|
56
|
+
)
|
|
44
57
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
return Object.entries(versionsByModules)
|
|
59
|
+
.map(
|
|
60
|
+
([modules, version]) => ({
|
|
61
|
+
abi: modules,
|
|
62
|
+
future: !versions.find(
|
|
63
|
+
v => {
|
|
64
|
+
const major = version.split(".")[0]
|
|
65
|
+
return semver.satisfies(
|
|
66
|
+
v,
|
|
67
|
+
/^[0-9]/.test(major) ? `>= ${major}` : major
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
lts: false,
|
|
72
|
+
runtime: 'electron',
|
|
73
|
+
target: version
|
|
74
|
+
})
|
|
75
|
+
)
|
|
76
|
+
}
|
|
55
77
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} else {
|
|
64
|
-
target = {
|
|
65
|
-
runtime: abiVersion.runtime === 'nw.js' ? 'node-webkit' : abiVersion.runtime,
|
|
66
|
-
target: abiVersion.versions,
|
|
67
|
-
lts: false,
|
|
68
|
-
future: false
|
|
69
|
-
}
|
|
70
|
-
if (target.runtime === 'electron') {
|
|
71
|
-
target.target = `${target.target}.0.0`
|
|
72
|
-
const constraint = /^[0-9]/.test(abiVersion.versions) ? `>= ${abiVersion.versions}` : abiVersion.versions
|
|
73
|
-
if (!electronVersions.find(electronVersion => semver.satisfies(electronVersion, constraint))) {
|
|
74
|
-
target.target = `${target.target}-beta.1`
|
|
75
|
-
target.future = true
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
target.abi = abiVersion.modules.toString()
|
|
78
|
+
function nodeVersionsToTargets (abiVersions, nodeVersions) {
|
|
79
|
+
return Object.values(
|
|
80
|
+
abiVersions
|
|
81
|
+
.filter(({ runtime }) => runtime === 'node')
|
|
82
|
+
.reduce(
|
|
83
|
+
(acc, abiVersion) => {
|
|
84
|
+
const { version: nodeVersion } = semver.coerce(abiVersion.versions)
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
return {
|
|
87
|
+
[nodeVersion]: {
|
|
88
|
+
...nodeVersions[nodeVersion],
|
|
89
|
+
abi: abiVersion.modules.toString(),
|
|
90
|
+
},
|
|
91
|
+
...acc,
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
{}
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
}
|
|
85
98
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
99
|
+
async function main () {
|
|
100
|
+
const nodeVersions = await fetchNodeVersions()
|
|
101
|
+
const abiVersions = await fetchAbiVersions()
|
|
102
|
+
const electronReleases = await fetchElectronReleases()
|
|
103
|
+
const electronTargets = electronReleasesToTargets(electronReleases)
|
|
104
|
+
const nodeTargets = nodeVersionsToTargets(abiVersions, nodeVersions)
|
|
105
|
+
const supportedTargets = [
|
|
106
|
+
...nodeTargets,
|
|
107
|
+
...electronTargets,
|
|
108
|
+
]
|
|
89
109
|
|
|
90
110
|
await writeFile(path.resolve(__dirname, '..', 'abi_registry.json'), JSON.stringify(supportedTargets, null, 2))
|
|
91
111
|
}
|
package/test/index.js
CHANGED
|
@@ -26,6 +26,10 @@ test('getTarget calculates correct Node target', function (t) {
|
|
|
26
26
|
t.equal(getTarget('47'), '5.0.0')
|
|
27
27
|
t.equal(getTarget('48'), '6.0.0')
|
|
28
28
|
t.equal(getTarget('51'), '7.0.0')
|
|
29
|
+
t.equal(getTarget('67'), '11.0.0')
|
|
30
|
+
t.equal(getTarget('72'), '12.0.0')
|
|
31
|
+
t.equal(getTarget('83'), '14.0.0')
|
|
32
|
+
t.equal(getTarget('88'), '15.0.0')
|
|
29
33
|
t.end()
|
|
30
34
|
})
|
|
31
35
|
|
|
@@ -36,6 +40,7 @@ test('getTarget calculates correct Electron target', function (t) {
|
|
|
36
40
|
t.equal(getTarget('49', 'electron'), '1.3.0')
|
|
37
41
|
t.equal(getTarget('50', 'electron'), '1.4.0')
|
|
38
42
|
t.equal(getTarget('76', 'electron'), '8.0.0')
|
|
43
|
+
t.equal(getTarget('82', 'electron'), '10.0.0')
|
|
39
44
|
t.end()
|
|
40
45
|
})
|
|
41
46
|
|
|
@@ -54,7 +59,11 @@ test('getAbi calculates correct Node ABI', function (t) {
|
|
|
54
59
|
t.equal(getAbi(null), process.versions.modules)
|
|
55
60
|
t.throws(function () { getAbi('a.b.c') })
|
|
56
61
|
t.throws(function () { getAbi(getNextTarget('node')) })
|
|
57
|
-
t.equal(getAbi('
|
|
62
|
+
t.equal(getAbi('15.0.0'), '88')
|
|
63
|
+
t.equal(getAbi('14.0.0'), '83')
|
|
64
|
+
t.equal(getAbi('13.0.0'), '79')
|
|
65
|
+
t.equal(getAbi('12.0.0'), '72')
|
|
66
|
+
t.equal(getAbi('11.0.0'), '67')
|
|
58
67
|
t.equal(getAbi('7.2.0'), '51')
|
|
59
68
|
t.equal(getAbi('7.0.0'), '51')
|
|
60
69
|
t.equal(getAbi('6.9.9'), '48')
|
|
@@ -91,6 +100,7 @@ test('getAbi calculates correct Electron ABI', function (t) {
|
|
|
91
100
|
t.throws(function () { getAbi(undefined, 'electron') })
|
|
92
101
|
t.throws(function () { getAbi(getNextTarget('electron'), 'electron') })
|
|
93
102
|
t.equal(getAbi('10.0.0-beta.1', 'electron'), '82')
|
|
103
|
+
t.equal(getAbi('10.0.0', 'electron'), '82')
|
|
94
104
|
t.equal(getAbi('9.0.0', 'electron'), '80')
|
|
95
105
|
t.equal(getAbi('8.0.0', 'electron'), '76')
|
|
96
106
|
t.equal(getAbi('7.0.0', 'electron'), '75')
|