You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

node-addon-api

Package Overview
Dependencies
Maintainers
5
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.2 to 1.6.3

47

CHANGELOG.md
# node-addon-api Changelog
## 2018-11-29 Version 1.6.2 (Current), @NickNaso
## 2019-04-03 Version 1.6.3, @NickNaso

@@ -9,2 +9,41 @@ ### Notable changes:

- Added `SuppressDestruct` method to `Napi::AsyncWorker`.
- Added new build targets for debug.
- Exposed macros that throw errors.
- Fixed memory leaks caused by callback data when a napi error occurs.
- Fixed missing `void *data` usage in `Napi::PropertyDescriptors`.
#### Documentation
- Some minor corrections all over the documentation
### Commmits
* [[`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)
* [[`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)
* [[`b0f6b601aa`](https://github.com/nodejs/node-addon-api/commit/b0f6b601aa)] - **src**: add AsyncWorker destruction suppression (Gabriel Schulhof) [#407](https://github.com/nodejs/node-addon-api/pull/407)
* [[`72b1975cff`](https://github.com/nodejs/node-addon-api/commit/72b1975cff)] - **doc**: fix links to the Property Descriptor docs (Ryuichi Okumura) [#458](https://github.com/nodejs/node-addon-api/pull/458)
* [[`fcfc612728`](https://github.com/nodejs/node-addon-api/commit/fcfc612728)] - **build**: new build targets for debug purposes (Jinho Bang) [#186](https://github.com/nodejs/node-addon-api/pull/186)
* [[`c629553cd7`](https://github.com/nodejs/node-addon-api/commit/c629553cd7)] - **doc**: minor doc corrections and clarifications (Bruce A. MacNaughton) [#426](https://github.com/nodejs/node-addon-api/pull/426)
* [[`7b87e0b999`](https://github.com/nodejs/node-addon-api/commit/7b87e0b999)] - **doc**: update number.md (Bernardo Heynemann) [#436](https://github.com/nodejs/node-addon-api/pull/436)
* [[`fcf173d2a1`](https://github.com/nodejs/node-addon-api/commit/fcf173d2a1)] - **src**: expose macros that throw errors (Gabriel Schulhof) [#448](https://github.com/nodejs/node-addon-api/pull/448)
* [[`b409a2f987`](https://github.com/nodejs/node-addon-api/commit/b409a2f987)] - **package**: add npm search keywords (Sam Roberts) [#452](https://github.com/nodejs/node-addon-api/pull/452)
* [[`0bc7987806`](https://github.com/nodejs/node-addon-api/commit/0bc7987806)] - **doc**: fix references to Weak and Persistent (Jake Barnes) [#428](https://github.com/nodejs/node-addon-api/pull/428)
* [[`ad6f569f85`](https://github.com/nodejs/node-addon-api/commit/ad6f569f85)] - **doc**: dix typo (Abhishek Kumar Singh) [#435](https://github.com/nodejs/node-addon-api/pull/435)
* [[`28df833a49`](https://github.com/nodejs/node-addon-api/commit/28df833a49)] - Merge pull request #441 from jschlight/master (Jim Schlight)
* [[`4921e74d83`](https://github.com/nodejs/node-addon-api/commit/4921e74d83)] - Rearranges names to be alphabetical (Jim Schlight)
* [[`48220335b0`](https://github.com/nodejs/node-addon-api/commit/48220335b0)] - Membership review update (Jim Schlight)
* [[`44f0695533`](https://github.com/nodejs/node-addon-api/commit/44f0695533)] - Merge pull request #394 from NickNaso/create\_release (Nicola DelGobbo)
* [[`fa49d68416`](https://github.com/nodejs/node-addon-api/commit/fa49d68416)] - **doc**: fix some `Finalizer` signatures (Philipp Renoth) [#414](https://github.com/nodejs/node-addon-api/pull/414)
* [[`020ac4a628`](https://github.com/nodejs/node-addon-api/commit/020ac4a628)] - **src**: make `Object::GetPropertyNames()` const (Philipp Renoth)[#415](https://github.com/nodejs/node-addon-api/pull/415)
* [[`91eaa6f4cb`](https://github.com/nodejs/node-addon-api/commit/91eaa6f4cb)] - **src**: fix callbackData leaks on error napi status (Philipp Renoth) [#417](https://github.com/nodejs/node-addon-api/pull/417)
* [[`0b40275752`](https://github.com/nodejs/node-addon-api/commit/0b40275752)] - **src**: fix noexcept control flow issues (Philipp Renoth) [#420](https://github.com/nodejs/node-addon-api/pull/420)
* [[`c1ff2936f9`](https://github.com/nodejs/node-addon-api/commit/c1ff2936f9)] - **src**: fix missing void\*data usage in PropertyDescriptors (Luciano Martorella) [#374](https://github.com/nodejs/node-addon-api/pull/374)
## 2018-11-29 Version 1.6.2, @NickNaso
### Notable changes:
#### API
- Fixed selection logic for version 6.x.

@@ -16,3 +55,3 @@

## 2018-11-14 Version 1.6.1 (Current), @NickNaso
## 2018-11-14 Version 1.6.1, @NickNaso

@@ -38,3 +77,3 @@ ### Notable changes:

## 2018-11-02 Version 1.6.0 (Current), @NickNaso
## 2018-11-02 Version 1.6.0, @NickNaso

@@ -69,3 +108,3 @@ ### Notable changes:

## 2018-10-03 Version 1.5.0 (Current), @NickNaso
## 2018-10-03 Version 1.5.0, @NickNaso

@@ -72,0 +111,0 @@ ### Notable changes:

@@ -69,2 +69,11 @@ # AsyncWorker

### SuppressDestruct
```cpp
void Napi::AsyncWorker::SuppressDestruct();
```
Prevents the destruction of the `Napi::AsyncWorker` instance upon completion of
the `Napi::AsyncWorker::OnOK` callback.
### SetError

@@ -71,0 +80,0 @@

4

doc/class_property_descriptor.md

@@ -11,3 +11,3 @@ # Class propertry and descriptor

### Contructor
### Constructor

@@ -37,2 +37,2 @@ Creates new instance of `Napi::ClassPropertyDescriptor` descriptor object.

Returns the original N-API `napi_property_descriptor` wrapped inside the `Napi::ClassPropertyDescriptor`
Returns the original N-API `napi_property_descriptor` wrapped inside the `Napi::ClassPropertyDescriptor`
# Creating a release
Only collaborators in npm for node-addon-api can create releases.
Only collaborators in npm for **node-addon-api** can create releases.
If you want to be able to do releases ask one of the existing
collaborators to add you. If necessary you can ask the build
collaborators to add you. If necessary you can ask the build
Working Group who manages the Node.js npm user to add you if
there are no other active collaborators.
## Prerequisites
Before to start creating a new release check if you have installed the following
tools:
* [Changelog maker](https://www.npmjs.com/package/changelog-maker)
If not please follow the instruction reported in the tool's documentation to
install it.
## Publish new release
These are the steps to follow to create a new release:
* Open an issue in the node-addon-api repo documenting
the intent to create a new release. Give people some
time to comment or suggest PRs that should land first.
* Open an issue in the **node-addon-api** repo documenting the intent to create a
new release. Give people some time to comment or suggest PRs that should land first.
* Validate all tests pass by running npm test on master.
* Use https://ci.nodejs.org/view/x%20-%20Abi%20stable%20module%20API/job/node-test-node-addon-api/
to validate tests pass for latest 9, 8, 6, 4 releases
(note there are still some issues on SmartOS and
Windows in the testing).
* Update the version in **package.json** appropriately.
* Update the version in package.json appropriately.
* Update the [README.md](https://github.com/nodejs/node-addon-api/blob/master/README.md)
to show the new version as the latest.
* Update the README.md to show the new version as the latest.
* Generate the changelog for the new version using **changelog maker** tool. From
the route folder of the repo launch the following command:
* Add any new contributors to the "contributors" section in
the package.json
```bash
> changelog-maker
```
* Use the output generated by **changelog maker** to pdate the [CHANGELOG.md](https://github.com/nodejs/node-addon-api/blob/master/CHANGELOG.md)
following the style used in publishing the previous release.
* Add any new contributors to the "contributors" section in the package.json
* Validate all tests pass by running npm test on master.
* Use **[CI](https://ci.nodejs.org/view/x%20-%20Abi%20stable%20module%20API/job/node-test-node-addon-api/)**
to validate tests pass for latest 11, 10, 8, 6 releases (note there are still some issues on SmartOS and
Windows in the testing).
* Do a clean checkout of node-addon-api.

@@ -36,7 +57,7 @@

* Validate that you can run `npm install node-addon-api` successfully
and that the correct version is installed.
and that the correct version is installed.
* Comment on the issue opened in the first step that the
release has been created and close the issue.
* Comment on the issue opened in the first step that the release has been created
and close the issue.
* Tweet that the release has been created.

@@ -156,1 +156,32 @@ # Error handling

exception after the native callback returns.
## Calling N-API directly from a **node-addon-api** addon
**node-addon-api** provides macros for throwing errors in response to non-OK
`napi_status` results when calling [N-API](https://nodejs.org/docs/latest/api/n-api.html)
functions from within a native addon. These macros are defined differently
depending on whether C++ exceptions are enabled or not, but are available for
use in either case.
### `NAPI_THROW(e, ...)`
This macro accepts a `Napi::Error`, throws it, and returns the value given as
the last parameter. If C++ exceptions are enabled (by defining
`NAPI_CPP_EXCEPTIONS` during the build), the return value will be ignored.
### `NAPI_THROW_IF_FAILED(env, status, ...)`
This macro accepts a `Napi::Env` and a `napi_status`. It constructs an error
from the `napi_status`, throws it, and returns the value given as the last
parameter. If C++ exceptions are enabled (by defining `NAPI_CPP_EXCEPTIONS`
during the build), the return value will be ignored.
### `NAPI_THROW_IF_FAILED_VOID(env, status)`
This macro accepts a `Napi::Env` and a `napi_status`. It constructs an error
from the `napi_status`, throws it, and returns.
### `NAPI_FATAL_IF_FAILED(status, location, message)`
This macro accepts a `napi_status`, a C string indicating the location where the
error occurred, and a second C string for the message to display.

@@ -26,3 +26,3 @@ # FunctionReference

```cpp
static Napi::FunctionReference Napi::FunctionReference::Weak(const Napi::Function& value);
static Napi::FunctionReference Napi::Weak(const Napi::Function& value);
```

@@ -40,3 +40,3 @@

```cpp
static Napi::FunctionReference Napi::FunctionReference::Persistent(const Napi::Function& value);
static Napi::FunctionReference Napi::Persistent(const Napi::Function& value);
```

@@ -43,0 +43,0 @@

@@ -27,4 +27,4 @@ # Number

- `[in] env`: The `napi_env` environment in which to construct the `Napi::Nuber` object.
- `[in] value`: The `napi_value` which is a handle for a JavaScript `Number`.
- `[in] env`: The `napi_env` environment in which to construct the `Napi::Number` object.
- `[in] value`: The JavaScript value holding a number.

@@ -40,4 +40,4 @@ Returns a non-empty `Napi::Number` object.

```
- `[in] env`: The `napi_env` environment in which to construct the `Napi::Nuber` object.
- `[in] value`: The `napi_value` which is a handle for a JavaScript `Number`.
- `[in] env`: The `napi_env` environment in which to construct the `Napi::Number` object.
- `[in] value`: The C++ primitive from which to instantiate the `Napi::Number`.

@@ -48,3 +48,3 @@ Creates a new instance of a `Napi::Number` object.

Converts a `Napi::Number` value to a `uint32_t` primitive type.
Converts a `Napi::Number` value to a `int32_t` primitive type.

@@ -51,0 +51,0 @@ ```cpp

@@ -43,3 +43,3 @@ # Object Reference

```cpp
static Napi::ObjectReference Napi::ObjectReference::Weak(const Napi::Object& value);
static Napi::ObjectReference Napi::Weak(const Napi::Object& value);
```

@@ -54,3 +54,3 @@

```cpp
static Napi::ObjectReference Napi::ObjectReference::Persistent(const Napi::Object& value);
static Napi::ObjectReference Napi::Persistent(const Napi::Object& value);
```

@@ -57,0 +57,0 @@

@@ -119,3 +119,3 @@ # Object Wrap

### Contructor
### Constructor

@@ -122,0 +122,0 @@ Creates a new instance of a JavaScript object that wraps native instance.

@@ -111,3 +111,3 @@ # Object

Returns the [`Napi::Value`](value.md) associated with the key property. Returns NULL if no such key exists.
Returns the [`Napi::Value`](value.md) associated with the key property. Returns the value *undefined* if the key does not exist.

@@ -146,3 +146,3 @@ The `key` can be any of the following types:

```
- `[in] property`: A [`Napi::PropertyDescriptor`](propertydescriptor.md).
- `[in] property`: A [`Napi::PropertyDescriptor`](property_descriptor.md).

@@ -156,3 +156,3 @@ Define a property on the object.

```
- `[in] properties`: A list of [`Napi::PropertyDescriptor`](propertydescriptor.md). Can be one of the following types:
- `[in] properties`: A list of [`Napi::PropertyDescriptor`](property_descriptor.md). Can be one of the following types:
- const std::initializer_list<Napi::PropertyDescriptor>&

@@ -159,0 +159,0 @@ - const std::vector<Napi::PropertyDescriptor>&

@@ -195,3 +195,3 @@ # Property Descriptor

* `[in] env`: The environemnt in which to create this accessor.
* `[in] env`: The environment in which to create this accessor.
* `[in] name`: The name of the Callable function.

@@ -198,0 +198,0 @@ * `[in] cb`: The function

@@ -58,4 +58,15 @@ # Setup

```
4. If you would like your native addon to support OSX, please also add the
following settings in the `binding.gyp` file:
4. Include `napi.h` in the native module code.
```gyp
['OS=="mac"', {
'cflags+': ['-fvisibility=hidden'],
'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
}
}]
```
5. Include `napi.h` in the native module code.
To ensure only ABI-stable APIs are used, DO NOT include

@@ -62,0 +73,0 @@ `node.h`, `nan.h`, or `v8.h`.

@@ -6,2 +6,3 @@ {

"contributors": [
"Abhishek Kumar Singh (https://github.com/abhi11210646)",
"Andrew Petersen (https://github.com/kirbysayshi)",

@@ -14,2 +15,4 @@ "Anisha Rohra (https://github.com/anisha-rohra)",

"Benjamin Byholm (https://github.com/kkoopa)",
"Bill Gallafent (https://github.com/gallafent)",
"Bruce A. MacNaughton (https://github.com/bmacnaughton)",
"Cory Mickelson (https://github.com/corymickelson)",

@@ -22,2 +25,3 @@ "David Halls (https://github.com/davedoesdev)",

"Hitesh Kanwathirtha (https://github.com/digitalinfinity)",
"Jake Barnes (https://github.com/DuBistKomisch)",
"Jake Yoon (https://github.com/yjaeseok)",

@@ -30,2 +34,3 @@ "Jason Ginchereau (https://github.com/jasongin)",

"Kyle Farnung (https://github.com/kfarnung)",
"Luciano Martorella (https://github.com/lmartorella)",
"Matteo Collina (https://github.com/mcollina)",

@@ -39,3 +44,5 @@ "Michael Dawson (https://github.com/mhdawson)",

"Rolf Timmermans (https://github.com/rolftimmermans)",
"Ryuichi Okumura (https://github.com/okuryu)",
"Sampson Gao (https://github.com/sampsongao)",
"Sam Roberts (https://github.com/sam-github)",
"Taylor Woll (https://github.com/boingoing)",

@@ -51,2 +58,3 @@ "Thomas Gentilhomme (https://github.com/fraxken)"

"homepage": "https://github.com/nodejs/node-addon-api",
"keywords": ["n-api", "napi", "addon", "native", "bindings", "c", "c++", "nan", "node-addon-api"],
"license": "MIT",

@@ -64,5 +72,9 @@ "main": "index.js",

"test": "node test",
"predev": "node-gyp rebuild -C test --debug",
"dev": "node test",
"predev:incremental": "node-gyp configure build -C test --debug",
"dev:incremental": "node test",
"doc": "doxygen doc/Doxyfile"
},
"version": "1.6.2"
"version": "1.6.3"
}

@@ -49,3 +49,3 @@ # **node-addon-api module**

## **Current version: 1.6.2**
## **Current version: 1.6.3**

@@ -145,2 +145,16 @@ (See [CHANGELOG.md](CHANGELOG.md) for complete Changelog)

### **Debug**
To run the **node-addon-api** tests with `--debug` option:
```
npm run-script dev
```
If you want faster build, you might use the following option:
```
npm run-script dev:incremental
```
Take a look and get inspired by our **[test suite](https://github.com/nodejs/node-addon-api/tree/master/test)**

@@ -157,16 +171,23 @@

### WG Members / Collaborators
| Name | GitHub link |
## WG Members / Collaborators
### Active
| Name | GitHub Link |
| ------------------- | ----------------------------------------------------- |
| Anna Henningsen | [addaleax](https://github.com/addaleax) |
| Arunesh Chandra | [aruneshchandra](https://github.com/aruneshchandra) |
| Benjamin Byholm | [kkoopa](https://github.com/kkoopa) |
| Gabriel Schulhof | [gabrielschulhof](https://github.com/gabrielschulhof) |
| Hitesh Kanwathirtha | [digitalinfinity](https://github.com/digitalinfinity) |
| Jason Ginchereau | [jasongin](https://github.com/jasongin) |
| Jim Schlight | [jschlight](https://github.com/jschlight) |
| Michael Dawson | [mhdawson](https://github.com/mhdawson) |
| Nicola Del Gobbo | [NickNaso](https://github.com/NickNaso) |
| Sampson Gao | [sampsongao](https://github.com/sampsongao) |
| Taylor Woll | [boingoing](https://github.com/boingoing) |
### Emeritus
| Name | GitHub Link |
| ------------------- | ----------------------------------------------------- |
| Benjamin Byholm | [kkoopa](https://github.com/kkoopa) |
| Jason Ginchereau | [jasongin](https://github.com/jasongin) |
| Sampson Gao | [sampsongao](https://github.com/sampsongao) |
<a name="license"></a>

@@ -173,0 +194,0 @@

@@ -28,3 +28,3 @@ # Migration Script

### Major Reconstructions
The implementation of `Napi::ObjectWrap` is significantly different from NAN's. `Napi::ObjectWrap` takes a pointer to the wrapped object and creates a reference to the wrapped object inside ObjectWrap constructor. `Napi::ObjectWrap` also associated wrapped object's instance methods to Javascript module instead of static methods like NAN.
The implementation of `Napi::ObjectWrap` is significantly different from NAN's. `Napi::ObjectWrap` takes a pointer to the wrapped object and creates a reference to the wrapped object inside ObjectWrap constructor. `Napi::ObjectWrap` also associates wrapped object's instance methods to Javascript module instead of static methods like NAN.

@@ -43,3 +43,3 @@ So if you use Nan::ObjectWrap in your module, you will need to execute the following steps.

```
This way, the `Napi::ObjectWrap` constructor will be invoked after the object has been instanciated and `Napi::ObjectWrap` can use the `this` pointer to create reference to the wrapped object.
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.

@@ -46,0 +46,0 @@ 2. Move your original constructor code into the new constructor. Delete your original constructor.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc