node-abi 3.0.0 → 3.4.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.
@@ -29,6 +29,10 @@ jobs:
29
29
  docker:
30
30
  - image: circleci/node:14
31
31
  <<: *steps-test
32
+ test-linux-16:
33
+ docker:
34
+ - image: circleci/node:16
35
+ <<: *steps-test
32
36
 
33
37
  release:
34
38
  docker:
@@ -46,12 +50,14 @@ workflows:
46
50
  - test-linux-10
47
51
  - test-linux-12
48
52
  - test-linux-14
53
+ - test-linux-16
49
54
  - release:
50
55
  requires:
51
56
  - test-linux-10
52
57
  - test-linux-12
53
58
  - test-linux-14
59
+ - test-linux-16
54
60
  filters:
55
61
  branches:
56
62
  only:
57
- - master
63
+ - main
package/.releaserc.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "@continuous-auth/semantic-release-npm",
6
6
  "@semantic-release/github"
7
7
  ],
8
- "branches": [ "master" ]
8
+ "branches": [ "main" ]
9
9
  }
package/abi_registry.json CHANGED
@@ -50,6 +50,13 @@
50
50
  "future": false,
51
51
  "abi": "93"
52
52
  },
53
+ {
54
+ "runtime": "node",
55
+ "target": "17.0.0",
56
+ "lts": false,
57
+ "future": false,
58
+ "abi": "102"
59
+ },
53
60
  {
54
61
  "abi": "70",
55
62
  "future": false,
@@ -122,17 +129,17 @@
122
129
  },
123
130
  {
124
131
  "abi": "89",
125
- "future": true,
132
+ "future": false,
126
133
  "lts": false,
127
134
  "runtime": "electron",
128
- "target": "15.0.0-alpha.1"
135
+ "target": "13.0.0-beta.2"
129
136
  },
130
137
  {
131
138
  "abi": "89",
132
139
  "future": false,
133
140
  "lts": false,
134
141
  "runtime": "electron",
135
- "target": "13.0.0-beta.2"
142
+ "target": "15.0.0-alpha.1"
136
143
  },
137
144
  {
138
145
  "abi": "89",
@@ -140,5 +147,26 @@
140
147
  "lts": false,
141
148
  "runtime": "electron",
142
149
  "target": "14.0.0-beta.1"
150
+ },
151
+ {
152
+ "abi": "97",
153
+ "future": false,
154
+ "lts": false,
155
+ "runtime": "electron",
156
+ "target": "14.0.2"
157
+ },
158
+ {
159
+ "abi": "98",
160
+ "future": false,
161
+ "lts": false,
162
+ "runtime": "electron",
163
+ "target": "15.0.0-beta.7"
164
+ },
165
+ {
166
+ "abi": "99",
167
+ "future": false,
168
+ "lts": false,
169
+ "runtime": "electron",
170
+ "target": "16.0.0-alpha.1"
143
171
  }
144
172
  ]
package/index.js CHANGED
@@ -24,12 +24,15 @@ function getAbi (target, runtime) {
24
24
  }
25
25
 
26
26
  var abi
27
+ var lastTarget
27
28
 
28
29
  for (var i = 0; i < allTargets.length; i++) {
29
30
  var t = allTargets[i]
30
31
  if (t.runtime !== runtime) continue
31
- if (semver.lte(t.target, target)) abi = t.abi
32
- else break
32
+ if (semver.lte(t.target, target) && (!lastTarget || semver.gte(t.target, lastTarget))) {
33
+ abi = t.abi
34
+ lastTarget = t.target
35
+ }
33
36
  }
34
37
 
35
38
  if (abi && semver.lt(target, getNextTarget(runtime))) return abi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-abi",
3
- "version": "3.0.0",
3
+ "version": "3.4.0",
4
4
  "description": "Get the Node ABI for a given target and runtime, and vice versa.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test/index.js CHANGED
@@ -41,6 +41,7 @@ test('getTarget calculates correct Electron target', function (t) {
41
41
  t.equal(getTarget('50', 'electron'), '1.4.0')
42
42
  t.equal(getTarget('76', 'electron'), '8.0.0')
43
43
  t.equal(getTarget('82', 'electron'), '10.0.0')
44
+ t.equal(getTarget('89', 'electron'), '13.0.0')
44
45
  t.end()
45
46
  })
46
47
 
@@ -99,7 +100,12 @@ test('getAbi calculates correct Node ABI', function (t) {
99
100
  test('getAbi calculates correct Electron ABI', function (t) {
100
101
  t.throws(function () { getAbi(undefined, 'electron') })
101
102
  t.throws(function () { getAbi(getNextTarget('electron'), 'electron') })
102
- t.equal(getAbi('10.0.0-beta.1', 'electron'), '82')
103
+ t.equal(getAbi('15.0.0-beta.1', 'electron'), '89')
104
+ t.equal(getAbi('14.1.1', 'electron'), '97')
105
+ t.equal(getAbi('14.0.0', 'electron'), '89')
106
+ t.equal(getAbi('13.0.0', 'electron'), '89')
107
+ t.equal(getAbi('12.0.0', 'electron'), '87')
108
+ t.equal(getAbi('11.0.0', 'electron'), '85')
103
109
  t.equal(getAbi('10.0.0', 'electron'), '82')
104
110
  t.equal(getAbi('9.0.0', 'electron'), '80')
105
111
  t.equal(getAbi('8.0.0', 'electron'), '76')
@@ -158,17 +164,3 @@ test('getAbi returns abi if passed as target', function (t) {
158
164
  t.equal(getAbi('57'), '57')
159
165
  t.end()
160
166
  })
161
-
162
- test('allTargets are sorted', function (t) {
163
- var electron = allTargets.filter(function (t) { return t.runtime === 'electron' })
164
- var node = allTargets.filter(function (t) { return t.runtime === 'node' })
165
- var nodeWebkit = allTargets.filter(function (t) { return t.runtime === 'node-webkit' })
166
- function sort (t1, t2) {
167
- return semver.compare(t1.target, t2.target)
168
- }
169
-
170
- t.deepEqual(electron, electron.slice().sort(sort), 'electron targets are sorted')
171
- t.deepEqual(node, node.slice().sort(sort), 'node targets are sorted')
172
- t.deepEqual(nodeWebkit, nodeWebkit.slice().sort(sort), 'node-webkit targets are sorted')
173
- t.end()
174
- })