Skip to content

Commit 0eaeaea

Browse files
Gabriel Schulhoftargos
Gabriel Schulhof
authored andcommittedMay 1, 2021
doc: rename N-API to Node-API
Refs: nodejs/abi-stable-node#420 PR-URL: #37259 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent f476c6d commit 0eaeaea

File tree

6 files changed

+178
-177
lines changed

6 files changed

+178
-177
lines changed
 

‎doc/api/addons.md

+13-12
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ _Addons_ are dynamically-linked shared objects written in C++. The
77
[`require()`][require] function can load addons as ordinary Node.js modules.
88
Addons provide an interface between JavaScript and C/C++ libraries.
99

10-
There are three options for implementing addons: N-API, nan, or direct
10+
There are three options for implementing addons: Node-API, nan, or direct
1111
use of internal V8, libuv and Node.js libraries. Unless there is a need for
12-
direct access to functionality which is not exposed by N-API, use N-API.
13-
Refer to [C/C++ addons with N-API](n-api.md) for more information on N-API.
12+
direct access to functionality which is not exposed by Node-API, use Node-API.
13+
Refer to [C/C++ addons with Node-API](n-api.md) for more information on
14+
Node-API.
1415

15-
When not using N-API, implementing addons is complicated,
16+
When not using Node-API, implementing addons is complicated,
1617
involving knowledge of several components and APIs:
1718

1819
* V8: the C++ library Node.js uses to provide the
@@ -243,7 +244,7 @@ changes:
243244
In order to be loaded from multiple Node.js environments,
244245
such as a main thread and a Worker thread, an add-on needs to either:
245246
246-
* Be an N-API addon, or
247+
* Be an Node-API addon, or
247248
* Be declared as context-aware using `NODE_MODULE_INIT()` as described above
248249
249250
In order to support [`Worker`][] threads, addons need to clean up any resources
@@ -435,11 +436,11 @@ addon developers are recommended to use to keep compatibility between past and
435436
future releases of V8 and Node.js. See the `nan` [examples][] for an
436437
illustration of how it can be used.
437438

438-
## N-API
439+
## Node-API
439440

440441
> Stability: 2 - Stable
441442
442-
N-API is an API for building native addons. It is independent from
443+
Node-API is an API for building native addons. It is independent from
443444
the underlying JavaScript runtime (e.g. V8) and is maintained as part of
444445
Node.js itself. This API will be Application Binary Interface (ABI) stable
445446
across versions of Node.js. It is intended to insulate addons from
@@ -449,17 +450,17 @@ recompilation. Addons are built/packaged with the same approach/tools
449450
outlined in this document (node-gyp, etc.). The only difference is the
450451
set of APIs that are used by the native code. Instead of using the V8
451452
or [Native Abstractions for Node.js][] APIs, the functions available
452-
in the N-API are used.
453+
in the Node-API are used.
453454

454455
Creating and maintaining an addon that benefits from the ABI stability
455-
provided by N-API carries with it certain
456+
provided by Node-API carries with it certain
456457
[implementation considerations](n-api.md#n_api_implications_of_abi_stability).
457458

458-
To use N-API in the above "Hello world" example, replace the content of
459+
To use Node-API in the above "Hello world" example, replace the content of
459460
`hello.cc` with the following. All other instructions remain the same.
460461

461462
```cpp
462-
// hello.cc using N-API
463+
// hello.cc using Node-API
463464
#include <node_api.h>
464465

465466
namespace demo {
@@ -491,7 +492,7 @@ NAPI_MODULE(NODE_GYP_MODULE_NAME, init)
491492
```
492493
493494
The functions available and how to use them are documented in
494-
[C/C++ addons with N-API](n-api.md).
495+
[C/C++ addons with Node-API](n-api.md).
495496
496497
## Addon examples
497498

‎doc/api/errors.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,7 @@ would be possible by calling a callback more than once.
16421642
<a id="ERR_NAPI_CONS_FUNCTION"></a>
16431643
### `ERR_NAPI_CONS_FUNCTION`
16441644

1645-
While using `N-API`, a constructor passed was not a function.
1645+
While using `Node-API`, a constructor passed was not a function.
16461646

16471647
<a id="ERR_NAPI_INVALID_DATAVIEW_ARGS"></a>
16481648
### `ERR_NAPI_INVALID_DATAVIEW_ARGS`
@@ -2361,7 +2361,7 @@ added: v9.0.0
23612361
removed: v10.0.0
23622362
-->
23632363

2364-
Used by the `N-API` when `Constructor.prototype` is not an object.
2364+
Used by the `Node-API` when `Constructor.prototype` is not an object.
23652365

23662366
<a id="ERR_NO_LONGER_SUPPORTED"></a>
23672367
### `ERR_NO_LONGER_SUPPORTED`

‎doc/api/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* [Async hooks](async_hooks.md)
1515
* [Buffer](buffer.md)
1616
* [C++ addons](addons.md)
17-
* [C/C++ addons with N-API](n-api.md)
17+
* [C/C++ addons with Node-API](n-api.md)
1818
* [C++ embedder API](embedding.md)
1919
* [Child processes](child_process.md)
2020
* [Cluster](cluster.md)

‎doc/api/n-api.md

+149-149
Large diffs are not rendered by default.

‎doc/guides/adding-new-napi-api.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Contributing a new API to N-API
1+
# Contributing a new API to Node-API
22

3-
N-API is the next-generation ABI-stable API for native modules.
3+
Node-API is the next-generation ABI-stable API for native modules.
44
While improving the API surface is encouraged and welcomed, the following are
55
a set of principles and guidelines to keep in mind while adding a new
6-
N-API API.
6+
Node-API.
77

8-
* A new API **must** adhere to N-API API shape and spirit.
8+
* A new API **must** adhere to Node-API API shape and spirit.
99
* **Must** be a C API.
1010
* **Must** not throw exceptions.
1111
* **Must** return `napi_status`.
@@ -14,7 +14,7 @@ N-API API.
1414
datatypes or opaque handles.
1515
* **Must** be a necessary API and not a nice to have. Convenience APIs
1616
belong in node-addon-api.
17-
* **Must** not change the signature of an existing N-API API or break
17+
* **Must** not change the signature of an existing Node-API API or break
1818
ABI compatibility with other versions of Node.js.
1919
* New API **should** be agnostic towards the underlying JavaScript VM.
2020
* New API PRs **must** have a corresponding documentation update.
@@ -23,9 +23,9 @@ N-API API.
2323
* There **should** be at least one test case per interesting use of the API.
2424
* There **should** be a sample provided that operates in a realistic way
2525
(operating how a real addon would be written).
26-
* A new API **should** be discussed at the N-API team meeting.
26+
* A new API **should** be discussed at the Node-API team meeting.
2727
* A new API addition **must** be signed off by at least two members of
28-
the N-API team.
28+
the Node-API team.
2929
* A new API addition **should** be simultaneously implemented in at least
3030
one other VM implementation of Node.js.
3131
* A new API **must** be considered experimental for at least one minor

‎doc/guides/collaborator-guide.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* [Unintended breaking changes](#unintended-breaking-changes)
2323
* [Reverting commits](#reverting-commits)
2424
* [Introducing new modules](#introducing-new-modules)
25-
* [Additions to N-API](#additions-to-n-api)
25+
* [Additions to Node-API](#additions-to-n-api)
2626
* [Deprecations](#deprecations)
2727
* [Involving the TSC](#involving-the-tsc)
2828
* [Landing pull requests](#landing-pull-requests)
@@ -373,12 +373,12 @@ For pull requests introducing new core modules:
373373
* Land with a [Stability Index][] of Experimental. The module must remain
374374
Experimental until a semver-major release.
375375

376-
### Additions to N-API
376+
### Additions to Node-API
377377

378-
N-API provides an ABI-stable API guaranteed for future Node.js versions. N-API
379-
additions call for unusual care and scrutiny. If a change adds to `node_api.h`,
380-
`js_native_api.h`, `node_api_types.h`, or `js_native_api_types.h`, consult [the relevant
381-
guide](https://github.com/nodejs/node/blob/master/doc/guides/adding-new-napi-api.md).
378+
Node-API provides an ABI-stable API guaranteed for future Node.js versions.
379+
Node-API additions call for unusual care and scrutiny. If a change adds to
380+
`node_api.h`, `js_native_api.h`, `node_api_types.h`, or `js_native_api_types.h`,
381+
consult [the relevant guide](https://github.com/nodejs/node/blob/master/doc/guides/adding-new-napi-api.md).
382382

383383
### Deprecations
384384

0 commit comments

Comments
 (0)
Please sign in to comment.