From f1ef88731b6c6aa00a067836db752576b1c158fa Mon Sep 17 00:00:00 2001 From: NickNaso Date: Thu, 5 Aug 2021 13:48:40 +0200 Subject: [PATCH 1/4] improved documentation and fix on include_dir. --- README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- index.js | 2 +- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1110df7..06c1700 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,69 @@ - **[Introduction](#introduction)** - **[Contributing](CONTRIBUTING.md)** - **[Code of Conduct](CODE_OF_CONDUCT.md)** +- **[Install](#install)** +- **[API](#api)** - **[Team](#team)** - **[License](#license)** +## Current Node-API version: 8 + +(See [CHANGELOG.md](CHANGELOG.md) for complete Changelog) + ## Introduction -The **node-api-headers** moldule contains the header files for the C based -Node-API provided by Node.js. +The **node-api-headers** contains the header files for the C based +Node-API provided by Node.js. Node-API is an API for building native addons +that guarantees the ABI (Application Binary Interface) stability across +versions of Node.js (see: [Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html)). + +Node-API headers are in the `include` folder. The Node-APIs that provide +ECMAScript features from native code can be found in `js_native_api_types.h` +and `js_native_api.h`. The APIs defined in these headers are included in +`node_api_types.h` and `node_api.h`. +The headers are structured in this way in order to allow implementations of +Node-API outside of Node.js considering that for those implementations the +Node.js specific APIS may not be applicable. + +The **node-api-headers** is also a package published on **npm** that could +be used in a process to compile and build native addons for Node.js. + + + +## Install + +``` +npm i node-api-headers +``` + + + +## API + +The module exports two properties `include_dir` and `symbols`. +### `include_dir` + +This property is a string that represents the include path for the Node-API +headers. + +### `symbols` + +This property is an object that represents the symbols exported by Node-API +grouped by version and api types. + +```js + V1: { + js_native_api_symblos: [ + // List of symbols in js_native_api.h for the version 1. + ], + node_api_symblos: [ + // List of symbols in node_api.h for the version 1 + ] + }, + // ... +``` diff --git a/index.js b/index.js index 4714595..68192b8 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ const path = require('path'); const symbols = require('./symbols') -const include_dir = path.relative('.', __dirname, 'include'); +const include_dir = path.relative('.', `${__dirname}/include`); module.exports = { include_dir, From 3aed562c583bf27bc105d531f368a59144da6e8f Mon Sep 17 00:00:00 2001 From: NickNaso Date: Mon, 23 Aug 2021 16:22:19 +0200 Subject: [PATCH 2/4] Added requested changes - fixed typos - used path.resolve instead of path.relative. --- README.md | 4 ++-- index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 06c1700..66f619d 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,10 @@ grouped by version and api types. ```js V1: { - js_native_api_symblos: [ + js_native_api_symbols: [ // List of symbols in js_native_api.h for the version 1. ], - node_api_symblos: [ + node_api_symbols: [ // List of symbols in node_api.h for the version 1 ] }, diff --git a/index.js b/index.js index 68192b8..c19eb1c 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ const path = require('path'); const symbols = require('./symbols') -const include_dir = path.relative('.', `${__dirname}/include`); +const include_dir = path.resolve(`${__dirname}/include`); module.exports = { include_dir, From 0cb410c4f12b9cbe0a7773faf35356503cb28705 Mon Sep 17 00:00:00 2001 From: NickNaso Date: Fri, 27 Aug 2021 15:35:22 +0200 Subject: [PATCH 3/4] Fixed as requested. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index c19eb1c..83c7ea2 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ const path = require('path'); const symbols = require('./symbols') -const include_dir = path.resolve(`${__dirname}/include`); +const include_dir = path.resolve(__dirname, 'include'); module.exports = { include_dir, From 658e06261743c7b3046241130aa033dfc0b96248 Mon Sep 17 00:00:00 2001 From: NickNaso Date: Fri, 27 Aug 2021 17:17:50 +0200 Subject: [PATCH 4/4] Added requested changes. --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 66f619d..6779b43 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,10 @@ ## Introduction -The **node-api-headers** contains the header files for the C based -Node-API provided by Node.js. Node-API is an API for building native addons -that guarantees the ABI (Application Binary Interface) stability across -versions of Node.js (see: [Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html)). +**node-api-headers** contains the header files for the C-based Node-API +provided by Node.js. Node-API is an API for building native addons that +guarantees the ABI (Application Binary Interface) stability across versions +of Node.js (see: [Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html)). Node-API headers are in the `include` folder. The Node-APIs that provide ECMAScript features from native code can be found in `js_native_api_types.h` @@ -27,10 +27,10 @@ and `js_native_api.h`. The APIs defined in these headers are included in `node_api_types.h` and `node_api.h`. The headers are structured in this way in order to allow implementations of Node-API outside of Node.js considering that for those implementations the -Node.js specific APIS may not be applicable. +Node.js specific APIs may not be applicable. -The **node-api-headers** is also a package published on **npm** that could -be used in a process to compile and build native addons for Node.js. +**node-api-headers** is also a package published on **npm** that could be used +in a process to compile and build native addons for Node.js.