From 77c4e8706187a9a98d3723892401a22758132cda Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 1 Aug 2019 09:51:03 -0400 Subject: [PATCH 1/6] doc: mention N-API as recommended approach We've had a few comments that from the doc it might not be clear that N-API is the recommended approach for Addons. As a start, mention N-API early in the non N-API section as the recommended approach unless lower level access is required. --- doc/api/addons.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index a75d287dce156a..252d0f21bb6cee 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -8,7 +8,13 @@ can be loaded into Node.js using the [`require()`][require] function, and used just as if they were an ordinary Node.js module. They are used primarily to provide an interface between JavaScript running in Node.js and C/C++ libraries. -At the moment, the method for implementing Addons is rather complicated, +There are currently two options for implementing Addons: N-API or direct +use of internal V8, libuv and Node.js libraries. Unless you need direct +access to functionality which is not exposed by N-API, N-API is the +recommended approach. Refer to the section [C/C++ Addons - N-API](n-api.html) +for more information on N-API. + +When not using N-API, the method for implementing Addons is rather complicated, involving knowledge of several components and APIs: - V8: the C++ library Node.js currently uses to provide the From 4a0d4e24f9ae35803bf0dcca7ac7cc895cfe4053 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 1 Aug 2019 15:07:50 -0400 Subject: [PATCH 2/6] squash: address comments --- doc/api/addons.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index 252d0f21bb6cee..e57154de5376ac 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -8,7 +8,7 @@ can be loaded into Node.js using the [`require()`][require] function, and used just as if they were an ordinary Node.js module. They are used primarily to provide an interface between JavaScript running in Node.js and C/C++ libraries. -There are currently two options for implementing Addons: N-API or direct +There are currently three options for implementing Addons: N-API, nan, or direct use of internal V8, libuv and Node.js libraries. Unless you need direct access to functionality which is not exposed by N-API, N-API is the recommended approach. Refer to the section [C/C++ Addons - N-API](n-api.html) From 0cf210e8873109c4b925f2dc5ef684e6f9416f7c Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 14 Aug 2019 16:56:50 -0400 Subject: [PATCH 3/6] Update doc/api/addons.md Co-Authored-By: Rich Trott --- doc/api/addons.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index e57154de5376ac..7c8a56dcd079a4 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -14,7 +14,7 @@ access to functionality which is not exposed by N-API, N-API is the recommended approach. Refer to the section [C/C++ Addons - N-API](n-api.html) for more information on N-API. -When not using N-API, the method for implementing Addons is rather complicated, +When not using N-API, implementing Addons is complicated, involving knowledge of several components and APIs: - V8: the C++ library Node.js currently uses to provide the From 22c7d38325b2413ed83635fee9ac2399ff53e67e Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 14 Aug 2019 16:57:05 -0400 Subject: [PATCH 4/6] Update doc/api/addons.md Co-Authored-By: Rich Trott --- doc/api/addons.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index 7c8a56dcd079a4..61d2d3f10a80fa 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -10,7 +10,7 @@ provide an interface between JavaScript running in Node.js and C/C++ libraries. There are currently three options for implementing Addons: N-API, nan, or direct use of internal V8, libuv and Node.js libraries. Unless you need direct -access to functionality which is not exposed by N-API, N-API is the +access to functionality which is not exposed by N-API, use N-API. recommended approach. Refer to the section [C/C++ Addons - N-API](n-api.html) for more information on N-API. From 3e8ef6d035f343fedad06e82a18435dc2adc582c Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 14 Aug 2019 16:57:19 -0400 Subject: [PATCH 5/6] Update doc/api/addons.md Co-Authored-By: Rich Trott --- doc/api/addons.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index 61d2d3f10a80fa..40c12d04c0778a 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -11,7 +11,7 @@ provide an interface between JavaScript running in Node.js and C/C++ libraries. There are currently three options for implementing Addons: N-API, nan, or direct use of internal V8, libuv and Node.js libraries. Unless you need direct access to functionality which is not exposed by N-API, use N-API. -recommended approach. Refer to the section [C/C++ Addons - N-API](n-api.html) +Refer to the section [C/C++ Addons - N-API](n-api.html) for more information on N-API. When not using N-API, implementing Addons is complicated, From 429dd791c3b254d9505d6ca9193973271cc40ab6 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 14 Aug 2019 16:57:35 -0400 Subject: [PATCH 6/6] Update doc/api/addons.md Co-Authored-By: Rich Trott --- doc/api/addons.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index 40c12d04c0778a..b0bb330d32bbaa 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -8,7 +8,7 @@ can be loaded into Node.js using the [`require()`][require] function, and used just as if they were an ordinary Node.js module. They are used primarily to provide an interface between JavaScript running in Node.js and C/C++ libraries. -There are currently three options for implementing Addons: N-API, nan, or direct +There are three options for implementing Addons: N-API, nan, or direct use of internal V8, libuv and Node.js libraries. Unless you need direct access to functionality which is not exposed by N-API, use N-API. Refer to the section [C/C++ Addons - N-API](n-api.html)