node-addon-api 2.0.1 → 3.0.2
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/.travis.yml +1 -4
- package/CHANGELOG.md +172 -10
- package/README.md +81 -30
- package/appveyor.yml +3 -14
- package/benchmark/README.md +47 -0
- package/benchmark/binding.gyp +25 -0
- package/benchmark/function_args.cc +217 -0
- package/benchmark/function_args.js +60 -0
- package/benchmark/index.js +34 -0
- package/benchmark/property_descriptor.cc +91 -0
- package/benchmark/property_descriptor.js +37 -0
- package/common.gypi +21 -0
- package/doc/addon.md +157 -0
- package/doc/array.md +81 -0
- package/doc/array_buffer.md +4 -0
- package/doc/async_worker.md +33 -4
- package/doc/{async_progress_worker.md → async_worker_variants.md} +115 -3
- package/doc/bigint.md +7 -2
- package/doc/boolean.md +4 -0
- package/doc/buffer.md +4 -0
- package/doc/class_property_descriptor.md +3 -3
- package/doc/creating_a_release.md +5 -5
- package/doc/dataview.md +4 -0
- package/doc/date.md +2 -2
- package/doc/env.md +69 -0
- package/doc/error.md +5 -0
- package/doc/external.md +4 -0
- package/doc/function.md +109 -1
- package/doc/hierarchy.md +91 -0
- package/doc/instance_wrap.md +408 -0
- package/doc/name.md +29 -0
- package/doc/object.md +44 -1
- package/doc/object_lifetime_management.md +1 -1
- package/doc/object_wrap.md +219 -215
- package/doc/promises.md +5 -0
- package/doc/property_descriptor.md +64 -9
- package/doc/setup.md +1 -2
- package/doc/string.md +5 -1
- package/doc/symbol.md +5 -1
- package/doc/typed_array.md +4 -0
- package/doc/typed_array_of.md +4 -0
- package/doc/value.md +166 -104
- package/except.gypi +16 -0
- package/index.js +7 -41
- package/napi-inl.h +1116 -400
- package/napi.h +414 -142
- package/node_api.gyp +9 -0
- package/noexcept.gypi +16 -0
- package/{src/nothing.c → nothing.c} +0 -0
- package/package.json +63 -1
- package/tools/README.md +4 -4
- package/tools/conversion.js +4 -8
- package/doc/basic_types.md +0 -423
- package/doc/working_with_javascript_values.md +0 -14
- package/external-napi/node_api.h +0 -7
- package/src/node_api.cc +0 -3655
- package/src/node_api.gyp +0 -21
- package/src/node_api.h +0 -588
- package/src/node_api_types.h +0 -115
- package/src/node_internals.cc +0 -142
- package/src/node_internals.h +0 -157
- package/src/util-inl.h +0 -38
- package/src/util.h +0 -7
package/.travis.yml
CHANGED
|
@@ -12,17 +12,14 @@ env:
|
|
|
12
12
|
# https://github.com/jasongin/nvs/blob/master/doc/CI.md
|
|
13
13
|
- NVS_VERSION=1.4.2
|
|
14
14
|
matrix:
|
|
15
|
-
- NODEJS_VERSION=node/6
|
|
16
|
-
- NODEJS_VERSION=node/8
|
|
17
15
|
- NODEJS_VERSION=node/10
|
|
18
16
|
- NODEJS_VERSION=node/12
|
|
19
|
-
- NODEJS_VERSION=node/
|
|
17
|
+
- NODEJS_VERSION=node/14
|
|
20
18
|
- NODEJS_VERSION=nightly
|
|
21
19
|
matrix:
|
|
22
20
|
fast_finish: true
|
|
23
21
|
allow_failures:
|
|
24
22
|
- env: NODEJS_VERSION=nightly
|
|
25
|
-
- env: NODEJS_VERSION=node/6
|
|
26
23
|
sudo: false
|
|
27
24
|
cache:
|
|
28
25
|
directories:
|
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,178 @@
|
|
|
1
1
|
# node-addon-api Changelog
|
|
2
2
|
|
|
3
|
-
## 2020-
|
|
3
|
+
## 2020-09-18 Version 3.0.2, @NickNaso
|
|
4
4
|
|
|
5
5
|
### Notable changes:
|
|
6
6
|
|
|
7
7
|
#### API
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- Introduced `include_dir` for use with **gyp** in a scalar context.
|
|
10
|
+
- Added `Napi::Addon` to help handle the loading of a native add-on into
|
|
11
|
+
multiple threads and or multiple times in the same thread.
|
|
12
|
+
- Concentrate callbacks provided to core N-API.
|
|
13
|
+
- Make sure wrapcallback is used.
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
#### Documentation
|
|
16
|
+
|
|
17
|
+
- Added documentation for `Napi::Addon`.
|
|
18
|
+
- Added documentation that reports the full class hierarchy.
|
|
19
|
+
- Added link to N-API tutorial website.
|
|
20
|
+
- Some minor corrections all over the documentation.
|
|
21
|
+
|
|
22
|
+
#### TEST
|
|
23
|
+
|
|
24
|
+
- Added tests to check the build process.
|
|
25
|
+
- Refactored test for threasfafe function using async/await.
|
|
26
|
+
- Converted tests that gc into async functions that await 10 ticks after
|
|
27
|
+
each gc.
|
|
28
|
+
- Some minor corrections all over the test suite.
|
|
29
|
+
|
|
30
|
+
### Commits
|
|
31
|
+
|
|
32
|
+
* [[`51e25f7c39`](https://github.com/nodejs/node-addon-api/commit/51e25f7c39)] - **doc**: remove a file (#815) (Gabriel Schulhof)
|
|
33
|
+
* [[`8c9f1809a2`](https://github.com/nodejs/node-addon-api/commit/8c9f1809a2)] - **doc**: add inheritance links and other changes (Gabriel Schulhof) [#798](https://github.com/nodejs/node-addon-api/pull/798)
|
|
34
|
+
* [[`6562e6b0ab`](https://github.com/nodejs/node-addon-api/commit/6562e6b0ab)] - **test**: added tests to check the build process (NickNaso) [#808](https://github.com/nodejs/node-addon-api/pull/808)
|
|
35
|
+
* [[`a13b36c96e`](https://github.com/nodejs/node-addon-api/commit/a13b36c96e)] - **test**: fix the threasfafe function test (NickNaso) [#807](https://github.com/nodejs/node-addon-api/pull/807)
|
|
36
|
+
* [[`f27623ff61`](https://github.com/nodejs/node-addon-api/commit/f27623ff61)] - **build**: introduce include\_dir (Lovell Fuller) [#766](https://github.com/nodejs/node-addon-api/pull/766)
|
|
37
|
+
* [[`9aceea71fc`](https://github.com/nodejs/node-addon-api/commit/9aceea71fc)] - **src**: concentrate callbacks provided to core N-API (Gabriel Schulhof) [#786](https://github.com/nodejs/node-addon-api/pull/786)
|
|
38
|
+
* [[`2bc45bbffd`](https://github.com/nodejs/node-addon-api/commit/2bc45bbffd)] - **test**: refactor test to use async/await (Velmisov) [#787](https://github.com/nodejs/node-addon-api/pull/787)
|
|
39
|
+
* [[`518cfdcdc1`](https://github.com/nodejs/node-addon-api/commit/518cfdcdc1)] - **test**: test ObjectWrap destructor - no HandleScope (David Halls) [#729](https://github.com/nodejs/node-addon-api/pull/729)
|
|
40
|
+
* [[`c2cbbd9191`](https://github.com/nodejs/node-addon-api/commit/c2cbbd9191)] - **doc**: add link to n-api tutorial website (#794) (Jim Schlight) [#794](https://github.com/nodejs/node-addon-api/pull/794)
|
|
41
|
+
* [[`1c2a8d59b5`](https://github.com/nodejs/node-addon-api/commit/1c2a8d59b5)] - **doc**: Added required return to example (#793) (pacop) [#793](https://github.com/nodejs/node-addon-api/pull/793)
|
|
42
|
+
* [[`cec2c76941`](https://github.com/nodejs/node-addon-api/commit/cec2c76941)] - **src**: wrap finalizer callback (Gabriel Schulhof) [#762](https://github.com/nodejs/node-addon-api/pull/762)
|
|
43
|
+
* [[`4ce40d22a6`](https://github.com/nodejs/node-addon-api/commit/4ce40d22a6)] - **test**: use assert.strictEqual() (Koki Nishihara) [#777](https://github.com/nodejs/node-addon-api/pull/777)
|
|
44
|
+
* [[`461e3640c6`](https://github.com/nodejs/node-addon-api/commit/461e3640c6)] - **test**: string tests together (Gabriel Schulhof) [#773](https://github.com/nodejs/node-addon-api/pull/773)
|
|
45
|
+
* [[`5af645f649`](https://github.com/nodejs/node-addon-api/commit/5af645f649)] - **src**: add Addon\<T\> class (Gabriel Schulhof) [#749](https://github.com/nodejs/node-addon-api/pull/749)
|
|
46
|
+
* [[`6148fb4bcc`](https://github.com/nodejs/node-addon-api/commit/6148fb4bcc)] - Synchronise Node.js versions in Appveyor Windows CI with Travis (#768) (Lovell Fuller)
|
|
47
|
+
|
|
48
|
+
## 2020-07-13 Version 3.0.1, @NickNaso
|
|
49
|
+
|
|
50
|
+
### Notable changes:
|
|
51
|
+
|
|
52
|
+
#### API
|
|
53
|
+
|
|
54
|
+
- Fixed the usage of `Napi::Reference` with `Napi::TypedArray`.
|
|
55
|
+
- Fixed `Napi::ObjectWrap` inheritance.
|
|
56
|
+
|
|
57
|
+
#### Documentation
|
|
12
58
|
|
|
13
|
-
|
|
59
|
+
- Updated the example for `Napi::ObjectWrap`.
|
|
60
|
+
- Added documentation for instance data APIs.
|
|
61
|
+
- Some minor corrections all over the documentation.
|
|
62
|
+
|
|
63
|
+
#### TEST
|
|
64
|
+
|
|
65
|
+
- Fixed test for `Napi::ArrayBuffer` and `Napi::Buffer`.
|
|
66
|
+
- Some minor corrections all over the test suite.
|
|
67
|
+
|
|
68
|
+
### Commits
|
|
69
|
+
|
|
70
|
+
* [[`40c7926342`](https://github.com/nodejs/node-addon-api/commit/40c7926342)] - **build**: ensure paths with spaces can be used (Lovell Fuller) [#757](https://github.com/nodejs/node-addon-api/pull/757)
|
|
71
|
+
* [[`ef16dfb4a2`](https://github.com/nodejs/node-addon-api/commit/ef16dfb4a2)] - **doc**: update ObjectWrap example (Gabriel Schulhof) [#754](https://github.com/nodejs/node-addon-api/pull/754)
|
|
72
|
+
* [[`48f6762bf6`](https://github.com/nodejs/node-addon-api/commit/48f6762bf6)] - **src**: add \_\_wasm32\_\_ guards (Gus Caplan)
|
|
73
|
+
* [[`bd2c5ec502`](https://github.com/nodejs/node-addon-api/commit/bd2c5ec502)] - Fixes issue 745. (#748) (Nicola Del Gobbo)
|
|
74
|
+
* [[`4c01af2d87`](https://github.com/nodejs/node-addon-api/commit/4c01af2d87)] - Fix typo in CHANGELOG (#715) (Kasumi Hanazuki)
|
|
75
|
+
* [[`36e1af96d5`](https://github.com/nodejs/node-addon-api/commit/36e1af96d5)] - **src**: fix use of Reference with typed arrays (Michael Dawson) [#726](https://github.com/nodejs/node-addon-api/pull/726)
|
|
76
|
+
* [[`d463f02bc7`](https://github.com/nodejs/node-addon-api/commit/d463f02bc7)] - **src**: fix testEnumerables on ObjectWrap (Ferdinand Holzer) [#736](https://github.com/nodejs/node-addon-api/pull/736)
|
|
77
|
+
* [[`ba7ad37d44`](https://github.com/nodejs/node-addon-api/commit/ba7ad37d44)] - **src**: fix ObjectWrap inheritance (David Halls) [#732](https://github.com/nodejs/node-addon-api/pull/732)
|
|
78
|
+
* [[`31504c862b`](https://github.com/nodejs/node-addon-api/commit/31504c862b)] - **doc**: fix minor typo in object\_wrap.md (#741) (Daniel Bevenius) [#741](https://github.com/nodejs/node-addon-api/pull/741)
|
|
79
|
+
* [[`beccf2145d`](https://github.com/nodejs/node-addon-api/commit/beccf2145d)] - **test**: fix up delays for array buffer test (Michael Dawson) [#737](https://github.com/nodejs/node-addon-api/pull/737)
|
|
80
|
+
* [[`45cb1d9748`](https://github.com/nodejs/node-addon-api/commit/45cb1d9748)] - Correct AsyncProgressWorker link in README (#716) (Jeroen Janssen)
|
|
81
|
+
* [[`381c0da60c`](https://github.com/nodejs/node-addon-api/commit/381c0da60c)] - **doc**: add instance data APIs (Gabriel Schulhof) [#708](https://github.com/nodejs/node-addon-api/pull/708)
|
|
82
|
+
|
|
83
|
+
## 2020-04-30 Version 3.0.0, @NickNaso
|
|
84
|
+
|
|
85
|
+
### Notable changes:
|
|
86
|
+
|
|
87
|
+
#### API
|
|
88
|
+
|
|
89
|
+
- `Napi::Object` added templated property descriptors.
|
|
90
|
+
- `Napi::ObjectWrap` added templated methods.
|
|
91
|
+
- `Napi::ObjectWrap` the wrap is removed only on failure.
|
|
92
|
+
- `Napi::ObjectWrap` the constructor's exceptions are gracefully handled.
|
|
93
|
+
- `Napi::Function` added templated factory functions.
|
|
94
|
+
- Added `Env::RunScript` method to run JavaScript code contained in a string.
|
|
95
|
+
- Added templated version of `Napi::Function`.
|
|
96
|
+
- Added benchmarking framework.
|
|
97
|
+
- Added support for native addon instance data.
|
|
98
|
+
- Added `Napi::AsyncProgressQueueWorker` api.
|
|
99
|
+
- Changed the guards to `NAPI_VERSION > 5`.
|
|
100
|
+
- Removed N-API implementation (v6.x and v8.x support).
|
|
101
|
+
- `Napi::AsyncWorker::OnWorkComplete` and `Napi::AsyncWorker::OnExecute` methods
|
|
102
|
+
are override-able.
|
|
103
|
+
- Removed erroneous finalizer cleanup in `Napi::ThreadSafeFunction`.
|
|
104
|
+
- Disabled caching in `Napi::ArrayBuffer`.
|
|
105
|
+
- Explicitly disallow assign and copy operator.
|
|
106
|
+
- Some minor corrections and improvements.
|
|
107
|
+
|
|
108
|
+
#### Documentation
|
|
109
|
+
|
|
110
|
+
- Updated documentation for `Napi::Object`.
|
|
111
|
+
- Updated documentation for `Napi::Function`.
|
|
112
|
+
- Updated documentation for `Napi::ObjectWrap`.
|
|
113
|
+
- Added documentation on how to add benchmark.
|
|
114
|
+
- Added documentation for `Napi::AsyncProgressQueueWorker`.
|
|
115
|
+
- Added suggestion about tags to use on NPM.
|
|
116
|
+
- Added reference to N-API badges.
|
|
117
|
+
- Some minor corrections all over the documentation.
|
|
118
|
+
|
|
119
|
+
#### TEST
|
|
120
|
+
|
|
121
|
+
- Updated test cases for `Napi::Object`.
|
|
122
|
+
- Updated test cases for `Napi::Function`.
|
|
123
|
+
- Updated test cases for `Napi::ObjectWrap`.
|
|
124
|
+
- Updated test cases for `Napi::Env`.
|
|
125
|
+
- Added test cases for `Napi::AsyncProgressQueueWorker`.
|
|
126
|
+
- Some minor corrections all over the test suite.
|
|
127
|
+
|
|
128
|
+
### Commits
|
|
129
|
+
|
|
130
|
+
* [[`187318e37f`](https://github.com/nodejs/node-addon-api/commit/187318e37f)] - **doc**: Removed references to Node.js lower than 10.x. (#709) (Nicola Del Gobbo)
|
|
131
|
+
* [[`9c9accfbbe`](https://github.com/nodejs/node-addon-api/commit/9c9accfbbe)] - **src**: add support for addon instance data (Gabriel Schulhof) [#663](https://github.com/nodejs/node-addon-api/pull/663)
|
|
132
|
+
* [[`82a96502a4`](https://github.com/nodejs/node-addon-api/commit/82a96502a4)] - **src**: change guards to NAPI\_VERSION \> 5 (Gabriel Schulhof) [#697](https://github.com/nodejs/node-addon-api/pull/697)
|
|
133
|
+
* [[`a64e8a5641`](https://github.com/nodejs/node-addon-api/commit/a64e8a5641)] - **ci**: move travis from 13 to 14 (#707) (Gabriel Schulhof)
|
|
134
|
+
* [[`4de23c9d6b`](https://github.com/nodejs/node-addon-api/commit/4de23c9d6b)] - **doc**: fix support bigint64/biguint64 guards (Yulong Wang) [#705](https://github.com/nodejs/node-addon-api/pull/705)
|
|
135
|
+
* [[`fedc8195e3`](https://github.com/nodejs/node-addon-api/commit/fedc8195e3)] - **doc**: fix semicolon missing in async\_worker.md (Azlan Mukhtar) [#701](https://github.com/nodejs/node-addon-api/pull/701)
|
|
136
|
+
* [[`cdb662506c`](https://github.com/nodejs/node-addon-api/commit/cdb662506c)] - **doc**: fix typo in bigint.md (#700) (Kelvin)
|
|
137
|
+
* [[`e1a827ae29`](https://github.com/nodejs/node-addon-api/commit/e1a827ae29)] - **src**: fix AsyncProgressQueueWorker compilation (#696) (Gabriel Schulhof) [#696](https://github.com/nodejs/node-addon-api/pull/696)
|
|
138
|
+
* [[`2c3d5df463`](https://github.com/nodejs/node-addon-api/commit/2c3d5df463)] - Merge pull request #692 from kelvinhammond/patch-1 (Nicola Del Gobbo)
|
|
139
|
+
* [[`623e876949`](https://github.com/nodejs/node-addon-api/commit/623e876949)] - Merge pull request #688 from NickNaso/badges (Nicola Del Gobbo)
|
|
140
|
+
* [[`6c97913d1f`](https://github.com/nodejs/node-addon-api/commit/6c97913d1f)] - Fix minor typo in object\_lifetime\_management.md (Kelvin)
|
|
141
|
+
* [[`6b8dd47c55`](https://github.com/nodejs/node-addon-api/commit/6b8dd47c55)] - Added badge section to documentation. (NickNaso)
|
|
142
|
+
* [[`89e62a9154`](https://github.com/nodejs/node-addon-api/commit/89e62a9154)] - **doc**: recommend tags of addon helpers (legendecas) [#683](https://github.com/nodejs/node-addon-api/pull/683)
|
|
143
|
+
* [[`ab018444ae`](https://github.com/nodejs/node-addon-api/commit/ab018444ae)] - **src**: implement AsyncProgressQueueWorker (legendecas) [#585](https://github.com/nodejs/node-addon-api/pull/585)
|
|
144
|
+
* [[`d43da6ac2b`](https://github.com/nodejs/node-addon-api/commit/d43da6ac2b)] - **doc**: add @legendecas to active member list (legendecas)
|
|
145
|
+
* [[`cb498bbe7f`](https://github.com/nodejs/node-addon-api/commit/cb498bbe7f)] - **doc**: Add Napi::BigInt::New() overload for uint64\_t (ikokostya)
|
|
146
|
+
* [[`baaaa8452c`](https://github.com/nodejs/node-addon-api/commit/baaaa8452c)] - **doc**: link threadsafe function from JS function (legendecas)
|
|
147
|
+
* [[`7f56a78ff7`](https://github.com/nodejs/node-addon-api/commit/7f56a78ff7)] - **objectwrap**: remove wrap only on failure (Gabriel Schulhof)
|
|
148
|
+
* [[`4d816183da`](https://github.com/nodejs/node-addon-api/commit/4d816183da)] - **doc**: fix example code (András Timár, Dr) [#657](https://github.com/nodejs/node-addon-api/pull/657)
|
|
149
|
+
* [[`7ac6e21801`](https://github.com/nodejs/node-addon-api/commit/7ac6e21801)] - **gyp**: fix gypfile name in index.js (Anna Henningsen) [#658](https://github.com/nodejs/node-addon-api/pull/658)
|
|
150
|
+
* [[`46484202ca`](https://github.com/nodejs/node-addon-api/commit/46484202ca)] - **test**: user data in function property descriptor (Kevin Eady) [#652](https://github.com/nodejs/node-addon-api/pull/652)
|
|
151
|
+
* [[`0f8d730483`](https://github.com/nodejs/node-addon-api/commit/0f8d730483)] - **doc**: fix syntax error in example (András Timár, Dr) [#650](https://github.com/nodejs/node-addon-api/pull/650)
|
|
152
|
+
* [[`4e885069f1`](https://github.com/nodejs/node-addon-api/commit/4e885069f1)] - **src**: call `napi\_remove\_wrap()` in `ObjectWrap` dtor (Anna Henningsen) [#475](https://github.com/nodejs/node-addon-api/pull/475)
|
|
153
|
+
* [[`2fde5c3ca3`](https://github.com/nodejs/node-addon-api/commit/2fde5c3ca3)] - **test**: update BigInt test for recent change in core (Michael Dawson) [#649](https://github.com/nodejs/node-addon-api/pull/649)
|
|
154
|
+
* [[`e8935bd8d9`](https://github.com/nodejs/node-addon-api/commit/e8935bd8d9)] - **test**: add test for own properties on ObjectWrap (Guenter Sandner) [#645](https://github.com/nodejs/node-addon-api/pull/645)
|
|
155
|
+
* [[`23ff7f0b24`](https://github.com/nodejs/node-addon-api/commit/23ff7f0b24)] - **src**: make OnWorkComplete and OnExecute override-able (legendecas) [#589](https://github.com/nodejs/node-addon-api/pull/589)
|
|
156
|
+
* [[`86384f94d3`](https://github.com/nodejs/node-addon-api/commit/86384f94d3)] - **objectwrap**: gracefully handle constructor exceptions (Gabriel Schulhof)
|
|
157
|
+
* [[`9af69da01f`](https://github.com/nodejs/node-addon-api/commit/9af69da01f)] - remove N-API implementation, v6.x and v8.x support (Gabriel Schulhof) [#643](https://github.com/nodejs/node-addon-api/pull/643)
|
|
158
|
+
* [[`920d544779`](https://github.com/nodejs/node-addon-api/commit/920d544779)] - **benchmark**: add templated version of Function (Gabriel Schulhof) [#637](https://github.com/nodejs/node-addon-api/pull/637)
|
|
159
|
+
* [[`03759f7759`](https://github.com/nodejs/node-addon-api/commit/03759f7759)] - ignore benchmark built archives (legendecas) [#631](https://github.com/nodejs/node-addon-api/pull/631)
|
|
160
|
+
* [[`5eeabb0214`](https://github.com/nodejs/node-addon-api/commit/5eeabb0214)] - **tsfn**: Remove erroneous finalizer cleanup (Kevin Eady) [#636](https://github.com/nodejs/node-addon-api/pull/636)
|
|
161
|
+
* [[`9e0e0f31e4`](https://github.com/nodejs/node-addon-api/commit/9e0e0f31e4)] - **src**: remove unnecessary forward declarations (Gabriel Schulhof) [#633](https://github.com/nodejs/node-addon-api/pull/633)
|
|
162
|
+
* [[`79deefb6f3`](https://github.com/nodejs/node-addon-api/commit/79deefb6f3)] - **src**: explicitly disallow assign and copy (legendecas) [#590](https://github.com/nodejs/node-addon-api/pull/590)
|
|
163
|
+
* [[`af50ac281b`](https://github.com/nodejs/node-addon-api/commit/af50ac281b)] - **error**: do not replace pending exception (Gabriel Schulhof) [#629](https://github.com/nodejs/node-addon-api/pull/629)
|
|
164
|
+
* [[`b72f1d6978`](https://github.com/nodejs/node-addon-api/commit/b72f1d6978)] - Disable caching in ArrayBuffer (Tobias Nießen) [#611](https://github.com/nodejs/node-addon-api/pull/611)
|
|
165
|
+
* [[`0e7483eb7b`](https://github.com/nodejs/node-addon-api/commit/0e7483eb7b)] - Fix code format in tests (Tobias Nießen) [#617](https://github.com/nodejs/node-addon-api/pull/617)
|
|
166
|
+
* [[`6a0646356d`](https://github.com/nodejs/node-addon-api/commit/6a0646356d)] - add benchmarking framework (Gabriel Schulhof) [#623](https://github.com/nodejs/node-addon-api/pull/623)
|
|
167
|
+
* [[`ffc71edd54`](https://github.com/nodejs/node-addon-api/commit/ffc71edd54)] - Add Env::RunScript (Tobias Nießen) [#616](https://github.com/nodejs/node-addon-api/pull/616)
|
|
168
|
+
* [[`a1b106066e`](https://github.com/nodejs/node-addon-api/commit/a1b106066e)] - **src**: add templated function factories (Gabriel Schulhof) [#608](https://github.com/nodejs/node-addon-api/pull/608)
|
|
169
|
+
* [[`c584343217`](https://github.com/nodejs/node-addon-api/commit/c584343217)] - Add GetPropertyNames, HasOwnProperty, Delete (#615) (Tobias Nießen) [#615](https://github.com/nodejs/node-addon-api/pull/615)
|
|
170
|
+
* [[`3acc4b32f5`](https://github.com/nodejs/node-addon-api/commit/3acc4b32f5)] - Fix std::string encoding (#619) (Tobias Nießen) [#619](https://github.com/nodejs/node-addon-api/pull/619)
|
|
171
|
+
* [[`e71d0eadcc`](https://github.com/nodejs/node-addon-api/commit/e71d0eadcc)] - \[doc\] Fixed links to array documentation (#613) (Nicola Del Gobbo)
|
|
172
|
+
* [[`3dfb1f0591`](https://github.com/nodejs/node-addon-api/commit/3dfb1f0591)] - Change "WG" to "team" (Tobias Nießen)
|
|
173
|
+
* [[`ce91e14860`](https://github.com/nodejs/node-addon-api/commit/ce91e14860)] - **objectwrap**: add template methods (Dmitry Ashkadov) [#604](https://github.com/nodejs/node-addon-api/pull/604)
|
|
174
|
+
* [[`cfa71b60f7`](https://github.com/nodejs/node-addon-api/commit/cfa71b60f7)] - **object**: add templated property descriptors (Gabriel Schulhof) [#610](https://github.com/nodejs/node-addon-api/pull/610)
|
|
175
|
+
* [[`734725e971`](https://github.com/nodejs/node-addon-api/commit/734725e971)] - Correctly define copy assignment operators. (Rolf Timmermans)
|
|
14
176
|
|
|
15
177
|
## 2019-11-21 Version 2.0.0, @NickNaso
|
|
16
178
|
|
|
@@ -42,7 +204,7 @@
|
|
|
42
204
|
- Added test cases for `Napi::Date` api.
|
|
43
205
|
- Added test cases for new features added to `Napi::ThreadSafeFunction`.
|
|
44
206
|
|
|
45
|
-
###
|
|
207
|
+
### Commits
|
|
46
208
|
|
|
47
209
|
* [[`c881168d49`](https://github.com/nodejs/node-addon-api/commit/c881168d49)] - **tsfn**: add error checking on GetContext (#583) (Kevin Eady) [#583](https://github.com/nodejs/node-addon-api/pull/583)
|
|
48
210
|
* [[`24d75dd82f`](https://github.com/nodejs/node-addon-api/commit/24d75dd82f)] - Merge pull request #588 from NickNaso/add-asyncprogress-worker-readme (Nicola Del Gobbo)
|
|
@@ -83,7 +245,7 @@
|
|
|
83
245
|
|
|
84
246
|
- Fixed compilation problems that happen on Node.js with N-API version less than 4.
|
|
85
247
|
|
|
86
|
-
###
|
|
248
|
+
### Commits
|
|
87
249
|
|
|
88
250
|
* [[`c20bcbd069`](https://github.com/nodejs/node-addon-api/commit/c20bcbd069)] - Merge pull request #518 from NickNaso/master (Nicola Del Gobbo)
|
|
89
251
|
* [[`6720d57253`](https://github.com/nodejs/node-addon-api/commit/6720d57253)] - Create the native threadsafe\_function for test only for N-API greater than 3. (NickNaso)
|
|
@@ -111,7 +273,7 @@
|
|
|
111
273
|
- Added test case for bool operator.
|
|
112
274
|
- Fixed test case for `Napi::ObjectWrap`.
|
|
113
275
|
|
|
114
|
-
###
|
|
276
|
+
### Commits
|
|
115
277
|
|
|
116
278
|
* [[`717c9ab163`](https://github.com/nodejs/node-addon-api/commit/717c9ab163)] - **AsyncWorker**: add GetResult() method (Kevin Eady) [#512](https://github.com/nodejs/node-addon-api/pull/512)
|
|
117
279
|
* [[`d9d991bbc9`](https://github.com/nodejs/node-addon-api/commit/d9d991bbc9)] - **doc**: add ThreadSafeFunction to main README (#513) (Kevin Eady) [#513](https://github.com/nodejs/node-addon-api/pull/513)
|
|
@@ -148,7 +310,7 @@
|
|
|
148
310
|
|
|
149
311
|
- Some minor corrections all over the documentation.
|
|
150
312
|
|
|
151
|
-
###
|
|
313
|
+
### Commits
|
|
152
314
|
|
|
153
315
|
* [[`83b41c2fe4`](https://github.com/nodejs/node-addon-api/commit/83b41c2fe4)] - Document adding -fvisibility=hidden flag for macOS users (Nicola Del Gobbo) [#460](https://github.com/nodejs/node-addon-api/pull/460)
|
|
154
316
|
* [[`1ed7ad8769`](https://github.com/nodejs/node-addon-api/commit/1ed7ad8769)] - **doc**: correct return type of Int32Value to int32\_t (Bill Gallafent) [#459](https://github.com/nodejs/node-addon-api/pull/459)
|
|
@@ -197,7 +359,7 @@
|
|
|
197
359
|
- Removed unused member on `Napi::CallbackScope`.
|
|
198
360
|
- Enabled `Napi::CallbackScope` only with N-API v3.
|
|
199
361
|
|
|
200
|
-
###
|
|
362
|
+
### Commits
|
|
201
363
|
|
|
202
364
|
* [[`e7cd292a74`](https://github.com/nodejs/node-addon-api/commit/e7cd292a74)] - **src**: remove unused CallbackScope member (Gabriel Schulhof) [#391](https://github.com/nodejs/node-addon-api/pull/391)
|
|
203
365
|
* [[`d47399fe25`](https://github.com/nodejs/node-addon-api/commit/d47399fe25)] - **src**: guard CallbackScope with N-API v3 (Michael Dawson) [#395](https://github.com/nodejs/node-addon-api/pull/395)
|
|
@@ -222,7 +384,7 @@ associated with a callback in place when making certain N-API calls
|
|
|
222
384
|
- Added tests for `Napi::Array` class.
|
|
223
385
|
- Added tests for `Napi::ArrayBuffer` class.
|
|
224
386
|
|
|
225
|
-
###
|
|
387
|
+
### Commits
|
|
226
388
|
|
|
227
389
|
* [[`8ce605c657`](https://github.com/nodejs/node-addon-api/commit/8ce605c657)] - **build**: avoid using package-lock.json (Jaeseok Yoon) [#359](https://github.com/nodejs/node-addon-api/pull/359)
|
|
228
390
|
* [[`fa3a6150b3`](https://github.com/nodejs/node-addon-api/commit/fa3a6150b3)] - **src**: use MakeCallback() -\> Call() in AsyncWorker (Jinho Bang) [#361](https://github.com/nodejs/node-addon-api/pull/361)
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ It is important to remember that *other* Node.js interfaces such as
|
|
|
21
21
|
`libuv` (included in a project via `#include <uv.h>`) are not ABI-stable across
|
|
22
22
|
Node.js major versions. Thus, an addon must use N-API and/or `node-addon-api`
|
|
23
23
|
exclusively and build against a version of Node.js that includes an
|
|
24
|
-
implementation of N-API (meaning
|
|
24
|
+
implementation of N-API (meaning an active LTS version of Node.js) in
|
|
25
25
|
order to benefit from ABI stability across Node.js major versions. Node.js
|
|
26
26
|
provides an [ABI stability guide][] containing a detailed explanation of ABI
|
|
27
27
|
stability in general, and the N-API ABI stability guarantee in particular.
|
|
@@ -37,16 +37,21 @@ APIs exposed by node-addon-api are generally used to create and
|
|
|
37
37
|
manipulate JavaScript values. Concepts and operations generally map
|
|
38
38
|
to ideas specified in the **ECMA262 Language Specification**.
|
|
39
39
|
|
|
40
|
+
The [N-API Resource](http://nodejs.github.io/node-addon-examples/) offers an
|
|
41
|
+
excellent orientation and tips for developers just getting started with N-API
|
|
42
|
+
and node-addon-api.
|
|
43
|
+
|
|
40
44
|
- **[Setup](#setup)**
|
|
41
45
|
- **[API Documentation](#api)**
|
|
42
46
|
- **[Examples](#examples)**
|
|
43
47
|
- **[Tests](#tests)**
|
|
44
48
|
- **[More resource and info about native Addons](#resources)**
|
|
49
|
+
- **[Badges](#badges)**
|
|
45
50
|
- **[Code of Conduct](CODE_OF_CONDUCT.md)**
|
|
46
51
|
- **[Contributors](#contributors)**
|
|
47
52
|
- **[License](#license)**
|
|
48
53
|
|
|
49
|
-
## **Current version:
|
|
54
|
+
## **Current version: 3.0.2**
|
|
50
55
|
|
|
51
56
|
(See [CHANGELOG.md](CHANGELOG.md) for complete Changelog)
|
|
52
57
|
|
|
@@ -54,6 +59,13 @@ to ideas specified in the **ECMA262 Language Specification**.
|
|
|
54
59
|
|
|
55
60
|
<a name="setup"></a>
|
|
56
61
|
|
|
62
|
+
node-addon-api is based on [N-API](https://nodejs.org/api/n-api.html) and supports using different N-API versions.
|
|
63
|
+
This allows addons built with it to run with Node.js versions which support the targeted N-API version.
|
|
64
|
+
**However** the node-addon-api support model is to support only the active LTS Node.js versions. This means that
|
|
65
|
+
every year there will be a new major which drops support for the Node.js LTS version which has gone out of service.
|
|
66
|
+
|
|
67
|
+
The oldest Node.js version supported by the current version of node-addon-api is Node.js 10.x.
|
|
68
|
+
|
|
57
69
|
## Setup
|
|
58
70
|
- [Installation and usage](doc/setup.md)
|
|
59
71
|
- [node-gyp](doc/node-gyp.md)
|
|
@@ -69,31 +81,25 @@ to ideas specified in the **ECMA262 Language Specification**.
|
|
|
69
81
|
|
|
70
82
|
The following is the documentation for node-addon-api.
|
|
71
83
|
|
|
72
|
-
- [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- [String](doc/string.md)
|
|
76
|
-
- [Name](doc/basic_types.md#name)
|
|
77
|
-
- [Number](doc/number.md)
|
|
78
|
-
- [Date](doc/date.md)
|
|
79
|
-
- [BigInt](doc/bigint.md)
|
|
80
|
-
- [Boolean](doc/boolean.md)
|
|
84
|
+
- [Full Class Hierarchy](doc/hierarchy.md)
|
|
85
|
+
- [Addon Structure](doc/addon.md)
|
|
86
|
+
- Data Types:
|
|
81
87
|
- [Env](doc/env.md)
|
|
82
|
-
- [Value](doc/value.md)
|
|
83
88
|
- [CallbackInfo](doc/callbackinfo.md)
|
|
84
89
|
- [Reference](doc/reference.md)
|
|
85
|
-
- [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
- [Value](doc/value.md)
|
|
91
|
+
- [Name](doc/name.md)
|
|
92
|
+
- [Symbol](doc/symbol.md)
|
|
93
|
+
- [String](doc/string.md)
|
|
94
|
+
- [Number](doc/number.md)
|
|
95
|
+
- [Date](doc/date.md)
|
|
96
|
+
- [BigInt](doc/bigint.md)
|
|
97
|
+
- [Boolean](doc/boolean.md)
|
|
98
|
+
- [External](doc/external.md)
|
|
99
|
+
- [Object](doc/object.md)
|
|
100
|
+
- [Array](doc/array.md)
|
|
101
|
+
- [ObjectReference](doc/object_reference.md)
|
|
102
|
+
- [PropertyDescriptor](doc/property_descriptor.md)
|
|
97
103
|
- [Function](doc/function.md)
|
|
98
104
|
- [FunctionReference](doc/function_reference.md)
|
|
99
105
|
- [ObjectWrap](doc/object_wrap.md)
|
|
@@ -103,11 +109,18 @@ The following is the documentation for node-addon-api.
|
|
|
103
109
|
- [TypedArray](doc/typed_array.md)
|
|
104
110
|
- [TypedArrayOf](doc/typed_array_of.md)
|
|
105
111
|
- [DataView](doc/dataview.md)
|
|
112
|
+
- [Error Handling](doc/error_handling.md)
|
|
113
|
+
- [Error](doc/error.md)
|
|
114
|
+
- [TypeError](doc/type_error.md)
|
|
115
|
+
- [RangeError](doc/range_error.md)
|
|
116
|
+
- [Object Lifetime Management](doc/object_lifetime_management.md)
|
|
117
|
+
- [HandleScope](doc/handle_scope.md)
|
|
118
|
+
- [EscapableHandleScope](doc/escapable_handle_scope.md)
|
|
106
119
|
- [Memory Management](doc/memory_management.md)
|
|
107
120
|
- [Async Operations](doc/async_operations.md)
|
|
108
121
|
- [AsyncWorker](doc/async_worker.md)
|
|
109
122
|
- [AsyncContext](doc/async_context.md)
|
|
110
|
-
- [
|
|
123
|
+
- [AsyncWorker Variants](doc/async_worker_variants.md)
|
|
111
124
|
- [Thread-safe Functions](doc/threadsafe_function.md)
|
|
112
125
|
- [Promises](doc/promises.md)
|
|
113
126
|
- [Version management](doc/version_management.md)
|
|
@@ -160,26 +173,63 @@ npm run-script dev:incremental
|
|
|
160
173
|
|
|
161
174
|
Take a look and get inspired by our **[test suite](https://github.com/nodejs/node-addon-api/tree/master/test)**
|
|
162
175
|
|
|
163
|
-
|
|
176
|
+
### **Benchmarks**
|
|
164
177
|
|
|
165
|
-
|
|
178
|
+
You can run the available benchmarks using the following command:
|
|
166
179
|
|
|
167
|
-
|
|
168
|
-
|
|
180
|
+
```
|
|
181
|
+
npm run-script benchmark
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
See [benchmark/README.md](benchmark/README.md) for more details about running and adding benchmarks.
|
|
185
|
+
|
|
186
|
+
<a name="resources"></a>
|
|
169
187
|
|
|
170
188
|
### **More resource and info about native Addons**
|
|
171
189
|
- **[C++ Addons](https://nodejs.org/dist/latest/docs/api/addons.html)**
|
|
172
190
|
- **[N-API](https://nodejs.org/dist/latest/docs/api/n-api.html)**
|
|
173
191
|
- **[N-API - Next Generation Node API for Native Modules](https://youtu.be/-Oniup60Afs)**
|
|
174
192
|
|
|
193
|
+
As node-addon-api's core mission is to expose the plain C N-API as C++
|
|
194
|
+
wrappers, tools that facilitate n-api/node-addon-api providing more
|
|
195
|
+
convenient patterns on developing a Node.js add-ons with n-api/node-addon-api
|
|
196
|
+
can be published to NPM as standalone packages. It is also recommended to tag
|
|
197
|
+
such packages with `node-addon-api` to provide more visibility to the community.
|
|
198
|
+
|
|
199
|
+
Quick links to NPM searches: [keywords:node-addon-api](https://www.npmjs.com/search?q=keywords%3Anode-addon-api).
|
|
200
|
+
|
|
201
|
+
<a name="badges"></a>
|
|
202
|
+
|
|
203
|
+
### **Badges**
|
|
204
|
+
|
|
205
|
+
The use of badges is recommended to indicate the minimum version of N-API
|
|
206
|
+
required for the module. This helps to determine which Node.js major versions are
|
|
207
|
+
supported. Addon maintainers can consult the [N-API support matrix][] to determine
|
|
208
|
+
which Node.js versions provide a given N-API version. The following badges are
|
|
209
|
+
available:
|
|
210
|
+
|
|
211
|
+

|
|
212
|
+

|
|
213
|
+

|
|
214
|
+

|
|
215
|
+

|
|
216
|
+

|
|
217
|
+

|
|
218
|
+
|
|
219
|
+
## **Contributing**
|
|
220
|
+
|
|
221
|
+
We love contributions from the community to **node-addon-api**!
|
|
222
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details on our philosophy around extending this module.
|
|
223
|
+
|
|
175
224
|
<a name="contributors"></a>
|
|
176
225
|
|
|
177
|
-
##
|
|
226
|
+
## Team members
|
|
178
227
|
|
|
179
228
|
### Active
|
|
180
229
|
| Name | GitHub Link |
|
|
181
230
|
| ------------------- | ----------------------------------------------------- |
|
|
182
231
|
| Anna Henningsen | [addaleax](https://github.com/addaleax) |
|
|
232
|
+
| Chengzhong Wu | [legendecas](https://github.com/legendecas) |
|
|
183
233
|
| Gabriel Schulhof | [gabrielschulhof](https://github.com/gabrielschulhof) |
|
|
184
234
|
| Hitesh Kanwathirtha | [digitalinfinity](https://github.com/digitalinfinity) |
|
|
185
235
|
| Jim Schlight | [jschlight](https://github.com/jschlight) |
|
|
@@ -201,3 +251,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more details on our philosophy around
|
|
|
201
251
|
Licensed under [MIT](./LICENSE.md)
|
|
202
252
|
|
|
203
253
|
[ABI stability guide]: https://nodejs.org/en/docs/guides/abi-stability/
|
|
254
|
+
[N-API support matrix]: https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api_version_matrix
|
package/appveyor.yml
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
environment:
|
|
2
2
|
# https://github.com/jasongin/nvs/blob/master/doc/CI.md
|
|
3
3
|
NVS_VERSION: 1.4.2
|
|
4
|
-
fast_finish: true
|
|
5
4
|
matrix:
|
|
6
|
-
- NODEJS_VERSION: node/4
|
|
7
|
-
- NODEJS_VERSION: node/6
|
|
8
|
-
- NODEJS_VERSION: node/8
|
|
9
|
-
- NODEJS_VERSION: node/9
|
|
10
5
|
- NODEJS_VERSION: node/10
|
|
11
|
-
- NODEJS_VERSION:
|
|
12
|
-
- NODEJS_VERSION:
|
|
6
|
+
- NODEJS_VERSION: node/12
|
|
7
|
+
- NODEJS_VERSION: node/14
|
|
13
8
|
- 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
9
|
|
|
10
|
+
os: Visual Studio 2017
|
|
22
11
|
platform:
|
|
23
12
|
- x86
|
|
24
13
|
- x64
|
|
@@ -0,0 +1,47 @@
|
|
|
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.
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
}
|