node-abi 3.73.0 → 4.0.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/abi_registry.json +10 -0
- package/getNextTarget.js +13 -0
- package/index.js +33 -51
- package/package.json +10 -9
package/abi_registry.json
CHANGED
|
@@ -108,6 +108,16 @@
|
|
|
108
108
|
"future": false,
|
|
109
109
|
"abi": "131"
|
|
110
110
|
},
|
|
111
|
+
{
|
|
112
|
+
"runtime": "node",
|
|
113
|
+
"target": "24.0.0",
|
|
114
|
+
"lts": [
|
|
115
|
+
"2025-10-28",
|
|
116
|
+
"2026-10-20"
|
|
117
|
+
],
|
|
118
|
+
"future": true,
|
|
119
|
+
"abi": "134"
|
|
120
|
+
},
|
|
111
121
|
{
|
|
112
122
|
"abi": "70",
|
|
113
123
|
"future": false,
|
package/getNextTarget.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import semver from 'semver';
|
|
2
|
+
|
|
3
|
+
export function getNextTarget (runtime, targets) {
|
|
4
|
+
const latest = targets.filter((t) => { return t.runtime === runtime }).slice(-1)[0]
|
|
5
|
+
const increment = runtime === 'electron' ? 'minor' : 'major'
|
|
6
|
+
let next = semver.inc(latest.target, increment)
|
|
7
|
+
// Electron releases appear in the registry in their beta form, sometimes there is
|
|
8
|
+
// no active beta line. During this time we need to double bump
|
|
9
|
+
if (runtime === 'electron' && semver.parse(latest.target).prerelease.length) {
|
|
10
|
+
next = semver.inc(next, 'major')
|
|
11
|
+
}
|
|
12
|
+
return next
|
|
13
|
+
}
|
package/index.js
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// Electron releases appear in the registry in their beta form, sometimes there is
|
|
9
|
-
// no active beta line. During this time we need to double bump
|
|
10
|
-
if (runtime === 'electron' && semver.parse(latest.target).prerelease.length) {
|
|
11
|
-
next = semver.inc(next, 'major')
|
|
12
|
-
}
|
|
13
|
-
return next
|
|
14
|
-
}
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
import semver from 'semver';
|
|
6
|
+
|
|
7
|
+
import { getNextTarget } from './getNextTarget.js';
|
|
15
8
|
|
|
16
|
-
function getAbi (target, runtime) {
|
|
9
|
+
export function getAbi (target, runtime) {
|
|
17
10
|
if (target === String(Number(target))) return target
|
|
18
11
|
if (target) target = target.replace(/^v/, '')
|
|
19
12
|
if (!runtime) runtime = 'node'
|
|
@@ -23,11 +16,11 @@ function getAbi (target, runtime) {
|
|
|
23
16
|
if (target === process.versions.node) return process.versions.modules
|
|
24
17
|
}
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
let abi
|
|
20
|
+
let lastTarget
|
|
28
21
|
|
|
29
|
-
for (
|
|
30
|
-
|
|
22
|
+
for (let i = 0; i < allTargets.length; i++) {
|
|
23
|
+
const t = allTargets[i]
|
|
31
24
|
if (t.runtime !== runtime) continue
|
|
32
25
|
if (semver.lte(t.target, target) && (!lastTarget || semver.gte(t.target, lastTarget))) {
|
|
33
26
|
abi = t.abi
|
|
@@ -35,17 +28,17 @@ function getAbi (target, runtime) {
|
|
|
35
28
|
}
|
|
36
29
|
}
|
|
37
30
|
|
|
38
|
-
if (abi && semver.lt(target, getNextTarget(runtime))) return abi
|
|
31
|
+
if (abi && semver.lt(target, getNextTarget(runtime, allTargets))) return abi
|
|
39
32
|
throw new Error('Could not detect abi for version ' + target + ' and runtime ' + runtime + '. Updating "node-abi" might help solve this issue if it is a new release of ' + runtime)
|
|
40
33
|
}
|
|
41
34
|
|
|
42
|
-
function getTarget (abi, runtime) {
|
|
35
|
+
export function getTarget (abi, runtime) {
|
|
43
36
|
if (abi && abi !== String(Number(abi))) return abi
|
|
44
37
|
if (!runtime) runtime = 'node'
|
|
45
38
|
|
|
46
39
|
if (runtime === 'node' && !abi) return process.versions.node
|
|
47
40
|
|
|
48
|
-
|
|
41
|
+
const match = allTargets
|
|
49
42
|
.filter(function (t) {
|
|
50
43
|
return t.abi === abi && t.runtime === runtime
|
|
51
44
|
})
|
|
@@ -53,7 +46,7 @@ function getTarget (abi, runtime) {
|
|
|
53
46
|
return t.target
|
|
54
47
|
})
|
|
55
48
|
if (match.length) {
|
|
56
|
-
|
|
49
|
+
const betaSeparatorIndex = match[0].indexOf("-")
|
|
57
50
|
return betaSeparatorIndex > -1
|
|
58
51
|
? match[0].substring(0, betaSeparatorIndex)
|
|
59
52
|
: match[0]
|
|
@@ -63,7 +56,7 @@ function getTarget (abi, runtime) {
|
|
|
63
56
|
}
|
|
64
57
|
|
|
65
58
|
function sortByTargetFn (a, b) {
|
|
66
|
-
|
|
59
|
+
const abiComp = Number(a.abi) - Number(b.abi)
|
|
67
60
|
if (abiComp !== 0) return abiComp
|
|
68
61
|
if (a.target < b.target) return -1
|
|
69
62
|
if (a.target > b.target) return 1
|
|
@@ -71,23 +64,23 @@ function sortByTargetFn (a, b) {
|
|
|
71
64
|
}
|
|
72
65
|
|
|
73
66
|
function loadGeneratedTargets () {
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
const registry = JSON.parse(fs.readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), 'abi_registry.json'), 'utf8'))
|
|
68
|
+
const targets = {
|
|
76
69
|
supported: [],
|
|
77
70
|
additional: [],
|
|
78
71
|
future: []
|
|
79
72
|
}
|
|
80
73
|
|
|
81
74
|
registry.forEach(function (item) {
|
|
82
|
-
|
|
75
|
+
const target = {
|
|
83
76
|
runtime: item.runtime,
|
|
84
77
|
target: item.target,
|
|
85
78
|
abi: item.abi
|
|
86
79
|
}
|
|
87
80
|
if (item.lts) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
const startDate = new Date(Date.parse(item.lts[0]))
|
|
82
|
+
const endDate = new Date(Date.parse(item.lts[1]))
|
|
83
|
+
const currentDate = new Date()
|
|
91
84
|
target.lts = startDate < currentDate && currentDate < endDate
|
|
92
85
|
} else {
|
|
93
86
|
target.lts = false
|
|
@@ -109,9 +102,9 @@ function loadGeneratedTargets () {
|
|
|
109
102
|
return targets
|
|
110
103
|
}
|
|
111
104
|
|
|
112
|
-
|
|
105
|
+
const generatedTargets = loadGeneratedTargets()
|
|
113
106
|
|
|
114
|
-
|
|
107
|
+
export const supportedTargets = [
|
|
115
108
|
{runtime: 'node', target: '5.0.0', abi: '47', lts: false},
|
|
116
109
|
{runtime: 'node', target: '6.0.0', abi: '48', lts: false},
|
|
117
110
|
{runtime: 'node', target: '7.0.0', abi: '51', lts: false},
|
|
@@ -129,22 +122,20 @@ var supportedTargets = [
|
|
|
129
122
|
{runtime: 'electron', target: '2.0.0', abi: '57', lts: false},
|
|
130
123
|
{runtime: 'electron', target: '3.0.0', abi: '64', lts: false},
|
|
131
124
|
{runtime: 'electron', target: '4.0.0', abi: '64', lts: false},
|
|
132
|
-
{runtime: 'electron', target: '4.0.4', abi: '69', lts: false}
|
|
125
|
+
{runtime: 'electron', target: '4.0.4', abi: '69', lts: false},
|
|
126
|
+
...generatedTargets.supported
|
|
133
127
|
]
|
|
134
128
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
var additionalTargets = [
|
|
129
|
+
export const additionalTargets = [
|
|
138
130
|
{runtime: 'node-webkit', target: '0.13.0', abi: '47', lts: false},
|
|
139
131
|
{runtime: 'node-webkit', target: '0.15.0', abi: '48', lts: false},
|
|
140
132
|
{runtime: 'node-webkit', target: '0.18.3', abi: '51', lts: false},
|
|
141
133
|
{runtime: 'node-webkit', target: '0.23.0', abi: '57', lts: false},
|
|
142
|
-
{runtime: 'node-webkit', target: '0.26.5', abi: '59', lts: false}
|
|
134
|
+
{runtime: 'node-webkit', target: '0.26.5', abi: '59', lts: false},
|
|
135
|
+
...generatedTargets.additional
|
|
143
136
|
]
|
|
144
137
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
var deprecatedTargets = [
|
|
138
|
+
export const deprecatedTargets = [
|
|
148
139
|
{runtime: 'node', target: '0.2.0', abi: '1', lts: false},
|
|
149
140
|
{runtime: 'node', target: '0.9.1', abi: '0x000A', lts: false},
|
|
150
141
|
{runtime: 'node', target: '0.9.9', abi: '0x000B', lts: false},
|
|
@@ -162,18 +153,9 @@ var deprecatedTargets = [
|
|
|
162
153
|
{runtime: 'electron', target: '0.33.0', abi: '46', lts: false}
|
|
163
154
|
]
|
|
164
155
|
|
|
165
|
-
|
|
156
|
+
export const futureTargets = generatedTargets.future
|
|
166
157
|
|
|
167
|
-
|
|
158
|
+
export const allTargets = deprecatedTargets
|
|
168
159
|
.concat(supportedTargets)
|
|
169
160
|
.concat(additionalTargets)
|
|
170
161
|
.concat(futureTargets)
|
|
171
|
-
|
|
172
|
-
exports.getAbi = getAbi
|
|
173
|
-
exports.getTarget = getTarget
|
|
174
|
-
exports.deprecatedTargets = deprecatedTargets
|
|
175
|
-
exports.supportedTargets = supportedTargets
|
|
176
|
-
exports.additionalTargets = additionalTargets
|
|
177
|
-
exports.futureTargets = futureTargets
|
|
178
|
-
exports.allTargets = allTargets
|
|
179
|
-
exports._getNextTarget = getNextTarget
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-abi",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Get the Node ABI for a given target and runtime, and vice versa.",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": "./index.js",
|
|
6
7
|
"scripts": {
|
|
7
|
-
"test": "
|
|
8
|
+
"test": "node --test test/index.js",
|
|
8
9
|
"update-abi-registry": "node --unhandled-rejections=strict scripts/update-abi-registry.js"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|
|
11
|
-
"abi_registry.json"
|
|
12
|
+
"abi_registry.json",
|
|
13
|
+
"index.js",
|
|
14
|
+
"getNextTarget.js"
|
|
12
15
|
],
|
|
13
16
|
"repository": {
|
|
14
17
|
"type": "git",
|
|
@@ -27,14 +30,12 @@
|
|
|
27
30
|
"url": "https://github.com/electron/node-abi/issues"
|
|
28
31
|
},
|
|
29
32
|
"homepage": "https://github.com/electron/node-abi#readme",
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"tape": "^5.3.1"
|
|
32
|
-
},
|
|
33
|
+
"devDependencies": {},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"semver": "^7.3
|
|
35
|
+
"semver": "^7.6.3"
|
|
35
36
|
},
|
|
36
37
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
38
|
+
"node": ">=22.12.0"
|
|
38
39
|
},
|
|
39
40
|
"publishConfig": {
|
|
40
41
|
"provenance": true
|