node-addon-api 2.0.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 (45) hide show
  1. package/.travis.yml +1 -4
  2. package/CHANGELOG.md +88 -30
  3. package/README.md +53 -7
  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/async_worker.md +33 -4
  13. package/doc/{async_progress_worker.md → async_worker_variants.md} +115 -3
  14. package/doc/bigint.md +2 -1
  15. package/doc/class_property_descriptor.md +3 -3
  16. package/doc/creating_a_release.md +5 -5
  17. package/doc/env.md +14 -0
  18. package/doc/function.md +108 -1
  19. package/doc/object.md +40 -1
  20. package/doc/object_lifetime_management.md +1 -1
  21. package/doc/object_wrap.md +278 -2
  22. package/doc/property_descriptor.md +64 -9
  23. package/doc/setup.md +0 -1
  24. package/doc/string.md +1 -1
  25. package/doc/symbol.md +1 -1
  26. package/doc/value.md +1 -1
  27. package/except.gypi +16 -0
  28. package/index.js +5 -42
  29. package/napi-inl.h +727 -141
  30. package/napi.h +338 -83
  31. package/node_api.gyp +9 -0
  32. package/noexcept.gypi +16 -0
  33. package/{src/nothing.c → nothing.c} +0 -0
  34. package/package.json +33 -1
  35. package/tools/README.md +4 -4
  36. package/tools/conversion.js +0 -4
  37. package/external-napi/node_api.h +0 -7
  38. package/src/node_api.cc +0 -3655
  39. package/src/node_api.gyp +0 -21
  40. package/src/node_api.h +0 -588
  41. package/src/node_api_types.h +0 -115
  42. package/src/node_internals.cc +0 -142
  43. package/src/node_internals.h +0 -157
  44. package/src/util-inl.h +0 -38
  45. 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
@@ -11,6 +11,10 @@
11
11
  "name": "Alba Mendez",
12
12
  "url": "https://github.com/jmendeth"
13
13
  },
14
+ {
15
+ "name": "András Timár, Dr",
16
+ "url": "https://github.com/timarandras"
17
+ },
14
18
  {
15
19
  "name": "Andrew Petersen",
16
20
  "url": "https://github.com/kirbysayshi"
@@ -31,6 +35,10 @@
31
35
  "name": "Arunesh Chandra",
32
36
  "url": "https://github.com/aruneshchandra"
33
37
  },
38
+ {
39
+ "name": "Azlan Mukhtar",
40
+ "url": "https://github.com/azlan"
41
+ },
34
42
  {
35
43
  "name": "Ben Berman",
36
44
  "url": "https://github.com/rivertam"
@@ -55,6 +63,10 @@
55
63
  "name": "David Halls",
56
64
  "url": "https://github.com/davedoesdev"
57
65
  },
66
+ {
67
+ "name": "Dmitry Ashkadov",
68
+ "url": "https://github.com/dmitryash"
69
+ },
58
70
  {
59
71
  "name": "Dongjin Na",
60
72
  "url": "https://github.com/nadongguri"
@@ -67,6 +79,10 @@
67
79
  "name": "Gabriel Schulhof",
68
80
  "url": "https://github.com/gabrielschulhof"
69
81
  },
82
+ {
83
+ "name": "Guenter Sandner",
84
+ "url": "https://github.com/gms1"
85
+ },
70
86
  {
71
87
  "name": "Gus Caplan",
72
88
  "url": "https://github.com/devsnek"
@@ -75,6 +91,10 @@
75
91
  "name": "Hitesh Kanwathirtha",
76
92
  "url": "https://github.com/digitalinfinity"
77
93
  },
94
+ {
95
+ "name": "ikokostya",
96
+ "url": "https://github.com/ikokostya"
97
+ },
78
98
  {
79
99
  "name": "Jake Barnes",
80
100
  "url": "https://github.com/DuBistKomisch"
@@ -99,6 +119,10 @@
99
119
  "name": "joshgarde",
100
120
  "url": "https://github.com/joshgarde"
101
121
  },
122
+ {
123
+ "name": "Kelvin",
124
+ "url": "https://github.com/kelvinhammond"
125
+ },
102
126
  {
103
127
  "name": "Kevin Eady",
104
128
  "url": "https://github.com/KevinEady"
@@ -202,14 +226,20 @@
202
226
  {
203
227
  "name": "Yohei Kishimoto",
204
228
  "url": "https://github.com/morokosi"
229
+ },
230
+ {
231
+ "name": "Yulong Wang",
232
+ "url": "https://github.com/fs-eire"
205
233
  }
206
234
  ],
207
235
  "dependencies": {},
208
236
  "description": "Node.js API (N-API)",
209
237
  "devDependencies": {
238
+ "benchmark": "^2.1.4",
210
239
  "safe-buffer": "^5.1.1"
211
240
  },
212
241
  "directories": {},
242
+ "gypfile": false,
213
243
  "homepage": "https://github.com/nodejs/node-addon-api",
214
244
  "keywords": [
215
245
  "n-api",
@@ -232,6 +262,8 @@
232
262
  "url": "git://github.com/nodejs/node-addon-api.git"
233
263
  },
234
264
  "scripts": {
265
+ "prebenchmark": "node-gyp rebuild -C benchmark",
266
+ "benchmark": "node benchmark",
235
267
  "pretest": "node-gyp rebuild -C test",
236
268
  "test": "node test",
237
269
  "predev": "node-gyp rebuild -C test --debug",
@@ -240,5 +272,5 @@
240
272
  "dev:incremental": "node test",
241
273
  "doc": "doxygen doc/Doxyfile"
242
274
  },
243
- "version": "2.0.2"
275
+ "version": "3.0.0"
244
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