node-addon-api 1.7.2 → 3.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.
Files changed (53) hide show
  1. package/.travis.yml +3 -9
  2. package/CHANGELOG.md +154 -9
  3. package/README.md +58 -9
  4. package/benchmark/README.md +47 -0
  5. package/benchmark/binding.gyp +25 -0
  6. package/benchmark/function_args.cc +153 -0
  7. package/benchmark/function_args.js +52 -0
  8. package/benchmark/index.js +34 -0
  9. package/benchmark/property_descriptor.cc +60 -0
  10. package/benchmark/property_descriptor.js +29 -0
  11. package/common.gypi +21 -0
  12. package/doc/array_buffer.md +1 -1
  13. package/doc/async_context.md +10 -0
  14. package/doc/async_operations.md +1 -1
  15. package/doc/async_worker.md +56 -26
  16. package/doc/async_worker_variants.md +456 -0
  17. package/doc/basic_types.md +8 -0
  18. package/doc/bigint.md +2 -1
  19. package/doc/class_property_descriptor.md +5 -6
  20. package/doc/cmake-js.md +58 -9
  21. package/doc/creating_a_release.md +5 -5
  22. package/doc/date.md +68 -0
  23. package/doc/env.md +14 -0
  24. package/doc/function.md +108 -1
  25. package/doc/object.md +74 -1
  26. package/doc/object_lifetime_management.md +1 -1
  27. package/doc/object_wrap.md +291 -4
  28. package/doc/prebuild_tools.md +1 -1
  29. package/doc/property_descriptor.md +64 -9
  30. package/doc/setup.md +0 -1
  31. package/doc/string.md +1 -1
  32. package/doc/symbol.md +1 -1
  33. package/doc/threadsafe_function.md +18 -1
  34. package/doc/value.md +10 -1
  35. package/except.gypi +16 -0
  36. package/index.js +5 -42
  37. package/napi-inl.h +1048 -147
  38. package/napi.h +424 -49
  39. package/node_api.gyp +9 -0
  40. package/noexcept.gypi +16 -0
  41. package/{src/nothing.c → nothing.c} +0 -0
  42. package/package.json +244 -47
  43. package/tools/README.md +4 -4
  44. package/tools/conversion.js +0 -4
  45. package/external-napi/node_api.h +0 -7
  46. package/src/node_api.cc +0 -3655
  47. package/src/node_api.gyp +0 -21
  48. package/src/node_api.h +0 -588
  49. package/src/node_api_types.h +0 -115
  50. package/src/node_internals.cc +0 -142
  51. package/src/node_internals.h +0 -157
  52. package/src/util-inl.h +0 -38
  53. package/src/util.h +0 -7
package/node_api.gyp ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ 'targets': [
3
+ {
4
+ 'target_name': 'nothing',
5
+ 'type': 'static_library',
6
+ 'sources': [ 'nothing.c' ]
7
+ }
8
+ ]
9
+ }
package/noexcept.gypi ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ 'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
3
+ 'cflags': [ '-fno-exceptions' ],
4
+ 'cflags_cc': [ '-fno-exceptions' ],
5
+ 'msvs_settings': {
6
+ 'VCCLCompilerTool': {
7
+ 'ExceptionHandling': 0,
8
+ 'EnablePREfast': 'true',
9
+ },
10
+ },
11
+ 'xcode_settings': {
12
+ 'CLANG_CXX_LIBRARY': 'libc++',
13
+ 'MACOSX_DEPLOYMENT_TARGET': '10.7',
14
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',
15
+ },
16
+ }
File without changes
package/package.json CHANGED
@@ -3,60 +3,255 @@
3
3
  "url": "https://github.com/nodejs/node-addon-api/issues"
4
4
  },
5
5
  "contributors": [
6
- "Abhishek Kumar Singh (https://github.com/abhi11210646)",
7
- "Alba Mendez (https://github.com/jmendeth)",
8
- "Andrew Petersen (https://github.com/kirbysayshi)",
9
- "Anisha Rohra (https://github.com/anisha-rohra)",
10
- "Anna Henningsen (https://github.com/addaleax)",
11
- "Arnaud Botella (https://github.com/BotellaA)",
12
- "Arunesh Chandra (https://github.com/aruneshchandra)",
13
- "Ben Berman (https://github.com/rivertam)",
14
- "Benjamin Byholm (https://github.com/kkoopa)",
15
- "Bill Gallafent (https://github.com/gallafent)",
16
- "Bruce A. MacNaughton (https://github.com/bmacnaughton)",
17
- "Cory Mickelson (https://github.com/corymickelson)",
18
- "David Halls (https://github.com/davedoesdev)",
19
- "Dongjin Na (https://github.com/nadongguri)",
20
- "Eric Bickle (https://github.com/ebickle)",
21
- "Gabriel Schulhof (https://github.com/gabrielschulhof)",
22
- "Gus Caplan (https://github.com/devsnek)",
23
- "Hitesh Kanwathirtha (https://github.com/digitalinfinity)",
24
- "Jake Barnes (https://github.com/DuBistKomisch)",
25
- "Jake Yoon (https://github.com/yjaeseok)",
26
- "Jason Ginchereau (https://github.com/jasongin)",
27
- "Jim Schlight (https://github.com/jschlight)",
28
- "Jinho Bang (https://github.com/romandev)",
29
- "joshgarde (https://github.com/joshgarde)",
30
- "Kevin Eady (https://github.com/KevinEady)",
31
- "Konstantin Tarkus (https://github.com/koistya)",
32
- "Kyle Farnung (https://github.com/kfarnung)",
33
- "Luciano Martorella (https://github.com/lmartorella)",
34
- "Matteo Collina (https://github.com/mcollina)",
35
- "Michael Dawson (https://github.com/mhdawson)",
36
- "Michele Campus (https://github.com/kYroL01)",
37
- "Mikhail Cheshkov (https://github.com/mcheshkov)",
38
- "Nicola Del Gobbo (https://github.com/NickNaso)",
39
- "Nick Soggin (https://github.com/iSkore)",
40
- "Philipp Renoth (https://github.com/DaAitch)",
41
- "Rolf Timmermans (https://github.com/rolftimmermans)",
42
- "Ross Weir (https://github.com/ross-weir)",
43
- "Ryuichi Okumura (https://github.com/okuryu)",
44
- "Sampson Gao (https://github.com/sampsongao)",
45
- "Sam Roberts (https://github.com/sam-github)",
46
- "Taylor Woll (https://github.com/boingoing)",
47
- "Thomas Gentilhomme (https://github.com/fraxken)",
48
- "Tobias Nießen (https://github.com/tniessen)",
49
- "Tux3 (https://github.com/tux3)",
50
- "Yohei Kishimoto (https://github.com/morokosi)"
6
+ {
7
+ "name": "Abhishek Kumar Singh",
8
+ "url": "https://github.com/abhi11210646"
9
+ },
10
+ {
11
+ "name": "Alba Mendez",
12
+ "url": "https://github.com/jmendeth"
13
+ },
14
+ {
15
+ "name": "András Timár, Dr",
16
+ "url": "https://github.com/timarandras"
17
+ },
18
+ {
19
+ "name": "Andrew Petersen",
20
+ "url": "https://github.com/kirbysayshi"
21
+ },
22
+ {
23
+ "name": "Anisha Rohra",
24
+ "url": "https://github.com/anisha-rohra"
25
+ },
26
+ {
27
+ "name": "Anna Henningsen",
28
+ "url": "https://github.com/addaleax"
29
+ },
30
+ {
31
+ "name": "Arnaud Botella",
32
+ "url": "https://github.com/BotellaA"
33
+ },
34
+ {
35
+ "name": "Arunesh Chandra",
36
+ "url": "https://github.com/aruneshchandra"
37
+ },
38
+ {
39
+ "name": "Azlan Mukhtar",
40
+ "url": "https://github.com/azlan"
41
+ },
42
+ {
43
+ "name": "Ben Berman",
44
+ "url": "https://github.com/rivertam"
45
+ },
46
+ {
47
+ "name": "Benjamin Byholm",
48
+ "url": "https://github.com/kkoopa"
49
+ },
50
+ {
51
+ "name": "Bill Gallafent",
52
+ "url": "https://github.com/gallafent"
53
+ },
54
+ {
55
+ "name": "Bruce A. MacNaughton",
56
+ "url": "https://github.com/bmacnaughton"
57
+ },
58
+ {
59
+ "name": "Cory Mickelson",
60
+ "url": "https://github.com/corymickelson"
61
+ },
62
+ {
63
+ "name": "David Halls",
64
+ "url": "https://github.com/davedoesdev"
65
+ },
66
+ {
67
+ "name": "Dmitry Ashkadov",
68
+ "url": "https://github.com/dmitryash"
69
+ },
70
+ {
71
+ "name": "Dongjin Na",
72
+ "url": "https://github.com/nadongguri"
73
+ },
74
+ {
75
+ "name": "Eric Bickle",
76
+ "url": "https://github.com/ebickle"
77
+ },
78
+ {
79
+ "name": "Gabriel Schulhof",
80
+ "url": "https://github.com/gabrielschulhof"
81
+ },
82
+ {
83
+ "name": "Guenter Sandner",
84
+ "url": "https://github.com/gms1"
85
+ },
86
+ {
87
+ "name": "Gus Caplan",
88
+ "url": "https://github.com/devsnek"
89
+ },
90
+ {
91
+ "name": "Hitesh Kanwathirtha",
92
+ "url": "https://github.com/digitalinfinity"
93
+ },
94
+ {
95
+ "name": "ikokostya",
96
+ "url": "https://github.com/ikokostya"
97
+ },
98
+ {
99
+ "name": "Jake Barnes",
100
+ "url": "https://github.com/DuBistKomisch"
101
+ },
102
+ {
103
+ "name": "Jake Yoon",
104
+ "url": "https://github.com/yjaeseok"
105
+ },
106
+ {
107
+ "name": "Jason Ginchereau",
108
+ "url": "https://github.com/jasongin"
109
+ },
110
+ {
111
+ "name": "Jim Schlight",
112
+ "url": "https://github.com/jschlight"
113
+ },
114
+ {
115
+ "name": "Jinho Bang",
116
+ "url": "https://github.com/romandev"
117
+ },
118
+ {
119
+ "name": "joshgarde",
120
+ "url": "https://github.com/joshgarde"
121
+ },
122
+ {
123
+ "name": "Kelvin",
124
+ "url": "https://github.com/kelvinhammond"
125
+ },
126
+ {
127
+ "name": "Kevin Eady",
128
+ "url": "https://github.com/KevinEady"
129
+ },
130
+ {
131
+ "name": "Konstantin Tarkus",
132
+ "url": "https://github.com/koistya"
133
+ },
134
+ {
135
+ "name": "Kyle Farnung",
136
+ "url": "https://github.com/kfarnung"
137
+ },
138
+ {
139
+ "name": "legendecas",
140
+ "url": "https://github.com/legendecas"
141
+ },
142
+ {
143
+ "name": "Luciano Martorella",
144
+ "url": "https://github.com/lmartorella"
145
+ },
146
+ {
147
+ "name": "Mathias Küsel",
148
+ "url": "https://github.com/mathiask88"
149
+ },
150
+ {
151
+ "name": "Matteo Collina",
152
+ "url": "https://github.com/mcollina"
153
+ },
154
+ {
155
+ "name": "Michael Dawson",
156
+ "url": "https://github.com/mhdawson"
157
+ },
158
+ {
159
+ "name": "Michael Price",
160
+ "url": "https://github.com/mikepricedev"
161
+ },
162
+ {
163
+ "name": "Michele Campus",
164
+ "url": "https://github.com/kYroL01"
165
+ },
166
+ {
167
+ "name": "Mikhail Cheshkov",
168
+ "url": "https://github.com/mcheshkov"
169
+ },
170
+ {
171
+ "name": "Nicola Del Gobbo",
172
+ "url": "https://github.com/NickNaso"
173
+ },
174
+ {
175
+ "name": "Nick Soggin",
176
+ "url": "https://github.com/iSkore"
177
+ },
178
+ {
179
+ "name": "Nurbol Alpysbayev",
180
+ "url": "https://github.com/anurbol"
181
+ },
182
+ {
183
+ "name": "Philipp Renoth",
184
+ "url": "https://github.com/DaAitch"
185
+ },
186
+ {
187
+ "name": "Rolf Timmermans",
188
+ "url": "https://github.com/rolftimmermans"
189
+ },
190
+ {
191
+ "name": "Ross Weir",
192
+ "url": "https://github.com/ross-weir"
193
+ },
194
+ {
195
+ "name": "Ryuichi Okumura",
196
+ "url": "https://github.com/okuryu"
197
+ },
198
+ {
199
+ "name": "Sampson Gao",
200
+ "url": "https://github.com/sampsongao"
201
+ },
202
+ {
203
+ "name": "Sam Roberts",
204
+ "url": "https://github.com/sam-github"
205
+ },
206
+ {
207
+ "name": "Taylor Woll",
208
+ "url": "https://github.com/boingoing"
209
+ },
210
+ {
211
+ "name": "Thomas Gentilhomme",
212
+ "url": "https://github.com/fraxken"
213
+ },
214
+ {
215
+ "name": "Tim Rach",
216
+ "url": "https://github.com/timrach"
217
+ },
218
+ {
219
+ "name": "Tobias Nießen",
220
+ "url": "https://github.com/tniessen"
221
+ },
222
+ {
223
+ "name": "Tux3",
224
+ "url": "https://github.com/tux3"
225
+ },
226
+ {
227
+ "name": "Yohei Kishimoto",
228
+ "url": "https://github.com/morokosi"
229
+ },
230
+ {
231
+ "name": "Yulong Wang",
232
+ "url": "https://github.com/fs-eire"
233
+ }
51
234
  ],
52
235
  "dependencies": {},
53
236
  "description": "Node.js API (N-API)",
54
237
  "devDependencies": {
238
+ "benchmark": "^2.1.4",
55
239
  "safe-buffer": "^5.1.1"
56
240
  },
57
241
  "directories": {},
242
+ "gypfile": false,
58
243
  "homepage": "https://github.com/nodejs/node-addon-api",
59
- "keywords": ["n-api", "napi", "addon", "native", "bindings", "c", "c++", "nan", "node-addon-api"],
244
+ "keywords": [
245
+ "n-api",
246
+ "napi",
247
+ "addon",
248
+ "native",
249
+ "bindings",
250
+ "c",
251
+ "c++",
252
+ "nan",
253
+ "node-addon-api"
254
+ ],
60
255
  "license": "MIT",
61
256
  "main": "index.js",
62
257
  "name": "node-addon-api",
@@ -67,6 +262,8 @@
67
262
  "url": "git://github.com/nodejs/node-addon-api.git"
68
263
  },
69
264
  "scripts": {
265
+ "prebenchmark": "node-gyp rebuild -C benchmark",
266
+ "benchmark": "node benchmark",
70
267
  "pretest": "node-gyp rebuild -C test",
71
268
  "test": "node test",
72
269
  "predev": "node-gyp rebuild -C test --debug",
@@ -75,5 +272,5 @@
75
272
  "dev:incremental": "node test",
76
273
  "doc": "doxygen doc/Doxyfile"
77
274
  },
78
- "version": "1.7.2"
275
+ "version": "3.0.0"
79
276
  }
package/tools/README.md CHANGED
@@ -49,10 +49,10 @@ Napi::FunctionReference constructor;
49
49
  void [ClassName]::Init(Napi::Env env, Napi::Object exports, Napi::Object module) {
50
50
  Napi::HandleScope scope(env);
51
51
  Napi::Function ctor = DefineClass(env, "Canvas", {
52
- InstanceMethod("Func1", &[ClassName]::Func1),
53
- InstanceMethod("Func2", &[ClassName]::Func2),
54
- InstanceAccessor("Value", &[ClassName]::ValueGetter),
55
- StaticMethod("MethodName", &[ClassName]::StaticMethod),
52
+ InstanceMethod<&[ClassName]::Func1>("Func1"),
53
+ InstanceMethod<&[ClassName]::Func2>("Func2"),
54
+ InstanceAccessor<&[ClassName]::ValueGetter>("Value"),
55
+ StaticMethod<&[ClassName]::StaticMethod>("MethodName"),
56
56
  InstanceValue("Value", Napi::[Type]::New(env, value)),
57
57
  });
58
58
 
@@ -24,8 +24,6 @@ if (disable != "--disable" && dir != "--disable") {
24
24
  'binding.gyp': [
25
25
  [ /([ ]*)'include_dirs': \[/g, '$1\'include_dirs\': [\n$1 \'<!@(node -p "require(\\\'node-addon-api\\\').include")\',' ],
26
26
  [ /([ ]*)"include_dirs": \[/g, '$1"include_dirs": [\n$1 "<!@(node -p \\"require(\'node-addon-api\').include\\")",' ],
27
- [ /([ ]*)'dependencies': \[/g, '$1\'dependencies\': [\n$1 \'<!(node -p "require(\\\'node-addon-api\\\').gyp")\','],
28
- [ /([ ]*)"dependencies": \[/g, '$1"dependencies": [\n$1 "<!(node -p \'require(\\\"node-addon-api\\\").gyp\')",'],
29
27
  [ /[ ]*("|')<!\(node -e ("|'|\\"|\\')require\(("|'|\\"|\\')nan("|'|\\"|\\')\)("|'|\\"|\\')\)("|')(,|)[\r\n]/g, '' ],
30
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 },' ],
31
29
  ]
@@ -39,8 +37,6 @@ if (disable != "--disable" && dir != "--disable") {
39
37
  'binding.gyp': [
40
38
  [ /([ ]*)'include_dirs': \[/g, '$1\'include_dirs\': [\n$1 \'<!@(node -p "require(\\\'node-addon-api\\\').include")\',' ],
41
39
  [ /([ ]*)"include_dirs": \[/g, '$1"include_dirs": [\n$1 "<!@(node -p \'require(\\\"node-addon-api\\\").include\')",' ],
42
- [ /([ ]*)'dependencies': \[/g, '$1\'dependencies\': [\n$1 \'<!(node -p "require(\\\'node-addon-api\\\').gyp")\','],
43
- [ /([ ]*)"dependencies": \[/g, '$1"dependencies": [\n$1 "<!(node -p \'require(\\\"node-addon-api\\\").gyp\')",'],
44
40
  [ /[ ]*("|')<!\(node -e ("|'|\\"|\\')require\(("|'|\\"|\\')nan("|'|\\"|\\')\)("|'|\\"|\\')\)("|')(,|)[\r\n]/g, '' ],
45
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 ]' ],
46
42
  ]
@@ -1,7 +0,0 @@
1
- #ifndef EXTERNAL_NODE_API_H_
2
- #define EXTERNAL_NODE_API_H_
3
-
4
- #define EXTERNAL_NAPI
5
- #include "../src/node_api.h"
6
-
7
- #endif