Commit Graph

11 Commits (8975748527a82d2dcfd6168ada30359f39de91ba)

Author SHA1 Message Date
Chengzhong Wu a81788cb27
node-api: type tag external values without v8::Private
v8::External can not have any properties and private properties. Type
tag v8::External with a wrapper struct without setting a private
property on the v8::External.

PR-URL: https://github.com/nodejs/node/pull/51149
Fixes: https://github.com/nodejs/node-v8/issues/273
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com>
2023-12-22 09:34:51 +00:00
Chengzhong Wu e7a1fab25f
test: define NAPI_VERSION before including node_api.h
Include node.h first to define NAPI_VERSION that node binary is built
with. The node.h should also be included first in embedder's use case
since it is the primary header file.

PR-URL: https://github.com/nodejs/node/pull/48376
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2023-06-24 17:04:08 +00:00
Vladimir Morozov c542d3a1d3 node-api: get Node API version used by addon
PR-URL: https://github.com/nodejs/node/pull/45715
Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2023-05-05 11:00:27 -04:00
Vladimir Morozov 5e4f5e122c node-api: deprecate napi_module_register
PR-URL: https://github.com/nodejs/node/pull/46319
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2023-03-24 14:00:40 -04:00
Anna Henningsen cd43073ce2
src: fix multiple AddLinkedBinding() calls
Singly-linked lists are extended at their tail, not their head.
This fixes using more than 2 linked addons at a time.

PR-URL: https://github.com/nodejs/node/pull/39012
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2021-06-14 13:30:50 +02:00
Anna Henningsen ff38165820 src: allow N-API addon in `AddLinkedBinding()`
`AddLinkedBinding()` can be used to load old-style Node.js addons, but
currently not N-API addons. There’s no good reason not to support
N-API addons as well, so add that.

PR-URL: https://github.com/nodejs/node/pull/35301
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
2020-09-26 08:22:47 +00:00
Anna Henningsen a038199265
src,doc,test: remove String::New default parameter
`kNormal` has been the implicit default for a while now (since V8 7.6).

Refs: e0d7f81699

PR-URL: https://github.com/nodejs/node/pull/34248
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-07-14 15:13:34 +02:00
Anna Henningsen e460e14d57 src: allow adding linked bindings to Environment
This allows manually adding linked bindings to an `Environment`
instance, without having to register modules at program load in
a global namespace.

PR-URL: https://github.com/nodejs/node/pull/30274
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-11-07 19:51:11 -08:00
Sam Roberts d3c2287e59 src: declare unused priv argument
PR-URL: https://github.com/nodejs/node/pull/27631
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-05-13 13:43:17 -07:00
Yang Guo c5e619b8ff test: remove unnecessary semicolon after macro
PR-URL: https://github.com/nodejs/node/pull/26618
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2019-03-16 14:40:19 +05:30
Anna Henningsen db2a5b05df
src: add public API for linked bindings
(Re-?)add a public API for creating linked bindings (access to
`NM_F_LINKED` as a constant was previously removed in
d6ac8a4db0), and add a test for
the functionality.

PR-URL: https://github.com/nodejs/node/pull/26457
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-09 00:29:35 +01:00