Skip to content

Commit

Permalink
Merge pull request #4 from NickNaso/docs
Browse files Browse the repository at this point in the history
improved documentation and fix on include_dir.
  • Loading branch information
mhdawson committed Sep 3, 2021
2 parents 15b9d14 + 658e062 commit d68505e
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
58 changes: 56 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<a name="introduction"></a>

## Introduction

The **node-api-headers** moldule contains the header files for the C based
Node-API provided by Node.js.
**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.

**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.

<a name="install"></a>

## Install

```
npm i node-api-headers
```

<a name="api"></a>

## 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_symbols: [
// List of symbols in js_native_api.h for the version 1.
],
node_api_symbols: [
// List of symbols in node_api.h for the version 1
]
},
// ...
```

<a name="team"></a>

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d68505e

Please sign in to comment.