node-addon-api 3.0.0 → 3.2.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 +242 -2
- package/README.md +106 -62
- package/common.gypi +1 -1
- package/index.js +5 -2
- package/napi-inl.deprecated.h +8 -8
- package/napi-inl.h +1221 -548
- package/napi.h +823 -524
- package/package-support.json +21 -0
- package/package.json +96 -4
- package/tools/README.md +8 -2
- package/tools/clang-format.js +67 -0
- package/tools/conversion.js +4 -4
- package/.editorconfig +0 -8
- package/.travis.yml +0 -59
- package/CODE_OF_CONDUCT.md +0 -4
- package/CONTRIBUTING.md +0 -66
- package/appveyor.yml +0 -48
- package/benchmark/README.md +0 -47
- package/benchmark/binding.gyp +0 -25
- package/benchmark/function_args.cc +0 -153
- package/benchmark/function_args.js +0 -52
- package/benchmark/index.js +0 -34
- package/benchmark/property_descriptor.cc +0 -60
- package/benchmark/property_descriptor.js +0 -29
- package/doc/Doxyfile +0 -2450
- package/doc/array_buffer.md +0 -129
- package/doc/async_context.md +0 -86
- package/doc/async_operations.md +0 -31
- package/doc/async_worker.md +0 -427
- package/doc/async_worker_variants.md +0 -456
- package/doc/basic_types.md +0 -423
- package/doc/bigint.md +0 -93
- package/doc/boolean.md +0 -64
- package/doc/buffer.md +0 -140
- package/doc/callback_scope.md +0 -54
- package/doc/callbackinfo.md +0 -97
- package/doc/checker-tool.md +0 -32
- package/doc/class_property_descriptor.md +0 -117
- package/doc/cmake-js.md +0 -68
- package/doc/conversion-tool.md +0 -28
- package/doc/creating_a_release.md +0 -62
- package/doc/dataview.md +0 -244
- package/doc/date.md +0 -68
- package/doc/env.md +0 -77
- package/doc/error.md +0 -115
- package/doc/error_handling.md +0 -186
- package/doc/escapable_handle_scope.md +0 -82
- package/doc/external.md +0 -59
- package/doc/function.md +0 -401
- package/doc/function_reference.md +0 -238
- package/doc/generator.md +0 -13
- package/doc/handle_scope.md +0 -65
- package/doc/memory_management.md +0 -27
- package/doc/node-gyp.md +0 -82
- package/doc/number.md +0 -163
- package/doc/object.md +0 -275
- package/doc/object_lifetime_management.md +0 -83
- package/doc/object_reference.md +0 -117
- package/doc/object_wrap.md +0 -833
- package/doc/prebuild_tools.md +0 -16
- package/doc/promises.md +0 -74
- package/doc/property_descriptor.md +0 -286
- package/doc/range_error.md +0 -59
- package/doc/reference.md +0 -111
- package/doc/setup.md +0 -81
- package/doc/string.md +0 -89
- package/doc/symbol.md +0 -44
- package/doc/threadsafe_function.md +0 -320
- package/doc/type_error.md +0 -59
- package/doc/typed_array.md +0 -74
- package/doc/typed_array_of.md +0 -133
- package/doc/value.md +0 -278
- package/doc/version_management.md +0 -43
- package/doc/working_with_javascript_values.md +0 -14
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"versions": [
|
|
3
|
+
{
|
|
4
|
+
"version": "*",
|
|
5
|
+
"target": {
|
|
6
|
+
"node": "active"
|
|
7
|
+
},
|
|
8
|
+
"response": {
|
|
9
|
+
"type": "time-permitting",
|
|
10
|
+
"paid": false,
|
|
11
|
+
"contact": {
|
|
12
|
+
"name": "node-addon-api team",
|
|
13
|
+
"url": "https://github.com/nodejs/node-addon-api/issues"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"backing": [ { "project": "https://github.com/nodejs" },
|
|
17
|
+
{ "foundation": "https://openjsf.org/" }
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
"name": "Bill Gallafent",
|
|
52
52
|
"url": "https://github.com/gallafent"
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
"name": "blagoev",
|
|
56
|
+
"url": "https://github.com/blagoev"
|
|
57
|
+
},
|
|
54
58
|
{
|
|
55
59
|
"name": "Bruce A. MacNaughton",
|
|
56
60
|
"url": "https://github.com/bmacnaughton"
|
|
@@ -59,6 +63,14 @@
|
|
|
59
63
|
"name": "Cory Mickelson",
|
|
60
64
|
"url": "https://github.com/corymickelson"
|
|
61
65
|
},
|
|
66
|
+
{
|
|
67
|
+
"name": "Daniel Bevenius",
|
|
68
|
+
"url": "https://github.com/danbev"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "Darshan Sen",
|
|
72
|
+
"url": "https://github.com/RaisinTen"
|
|
73
|
+
},
|
|
62
74
|
{
|
|
63
75
|
"name": "David Halls",
|
|
64
76
|
"url": "https://github.com/davedoesdev"
|
|
@@ -71,6 +83,10 @@
|
|
|
71
83
|
"name": "Dongjin Na",
|
|
72
84
|
"url": "https://github.com/nadongguri"
|
|
73
85
|
},
|
|
86
|
+
{
|
|
87
|
+
"name": "Ferdinand Holzer",
|
|
88
|
+
"url": "https://github.com/fholzer"
|
|
89
|
+
},
|
|
74
90
|
{
|
|
75
91
|
"name": "Eric Bickle",
|
|
76
92
|
"url": "https://github.com/ebickle"
|
|
@@ -87,6 +103,10 @@
|
|
|
87
103
|
"name": "Gus Caplan",
|
|
88
104
|
"url": "https://github.com/devsnek"
|
|
89
105
|
},
|
|
106
|
+
{
|
|
107
|
+
"name": "Helio Frota",
|
|
108
|
+
"url": "https://github.com/helio-frota"
|
|
109
|
+
},
|
|
90
110
|
{
|
|
91
111
|
"name": "Hitesh Kanwathirtha",
|
|
92
112
|
"url": "https://github.com/digitalinfinity"
|
|
@@ -95,6 +115,10 @@
|
|
|
95
115
|
"name": "ikokostya",
|
|
96
116
|
"url": "https://github.com/ikokostya"
|
|
97
117
|
},
|
|
118
|
+
{
|
|
119
|
+
"name": "Jack Xia",
|
|
120
|
+
"url": "https://github.com/JckXia"
|
|
121
|
+
},
|
|
98
122
|
{
|
|
99
123
|
"name": "Jake Barnes",
|
|
100
124
|
"url": "https://github.com/DuBistKomisch"
|
|
@@ -107,6 +131,10 @@
|
|
|
107
131
|
"name": "Jason Ginchereau",
|
|
108
132
|
"url": "https://github.com/jasongin"
|
|
109
133
|
},
|
|
134
|
+
{
|
|
135
|
+
"name": "Jeroen Janssen",
|
|
136
|
+
"url": "https://github.com/japj"
|
|
137
|
+
},
|
|
110
138
|
{
|
|
111
139
|
"name": "Jim Schlight",
|
|
112
140
|
"url": "https://github.com/jschlight"
|
|
@@ -115,10 +143,18 @@
|
|
|
115
143
|
"name": "Jinho Bang",
|
|
116
144
|
"url": "https://github.com/romandev"
|
|
117
145
|
},
|
|
146
|
+
{
|
|
147
|
+
"name": "José Expósito",
|
|
148
|
+
"url": "https://github.com/JoseExposito"
|
|
149
|
+
},
|
|
118
150
|
{
|
|
119
151
|
"name": "joshgarde",
|
|
120
152
|
"url": "https://github.com/joshgarde"
|
|
121
153
|
},
|
|
154
|
+
{
|
|
155
|
+
"name": "Kasumi Hanazuki",
|
|
156
|
+
"url": "https://github.com/hanazuki"
|
|
157
|
+
},
|
|
122
158
|
{
|
|
123
159
|
"name": "Kelvin",
|
|
124
160
|
"url": "https://github.com/kelvinhammond"
|
|
@@ -127,6 +163,18 @@
|
|
|
127
163
|
"name": "Kevin Eady",
|
|
128
164
|
"url": "https://github.com/KevinEady"
|
|
129
165
|
},
|
|
166
|
+
{
|
|
167
|
+
"name": "Kévin VOYER",
|
|
168
|
+
"url": "https://github.com/kecsou"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "kidneysolo",
|
|
172
|
+
"url": "https://github.com/kidneysolo"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "Koki Nishihara",
|
|
176
|
+
"url": "https://github.com/Nishikoh"
|
|
177
|
+
},
|
|
130
178
|
{
|
|
131
179
|
"name": "Konstantin Tarkus",
|
|
132
180
|
"url": "https://github.com/koistya"
|
|
@@ -139,10 +187,22 @@
|
|
|
139
187
|
"name": "legendecas",
|
|
140
188
|
"url": "https://github.com/legendecas"
|
|
141
189
|
},
|
|
190
|
+
{
|
|
191
|
+
"name": "LongYinan",
|
|
192
|
+
"url": "https://github.com/Brooooooklyn"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "Lovell Fuller",
|
|
196
|
+
"url": "https://github.com/lovell"
|
|
197
|
+
},
|
|
142
198
|
{
|
|
143
199
|
"name": "Luciano Martorella",
|
|
144
200
|
"url": "https://github.com/lmartorella"
|
|
145
201
|
},
|
|
202
|
+
{
|
|
203
|
+
"name": "mastergberry",
|
|
204
|
+
"url": "https://github.com/mastergberry"
|
|
205
|
+
},
|
|
146
206
|
{
|
|
147
207
|
"name": "Mathias Küsel",
|
|
148
208
|
"url": "https://github.com/mathiask88"
|
|
@@ -167,6 +227,10 @@
|
|
|
167
227
|
"name": "Mikhail Cheshkov",
|
|
168
228
|
"url": "https://github.com/mcheshkov"
|
|
169
229
|
},
|
|
230
|
+
{
|
|
231
|
+
"name": "nempoBu4",
|
|
232
|
+
"url": "https://github.com/nempoBu4"
|
|
233
|
+
},
|
|
170
234
|
{
|
|
171
235
|
"name": "Nicola Del Gobbo",
|
|
172
236
|
"url": "https://github.com/NickNaso"
|
|
@@ -175,10 +239,18 @@
|
|
|
175
239
|
"name": "Nick Soggin",
|
|
176
240
|
"url": "https://github.com/iSkore"
|
|
177
241
|
},
|
|
242
|
+
{
|
|
243
|
+
"name": "Nikolai Vavilov",
|
|
244
|
+
"url": "https://github.com/seishun"
|
|
245
|
+
},
|
|
178
246
|
{
|
|
179
247
|
"name": "Nurbol Alpysbayev",
|
|
180
248
|
"url": "https://github.com/anurbol"
|
|
181
249
|
},
|
|
250
|
+
{
|
|
251
|
+
"name": "pacop",
|
|
252
|
+
"url": "https://github.com/pacop"
|
|
253
|
+
},
|
|
182
254
|
{
|
|
183
255
|
"name": "Philipp Renoth",
|
|
184
256
|
"url": "https://github.com/DaAitch"
|
|
@@ -223,6 +295,10 @@
|
|
|
223
295
|
"name": "Tux3",
|
|
224
296
|
"url": "https://github.com/tux3"
|
|
225
297
|
},
|
|
298
|
+
{
|
|
299
|
+
"name": "Vlad Velmisov",
|
|
300
|
+
"url": "https://github.com/Velmisov"
|
|
301
|
+
},
|
|
226
302
|
{
|
|
227
303
|
"name": "Yohei Kishimoto",
|
|
228
304
|
"url": "https://github.com/morokosi"
|
|
@@ -230,12 +306,19 @@
|
|
|
230
306
|
{
|
|
231
307
|
"name": "Yulong Wang",
|
|
232
308
|
"url": "https://github.com/fs-eire"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"name": "Ziqiu Zhao",
|
|
312
|
+
"url": "https://github.com/ZzqiZQute"
|
|
233
313
|
}
|
|
234
314
|
],
|
|
235
|
-
"
|
|
236
|
-
"description": "Node.js API (N-API)",
|
|
315
|
+
"description": "Node.js API (Node-API)",
|
|
237
316
|
"devDependencies": {
|
|
238
317
|
"benchmark": "^2.1.4",
|
|
318
|
+
"bindings": "^1.5.0",
|
|
319
|
+
"clang-format": "^1.4.0",
|
|
320
|
+
"fs-extra": "^9.0.1",
|
|
321
|
+
"pre-commit": "^1.2.2",
|
|
239
322
|
"safe-buffer": "^5.1.1"
|
|
240
323
|
},
|
|
241
324
|
"directories": {},
|
|
@@ -261,6 +344,11 @@
|
|
|
261
344
|
"type": "git",
|
|
262
345
|
"url": "git://github.com/nodejs/node-addon-api.git"
|
|
263
346
|
},
|
|
347
|
+
"files": [
|
|
348
|
+
"*.{c,h,gyp,gypi}",
|
|
349
|
+
"package-support.json",
|
|
350
|
+
"tools/"
|
|
351
|
+
],
|
|
264
352
|
"scripts": {
|
|
265
353
|
"prebenchmark": "node-gyp rebuild -C benchmark",
|
|
266
354
|
"benchmark": "node benchmark",
|
|
@@ -270,7 +358,11 @@
|
|
|
270
358
|
"dev": "node test",
|
|
271
359
|
"predev:incremental": "node-gyp configure build -C test --debug",
|
|
272
360
|
"dev:incremental": "node test",
|
|
273
|
-
"doc": "doxygen doc/Doxyfile"
|
|
361
|
+
"doc": "doxygen doc/Doxyfile",
|
|
362
|
+
"lint": "node tools/clang-format",
|
|
363
|
+
"lint:fix": "node tools/clang-format --fix"
|
|
274
364
|
},
|
|
275
|
-
"
|
|
365
|
+
"pre-commit": "lint",
|
|
366
|
+
"version": "3.2.0",
|
|
367
|
+
"support": true
|
|
276
368
|
}
|
package/tools/README.md
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Tools
|
|
2
|
+
|
|
3
|
+
## clang-format
|
|
4
|
+
|
|
5
|
+
The clang-format checking tools is designed to check changed lines of code compared to given git-refs.
|
|
6
|
+
|
|
7
|
+
## Migration Script
|
|
2
8
|
|
|
3
9
|
The migration tool is designed to reduce repetitive work in the migration process. However, the script is not aiming to convert every thing for you. There are usually some small fixes and major reconstruction required.
|
|
4
10
|
|
|
@@ -42,7 +48,7 @@ and define it as
|
|
|
42
48
|
This way, the `Napi::ObjectWrap` constructor will be invoked after the object has been instantiated and `Napi::ObjectWrap` can use the `this` pointer to create a reference to the wrapped object.
|
|
43
49
|
|
|
44
50
|
2. Move your original constructor code into the new constructor. Delete your original constructor.
|
|
45
|
-
3. In your class initialization function, associate native methods in the following way.
|
|
51
|
+
3. In your class initialization function, associate native methods in the following way.
|
|
46
52
|
```
|
|
47
53
|
Napi::FunctionReference constructor;
|
|
48
54
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const spawn = require('child_process').spawnSync;
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const filesToCheck = ['*.h', '*.cc'];
|
|
7
|
+
const CLANG_FORMAT_START = process.env.CLANG_FORMAT_START || 'main';
|
|
8
|
+
|
|
9
|
+
function main(args) {
|
|
10
|
+
let fix = false;
|
|
11
|
+
while (args.length > 0) {
|
|
12
|
+
switch (args[0]) {
|
|
13
|
+
case '-f':
|
|
14
|
+
case '--fix':
|
|
15
|
+
fix = true;
|
|
16
|
+
default:
|
|
17
|
+
}
|
|
18
|
+
args.shift();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let clangFormatPath = path.dirname(require.resolve('clang-format'));
|
|
22
|
+
const options = ['--binary=node_modules/.bin/clang-format', '--style=file'];
|
|
23
|
+
if (fix) {
|
|
24
|
+
options.push(CLANG_FORMAT_START);
|
|
25
|
+
} else {
|
|
26
|
+
options.push('--diff', CLANG_FORMAT_START);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const gitClangFormatPath = path.join(clangFormatPath,
|
|
30
|
+
'bin/git-clang-format');
|
|
31
|
+
const result = spawn('python', [
|
|
32
|
+
gitClangFormatPath,
|
|
33
|
+
...options,
|
|
34
|
+
'--',
|
|
35
|
+
...filesToCheck
|
|
36
|
+
], { encoding: 'utf-8' });
|
|
37
|
+
|
|
38
|
+
if (result.stderr) {
|
|
39
|
+
console.error('Error running git-clang-format:', result.stderr);
|
|
40
|
+
return 2;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const clangFormatOutput = result.stdout.trim();
|
|
44
|
+
// Bail fast if in fix mode.
|
|
45
|
+
if (fix) {
|
|
46
|
+
console.log(clangFormatOutput);
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
// Detect if there is any complains from clang-format
|
|
50
|
+
if (clangFormatOutput !== '' &&
|
|
51
|
+
clangFormatOutput !== ('no modified files to format') &&
|
|
52
|
+
clangFormatOutput !== ('clang-format did not modify any files')) {
|
|
53
|
+
console.error(clangFormatOutput);
|
|
54
|
+
const fixCmd = 'npm run lint:fix';
|
|
55
|
+
console.error(`
|
|
56
|
+
ERROR: please run "${fixCmd}" to format changes in your commit
|
|
57
|
+
Note that when running the command locally, please keep your local
|
|
58
|
+
main branch and working branch up to date with nodejs/node-addon-api
|
|
59
|
+
to exclude un-related complains.
|
|
60
|
+
Or you can run "env CLANG_FORMAT_START=upstream/main ${fixCmd}".`);
|
|
61
|
+
return 1;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (require.main === module) {
|
|
66
|
+
process.exitCode = main(process.argv.slice(2));
|
|
67
|
+
}
|
package/tools/conversion.js
CHANGED
|
@@ -22,8 +22,8 @@ if (disable != "--disable" && dir != "--disable") {
|
|
|
22
22
|
[ /[ ]*"nan": *"[^"]+"(,|)[\n\r]/g, '' ]
|
|
23
23
|
],
|
|
24
24
|
'binding.gyp': [
|
|
25
|
-
[ /([ ]*)'include_dirs': \[/g, '$1\'include_dirs\': [\n$1 \'
|
|
26
|
-
[ /([ ]*)"include_dirs": \[/g, '$1"include_dirs": [\n$1 "
|
|
25
|
+
[ /([ ]*)'include_dirs': \[/g, '$1\'include_dirs\': [\n$1 \'<!(node -p "require(\\\'node-addon-api\\\').include_dir")\',' ],
|
|
26
|
+
[ /([ ]*)"include_dirs": \[/g, '$1"include_dirs": [\n$1 "<!(node -p \\"require(\'node-addon-api\').include_dir\\")",' ],
|
|
27
27
|
[ /[ ]*("|')<!\(node -e ("|'|\\"|\\')require\(("|'|\\"|\\')nan("|'|\\"|\\')\)("|'|\\"|\\')\)("|')(,|)[\r\n]/g, '' ],
|
|
28
28
|
[ /([ ]*)("|')target_name("|'): ("|')(.+?)("|'),/g, '$1$2target_name$2: $4$5$6,\n $2cflags!$2: [ $2-fno-exceptions$2 ],\n $2cflags_cc!$2: [ $2-fno-exceptions$2 ],\n $2xcode_settings$2: { $2GCC_ENABLE_CPP_EXCEPTIONS$2: $2YES$2,\n $2CLANG_CXX_LIBRARY$2: $2libc++$2,\n $2MACOSX_DEPLOYMENT_TARGET$2: $210.7$2,\n },\n $2msvs_settings$2: {\n $2VCCLCompilerTool$2: { $2ExceptionHandling$2: 1 },\n },' ],
|
|
29
29
|
]
|
|
@@ -35,8 +35,8 @@ if (disable != "--disable" && dir != "--disable") {
|
|
|
35
35
|
[ /[ ]*"nan": *"[^"]+"(,|)[\n\r]/g, '' ]
|
|
36
36
|
],
|
|
37
37
|
'binding.gyp': [
|
|
38
|
-
[ /([ ]*)'include_dirs': \[/g, '$1\'include_dirs\': [\n$1 \'
|
|
39
|
-
[ /([ ]*)"include_dirs": \[/g, '$1"include_dirs": [\n$1 "
|
|
38
|
+
[ /([ ]*)'include_dirs': \[/g, '$1\'include_dirs\': [\n$1 \'<!(node -p "require(\\\'node-addon-api\\\').include_dir")\',' ],
|
|
39
|
+
[ /([ ]*)"include_dirs": \[/g, '$1"include_dirs": [\n$1 "<!(node -p \'require(\\\"node-addon-api\\\").include_dir\')",' ],
|
|
40
40
|
[ /[ ]*("|')<!\(node -e ("|'|\\"|\\')require\(("|'|\\"|\\')nan("|'|\\"|\\')\)("|'|\\"|\\')\)("|')(,|)[\r\n]/g, '' ],
|
|
41
41
|
[ /([ ]*)("|')target_name("|'): ("|')(.+?)("|'),/g, '$1$2target_name$2: $4$5$6,\n $2cflags!$2: [ $2-fno-exceptions$2 ],\n $2cflags_cc!$2: [ $2-fno-exceptions$2 ],\n $2defines$2: [ $2NAPI_DISABLE_CPP_EXCEPTIONS$2 ],\n $2conditions$2: [\n [\'OS==\"win\"\', { $2defines$2: [ $2_HAS_EXCEPTIONS=1$2 ] }]\n ]' ],
|
|
42
42
|
]
|
package/.editorconfig
DELETED
package/.travis.yml
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
language: c++
|
|
2
|
-
compiler:
|
|
3
|
-
- clang
|
|
4
|
-
- gcc
|
|
5
|
-
# For Linux, use an Ubuntu 14 image
|
|
6
|
-
dist: trusty
|
|
7
|
-
os:
|
|
8
|
-
- linux
|
|
9
|
-
- osx
|
|
10
|
-
env:
|
|
11
|
-
global:
|
|
12
|
-
# https://github.com/jasongin/nvs/blob/master/doc/CI.md
|
|
13
|
-
- NVS_VERSION=1.4.2
|
|
14
|
-
matrix:
|
|
15
|
-
- NODEJS_VERSION=node/10
|
|
16
|
-
- NODEJS_VERSION=node/12
|
|
17
|
-
- NODEJS_VERSION=node/14
|
|
18
|
-
- NODEJS_VERSION=nightly
|
|
19
|
-
matrix:
|
|
20
|
-
fast_finish: true
|
|
21
|
-
allow_failures:
|
|
22
|
-
- env: NODEJS_VERSION=nightly
|
|
23
|
-
sudo: false
|
|
24
|
-
cache:
|
|
25
|
-
directories:
|
|
26
|
-
- node_modules
|
|
27
|
-
- $HOME/.npm
|
|
28
|
-
addons:
|
|
29
|
-
apt:
|
|
30
|
-
sources:
|
|
31
|
-
- ubuntu-toolchain-r-test
|
|
32
|
-
packages:
|
|
33
|
-
- g++-4.9
|
|
34
|
-
before_install:
|
|
35
|
-
# coveralls
|
|
36
|
-
- pip2 install --user cpp-coveralls
|
|
37
|
-
# compilers
|
|
38
|
-
- if [ "$CXX" = "g++" -a "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="g++-4.9" CC="gcc-4.9" AR="gcc-ar-4.9" RANLIB="gcc-ranlib-4.9" NM="gcc-nm-4.9" ; fi
|
|
39
|
-
- if [ "$CXX" = "clang++" ]; then export NPMOPT=--clang=1 ; fi
|
|
40
|
-
- export CFLAGS="$CFLAGS -O3 --coverage" LDFLAGS="$LDFLAGS --coverage"
|
|
41
|
-
- echo "CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS\""
|
|
42
|
-
# nvs
|
|
43
|
-
- git clone --branch v$NVS_VERSION --depth 1 https://github.com/jasongin/nvs ~/.nvs
|
|
44
|
-
- . ~/.nvs/nvs.sh
|
|
45
|
-
- nvs --version
|
|
46
|
-
# node.js
|
|
47
|
-
- nvs add $NODEJS_VERSION
|
|
48
|
-
- nvs use $NODEJS_VERSION
|
|
49
|
-
- node --version
|
|
50
|
-
- npm --version
|
|
51
|
-
install:
|
|
52
|
-
- npm install $NPMOPT
|
|
53
|
-
script:
|
|
54
|
-
# Travis CI sets NVM_NODEJS_ORG_MIRROR, but it makes node-gyp fail to download headers for nightly builds.
|
|
55
|
-
- unset NVM_NODEJS_ORG_MIRROR
|
|
56
|
-
|
|
57
|
-
- npm test
|
|
58
|
-
after_success:
|
|
59
|
-
- cpp-coveralls --gcov-options '\-lp' --build-root test/build --exclude test
|
package/CODE_OF_CONDUCT.md
DELETED
package/CONTRIBUTING.md
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# **node-addon-api** Contribution Philosophy
|
|
2
|
-
|
|
3
|
-
The **node-addon-api** team loves contributions. There are many ways in which you can
|
|
4
|
-
contribute to **node-addon-api**:
|
|
5
|
-
- Source code fixes
|
|
6
|
-
- Additional tests
|
|
7
|
-
- Documentation improvements
|
|
8
|
-
- Joining the N-API working group and participating in meetings
|
|
9
|
-
|
|
10
|
-
## Source changes
|
|
11
|
-
|
|
12
|
-
**node-addon-api** is meant to be a thin convenience wrapper around N-API. With this
|
|
13
|
-
in mind, contributions of any new APIs that wrap around a core N-API API will
|
|
14
|
-
be considered for merge. However, changes that wrap existing **node-addon-api**
|
|
15
|
-
APIs are encouraged to instead be provided as an ecosystem module. The
|
|
16
|
-
**node-addon-api** team is happy to link to a curated set of modules that build on
|
|
17
|
-
top of **node-addon-api** if they have broad usefulness to the community and promote
|
|
18
|
-
a recommended idiom or pattern.
|
|
19
|
-
|
|
20
|
-
### Rationale
|
|
21
|
-
|
|
22
|
-
The N-API team considered a couple different approaches with regards to changes
|
|
23
|
-
extending **node-addon-api**
|
|
24
|
-
- Larger core module - Incorporate these helpers and patterns into **node-addon-api**
|
|
25
|
-
- Extras package - Create a new package (strawman name '**node-addon-api**-extras')
|
|
26
|
-
that contain utility classes and methods that help promote good patterns and
|
|
27
|
-
idioms while writing native addons with **node-addon-api**.
|
|
28
|
-
- Ecosystem - Encourage creation of a module ecosystem around **node-addon-api**
|
|
29
|
-
where folks can build on top of it.
|
|
30
|
-
|
|
31
|
-
#### Larger Core
|
|
32
|
-
This is probably our simplest option in terms of immediate action needed. It
|
|
33
|
-
would involve landing any open PRs against **node-addon-api**, and continuing to
|
|
34
|
-
encourage folks to make PRs for utility helpers against the same repository.
|
|
35
|
-
|
|
36
|
-
The downside of the approach is the following:
|
|
37
|
-
- Less coherency for our API set
|
|
38
|
-
- More maintenance burden on the N-API WG core team.
|
|
39
|
-
|
|
40
|
-
#### Extras Package
|
|
41
|
-
This involves us spinning up a new package which contains the utility classes
|
|
42
|
-
and methods. This has the benefit of having a separate module where helpers
|
|
43
|
-
which make it easier to implement certain patterns and idioms for native addons
|
|
44
|
-
easier.
|
|
45
|
-
|
|
46
|
-
The downside of this approach is the following:
|
|
47
|
-
- Potential for confusion - we'll need to provide clear documentation to help the
|
|
48
|
-
community understand where a particular contribution should be directed to (what
|
|
49
|
-
belongs in **node-addon-api** vs **node-addon-api-extras**)
|
|
50
|
-
- Need to define the level of support/API guarantees
|
|
51
|
-
- Unclear if the maintenance burden on the N-API WG is reduced or not
|
|
52
|
-
|
|
53
|
-
#### Ecosystem
|
|
54
|
-
This doesn't require a ton of up-front work from the N-API WG. Instead of
|
|
55
|
-
accepting utility PRs into **node-addon-api** or creating and maintaining a new
|
|
56
|
-
module, the WG will encourage the creation of an ecosystem of modules that
|
|
57
|
-
build on top of **node-addon-api**, and provide some level of advertising for these
|
|
58
|
-
modules (listing them out on the repository/wiki, using them in workshops/tutorials
|
|
59
|
-
etc).
|
|
60
|
-
|
|
61
|
-
The downside of this approach is the following:
|
|
62
|
-
- Potential for lack of visibility - evangelism and education is hard, and module
|
|
63
|
-
authors might not find right patterns and instead implement things themselves
|
|
64
|
-
- There might be greater friction for the N-API WG in evolving APIs since the
|
|
65
|
-
ecosystem would have taken dependencies on the API shape of **node-addon-api**
|
|
66
|
-
|
package/appveyor.yml
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
environment:
|
|
2
|
-
# https://github.com/jasongin/nvs/blob/master/doc/CI.md
|
|
3
|
-
NVS_VERSION: 1.4.2
|
|
4
|
-
fast_finish: true
|
|
5
|
-
matrix:
|
|
6
|
-
- NODEJS_VERSION: node/4
|
|
7
|
-
- NODEJS_VERSION: node/6
|
|
8
|
-
- NODEJS_VERSION: node/8
|
|
9
|
-
- NODEJS_VERSION: node/9
|
|
10
|
-
- NODEJS_VERSION: node/10
|
|
11
|
-
- NODEJS_VERSION: chakracore/8
|
|
12
|
-
- NODEJS_VERSION: chakracore/10
|
|
13
|
-
- NODEJS_VERSION: nightly
|
|
14
|
-
- NODEJS_VERSION: chakracore-nightly
|
|
15
|
-
|
|
16
|
-
matrix:
|
|
17
|
-
fast_finish: true
|
|
18
|
-
allow_failures:
|
|
19
|
-
- NODEJS_VERSION: nightly
|
|
20
|
-
- NODEJS_VERSION: chakracore-nightly
|
|
21
|
-
|
|
22
|
-
platform:
|
|
23
|
-
- x86
|
|
24
|
-
- x64
|
|
25
|
-
|
|
26
|
-
install:
|
|
27
|
-
# nvs
|
|
28
|
-
- git clone --branch v%NVS_VERSION% --depth 1 https://github.com/jasongin/nvs %LOCALAPPDATA%\nvs
|
|
29
|
-
- set PATH=%LOCALAPPDATA%\nvs;%PATH%
|
|
30
|
-
- nvs --version
|
|
31
|
-
# node.js
|
|
32
|
-
- nvs add %NODEJS_VERSION%/%PLATFORM%
|
|
33
|
-
- nvs use %NODEJS_VERSION%/%PLATFORM%
|
|
34
|
-
- node --version
|
|
35
|
-
- node -p process.arch
|
|
36
|
-
- npm --version
|
|
37
|
-
# app
|
|
38
|
-
- npm install
|
|
39
|
-
|
|
40
|
-
test_script:
|
|
41
|
-
- npm test
|
|
42
|
-
|
|
43
|
-
build: off
|
|
44
|
-
|
|
45
|
-
version: "{build}"
|
|
46
|
-
|
|
47
|
-
cache:
|
|
48
|
-
- node_modules
|
package/benchmark/README.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Benchmarks
|
|
2
|
-
|
|
3
|
-
## Running the benchmarks
|
|
4
|
-
|
|
5
|
-
From the parent directory, run
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm run-script benchmark
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
The above script supports the following arguments:
|
|
12
|
-
|
|
13
|
-
* `--benchmarks=...`: A semicolon-separated list of benchmark names. These names
|
|
14
|
-
will be mapped to file names in this directory by appending `.js`.
|
|
15
|
-
|
|
16
|
-
## Adding benchmarks
|
|
17
|
-
|
|
18
|
-
The steps below should be followed when adding new benchmarks.
|
|
19
|
-
|
|
20
|
-
0. Decide on a name for the benchmark. This name will be used in several places.
|
|
21
|
-
This example will use the name `new_benchmark`.
|
|
22
|
-
|
|
23
|
-
0. Create files `new_benchmark.cc` and `new_benchmark.js` in this directory.
|
|
24
|
-
|
|
25
|
-
0. Copy an existing benchmark in `binding.gyp` and change the target name prefix
|
|
26
|
-
and the source file name to `new_benchmark`. This should result in two new
|
|
27
|
-
targets which look like this:
|
|
28
|
-
|
|
29
|
-
```gyp
|
|
30
|
-
{
|
|
31
|
-
'target_name': 'new_benchmark',
|
|
32
|
-
'sources': [ 'new_benchmark.cc' ],
|
|
33
|
-
'includes': [ '../except.gypi' ],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
'target_name': 'new_benchmark_noexcept',
|
|
37
|
-
'sources': [ 'new_benchmark.cc' ],
|
|
38
|
-
'includes': [ '../noexcept.gypi' ],
|
|
39
|
-
},
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
There should always be a pair of targets: one bearing the name of the
|
|
43
|
-
benchmark and configured with C++ exceptions enabled, and one bearing the
|
|
44
|
-
same name followed by the suffix `_noexcept` and configured with C++
|
|
45
|
-
exceptions disabled. This will ensure that the benchmark can be written to
|
|
46
|
-
cover both the case where C++ exceptions are enabled and the case where they
|
|
47
|
-
are disabled.
|
package/benchmark/binding.gyp
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
'target_defaults': { 'includes': ['../common.gypi'] },
|
|
3
|
-
'targets': [
|
|
4
|
-
{
|
|
5
|
-
'target_name': 'function_args',
|
|
6
|
-
'sources': [ 'function_args.cc' ],
|
|
7
|
-
'includes': [ '../except.gypi' ],
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
'target_name': 'function_args_noexcept',
|
|
11
|
-
'sources': [ 'function_args.cc' ],
|
|
12
|
-
'includes': [ '../noexcept.gypi' ],
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
'target_name': 'property_descriptor',
|
|
16
|
-
'sources': [ 'property_descriptor.cc' ],
|
|
17
|
-
'includes': [ '../except.gypi' ],
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
'target_name': 'property_descriptor_noexcept',
|
|
21
|
-
'sources': [ 'property_descriptor.cc' ],
|
|
22
|
-
'includes': [ '../noexcept.gypi' ],
|
|
23
|
-
},
|
|
24
|
-
]
|
|
25
|
-
}
|