node-addon-api 4.3.0 → 5.1.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/README.md +38 -14
- package/index.js +3 -3
- package/napi-inl.deprecated.h +121 -127
- package/napi-inl.h +1277 -1183
- package/napi.h +2799 -2668
- package/package.json +63 -6
- package/tools/check-napi.js +13 -14
- package/tools/clang-format.js +4 -1
- package/tools/conversion.js +161 -169
- package/tools/eslint-format.js +9 -1
package/package.json
CHANGED
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"name": "Alexander Floh",
|
|
16
16
|
"url": "https://github.com/alexanderfloh"
|
|
17
17
|
},
|
|
18
|
+
{
|
|
19
|
+
"name": "Ammar Faizi",
|
|
20
|
+
"url": "https://github.com/ammarfaizi2"
|
|
21
|
+
},
|
|
18
22
|
{
|
|
19
23
|
"name": "András Timár, Dr",
|
|
20
24
|
"url": "https://github.com/timarandras"
|
|
@@ -71,6 +75,10 @@
|
|
|
71
75
|
"name": "Daniel Bevenius",
|
|
72
76
|
"url": "https://github.com/danbev"
|
|
73
77
|
},
|
|
78
|
+
{
|
|
79
|
+
"name": "Dante Calderón",
|
|
80
|
+
"url": "https://github.com/dantehemerson"
|
|
81
|
+
},
|
|
74
82
|
{
|
|
75
83
|
"name": "Darshan Sen",
|
|
76
84
|
"url": "https://github.com/RaisinTen"
|
|
@@ -95,14 +103,22 @@
|
|
|
95
103
|
"name": "Doni Rubiagatra",
|
|
96
104
|
"url": "https://github.com/rubiagatra"
|
|
97
105
|
},
|
|
98
|
-
{
|
|
99
|
-
"name": "Ferdinand Holzer",
|
|
100
|
-
"url": "https://github.com/fholzer"
|
|
101
|
-
},
|
|
102
106
|
{
|
|
103
107
|
"name": "Eric Bickle",
|
|
104
108
|
"url": "https://github.com/ebickle"
|
|
105
109
|
},
|
|
110
|
+
{
|
|
111
|
+
"name": "extremeheat",
|
|
112
|
+
"url": "https://github.com/extremeheat"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "Feng Yu",
|
|
116
|
+
"url": "https://github.com/F3n67u"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "Ferdinand Holzer",
|
|
120
|
+
"url": "https://github.com/fholzer"
|
|
121
|
+
},
|
|
106
122
|
{
|
|
107
123
|
"name": "Gabriel Schulhof",
|
|
108
124
|
"url": "https://github.com/gabrielschulhof"
|
|
@@ -143,6 +159,10 @@
|
|
|
143
159
|
"name": "Jason Ginchereau",
|
|
144
160
|
"url": "https://github.com/jasongin"
|
|
145
161
|
},
|
|
162
|
+
{
|
|
163
|
+
"name": "Jenny",
|
|
164
|
+
"url": "https://github.com/egg-bread"
|
|
165
|
+
},
|
|
146
166
|
{
|
|
147
167
|
"name": "Jeroen Janssen",
|
|
148
168
|
"url": "https://github.com/japj"
|
|
@@ -163,6 +183,10 @@
|
|
|
163
183
|
"name": "joshgarde",
|
|
164
184
|
"url": "https://github.com/joshgarde"
|
|
165
185
|
},
|
|
186
|
+
{
|
|
187
|
+
"name": "Julian Mesa",
|
|
188
|
+
"url": "https://github.com/julianmesa-gitkraken"
|
|
189
|
+
},
|
|
166
190
|
{
|
|
167
191
|
"name": "Kasumi Hanazuki",
|
|
168
192
|
"url": "https://github.com/hanazuki"
|
|
@@ -195,6 +219,10 @@
|
|
|
195
219
|
"name": "Kyle Farnung",
|
|
196
220
|
"url": "https://github.com/kfarnung"
|
|
197
221
|
},
|
|
222
|
+
{
|
|
223
|
+
"name": "Kyle Kovacs",
|
|
224
|
+
"url": "https://github.com/nullromo"
|
|
225
|
+
},
|
|
198
226
|
{
|
|
199
227
|
"name": "legendecas",
|
|
200
228
|
"url": "https://github.com/legendecas"
|
|
@@ -263,10 +291,22 @@
|
|
|
263
291
|
"name": "pacop",
|
|
264
292
|
"url": "https://github.com/pacop"
|
|
265
293
|
},
|
|
294
|
+
{
|
|
295
|
+
"name": "Peter Šándor",
|
|
296
|
+
"url": "https://github.com/petersandor"
|
|
297
|
+
},
|
|
266
298
|
{
|
|
267
299
|
"name": "Philipp Renoth",
|
|
268
300
|
"url": "https://github.com/DaAitch"
|
|
269
301
|
},
|
|
302
|
+
{
|
|
303
|
+
"name": "rgerd",
|
|
304
|
+
"url": "https://github.com/rgerd"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"name": "Richard Lau",
|
|
308
|
+
"url": "https://github.com/richardlau"
|
|
309
|
+
},
|
|
270
310
|
{
|
|
271
311
|
"name": "Rolf Timmermans",
|
|
272
312
|
"url": "https://github.com/rolftimmermans"
|
|
@@ -279,6 +319,10 @@
|
|
|
279
319
|
"name": "Ryuichi Okumura",
|
|
280
320
|
"url": "https://github.com/okuryu"
|
|
281
321
|
},
|
|
322
|
+
{
|
|
323
|
+
"name": "Saint Gabriel",
|
|
324
|
+
"url": "https://github.com/chineduG"
|
|
325
|
+
},
|
|
282
326
|
{
|
|
283
327
|
"name": "Sampson Gao",
|
|
284
328
|
"url": "https://github.com/sampsongao"
|
|
@@ -319,11 +363,19 @@
|
|
|
319
363
|
"name": "Vlad Velmisov",
|
|
320
364
|
"url": "https://github.com/Velmisov"
|
|
321
365
|
},
|
|
366
|
+
{
|
|
367
|
+
"name": "Vladimir Morozov",
|
|
368
|
+
"url": "https://github.com/vmoroz"
|
|
369
|
+
|
|
370
|
+
},
|
|
322
371
|
{
|
|
323
372
|
"name": "WenheLI",
|
|
324
373
|
"url": "https://github.com/WenheLI"
|
|
325
374
|
},
|
|
326
|
-
|
|
375
|
+
{
|
|
376
|
+
"name": "Xuguang Mei",
|
|
377
|
+
"url": "https://github.com/meixg"
|
|
378
|
+
},
|
|
327
379
|
{
|
|
328
380
|
"name": "Yohei Kishimoto",
|
|
329
381
|
"url": "https://github.com/morokosi"
|
|
@@ -335,6 +387,10 @@
|
|
|
335
387
|
{
|
|
336
388
|
"name": "Ziqiu Zhao",
|
|
337
389
|
"url": "https://github.com/ZzqiZQute"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"name": "Feng Yu",
|
|
393
|
+
"url": "https://github.com/F3n67u"
|
|
338
394
|
}
|
|
339
395
|
],
|
|
340
396
|
"description": "Node.js API (Node-API)",
|
|
@@ -385,6 +441,7 @@
|
|
|
385
441
|
"benchmark": "node benchmark",
|
|
386
442
|
"pretest": "node-gyp rebuild -C test",
|
|
387
443
|
"test": "node test",
|
|
444
|
+
"test:debug": "node-gyp rebuild -C test --debug && NODE_API_BUILD_CONFIG=Debug node ./test/index.js",
|
|
388
445
|
"predev": "node-gyp rebuild -C test --debug",
|
|
389
446
|
"dev": "node test",
|
|
390
447
|
"predev:incremental": "node-gyp configure build -C test --debug",
|
|
@@ -394,6 +451,6 @@
|
|
|
394
451
|
"lint:fix": "node tools/clang-format --fix && node tools/eslint-format --fix"
|
|
395
452
|
},
|
|
396
453
|
"pre-commit": "lint",
|
|
397
|
-
"version": "
|
|
454
|
+
"version": "5.1.0",
|
|
398
455
|
"support": true
|
|
399
456
|
}
|
package/tools/check-napi.js
CHANGED
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
|
-
const child_process = require('child_process');
|
|
8
7
|
|
|
9
8
|
// Read the output of the command, break it into lines, and use the reducer to
|
|
10
9
|
// decide whether the file is an N-API module or not.
|
|
11
|
-
function checkFile(file, command, argv, reducer) {
|
|
12
|
-
const child = child_process.spawn(command, argv, {
|
|
10
|
+
function checkFile (file, command, argv, reducer) {
|
|
11
|
+
const child = require('child_process').spawn(command, argv, {
|
|
13
12
|
stdio: ['inherit', 'pipe', 'inherit']
|
|
14
13
|
});
|
|
15
14
|
let leftover = '';
|
|
16
|
-
let isNapi
|
|
15
|
+
let isNapi;
|
|
17
16
|
child.stdout.on('data', (chunk) => {
|
|
18
17
|
if (isNapi === undefined) {
|
|
19
18
|
chunk = (leftover + chunk.toString()).split(/[\r\n]+/);
|
|
@@ -27,11 +26,11 @@ function checkFile(file, command, argv, reducer) {
|
|
|
27
26
|
child.on('close', (code, signal) => {
|
|
28
27
|
if ((code === null && signal !== null) || (code !== 0)) {
|
|
29
28
|
console.log(
|
|
30
|
-
command + ' exited with code: '
|
|
29
|
+
command + ' exited with code: ' + code + ' and signal: ' + signal);
|
|
31
30
|
} else {
|
|
32
31
|
// Green if it's a N-API module, red otherwise.
|
|
33
32
|
console.log(
|
|
34
|
-
|
|
33
|
+
'\x1b[' + (isNapi ? '42' : '41') + 'm' +
|
|
35
34
|
(isNapi ? ' N-API' : 'Not N-API') +
|
|
36
35
|
'\x1b[0m: ' + file);
|
|
37
36
|
}
|
|
@@ -39,7 +38,7 @@ function checkFile(file, command, argv, reducer) {
|
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
// Use nm -a to list symbols.
|
|
42
|
-
function checkFileUNIX(file) {
|
|
41
|
+
function checkFileUNIX (file) {
|
|
43
42
|
checkFile(file, 'nm', ['-a', file], (soFar, line) => {
|
|
44
43
|
if (soFar === undefined) {
|
|
45
44
|
line = line.match(/([0-9a-f]*)? ([a-zA-Z]) (.*$)/);
|
|
@@ -54,7 +53,7 @@ function checkFileUNIX(file) {
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
// Use dumpbin /imports to list symbols.
|
|
57
|
-
function checkFileWin32(file) {
|
|
56
|
+
function checkFileWin32 (file) {
|
|
58
57
|
checkFile(file, 'dumpbin', ['/imports', file], (soFar, line) => {
|
|
59
58
|
if (soFar === undefined) {
|
|
60
59
|
line = line.match(/([0-9a-f]*)? +([a-zA-Z0-9]) (.*$)/);
|
|
@@ -68,16 +67,16 @@ function checkFileWin32(file) {
|
|
|
68
67
|
|
|
69
68
|
// Descend into a directory structure and pass each file ending in '.node' to
|
|
70
69
|
// one of the above checks, depending on the OS.
|
|
71
|
-
function recurse(top) {
|
|
70
|
+
function recurse (top) {
|
|
72
71
|
fs.readdir(top, (error, items) => {
|
|
73
72
|
if (error) {
|
|
74
|
-
throw (
|
|
73
|
+
throw new Error('error reading directory ' + top + ': ' + error);
|
|
75
74
|
}
|
|
76
75
|
items.forEach((item) => {
|
|
77
76
|
item = path.join(top, item);
|
|
78
77
|
fs.stat(item, ((item) => (error, stats) => {
|
|
79
78
|
if (error) {
|
|
80
|
-
throw (
|
|
79
|
+
throw new Error('error about ' + item + ': ' + error);
|
|
81
80
|
}
|
|
82
81
|
if (stats.isDirectory()) {
|
|
83
82
|
recurse(item);
|
|
@@ -86,9 +85,9 @@ function recurse(top) {
|
|
|
86
85
|
// artefacts of node-addon-api having identified a version of
|
|
87
86
|
// Node.js that ships with a correct implementation of N-API.
|
|
88
87
|
path.basename(item) !== 'nothing.node') {
|
|
89
|
-
process.platform === 'win32'
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
process.platform === 'win32'
|
|
89
|
+
? checkFileWin32(item)
|
|
90
|
+
: checkFileUNIX(item);
|
|
92
91
|
}
|
|
93
92
|
})(item));
|
|
94
93
|
});
|
package/tools/clang-format.js
CHANGED
|
@@ -20,7 +20,10 @@ function main (args) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const clangFormatPath = path.dirname(require.resolve('clang-format'));
|
|
23
|
-
const
|
|
23
|
+
const binary = process.platform === 'win32'
|
|
24
|
+
? 'node_modules\\.bin\\clang-format.cmd'
|
|
25
|
+
: 'node_modules/.bin/clang-format';
|
|
26
|
+
const options = ['--binary=' + binary, '--style=file'];
|
|
24
27
|
if (fix) {
|
|
25
28
|
options.push(FORMAT_START);
|
|
26
29
|
} else {
|