diff options
author | Michael Dawson <michael_dawson@ca.ibm.com> | 2018-01-09 15:06:28 -0500 |
---|---|---|
committer | Michael Dawson <michael_dawson@ca.ibm.com> | 2018-01-11 16:53:53 -0500 |
commit | 8938c4c22d720c33441ce95d801056532b99ec18 (patch) | |
tree | c0be7d6176f744da1925fad90d8ae5500b63d9c9 /src | |
parent | b225970e6ca05cab568273b100c5967b4209f621 (diff) | |
download | android-node-v8-8938c4c22d720c33441ce95d801056532b99ec18.tar.gz android-node-v8-8938c4c22d720c33441ce95d801056532b99ec18.tar.bz2 android-node-v8-8938c4c22d720c33441ce95d801056532b99ec18.zip |
n-api: expose n-api version in process.versions
Expose n-api version in process.versions so that it is
available for use in javascript by external modules
like node-pre-gyp. It was previously accessible through
a functon available in the N-API.
PR-URL: https://github.com/nodejs/node/pull/18067
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Tobias Nießn <tniessen@tnie.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 6 | ||||
-rw-r--r-- | src/node_api.cc | 2 | ||||
-rw-r--r-- | src/node_version.h | 3 |
3 files changed, 9 insertions, 2 deletions
diff --git a/src/node.cc b/src/node.cc index e55dda6825..d01276800a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3032,6 +3032,12 @@ void SetupProcessObject(Environment* env, "nghttp2", FIXED_ONE_BYTE_STRING(env->isolate(), NGHTTP2_VERSION)); + const char node_napi_version[] = NODE_STRINGIFY(NAPI_VERSION); + READONLY_PROPERTY( + versions, + "napi", + FIXED_ONE_BYTE_STRING(env->isolate(), node_napi_version)); + // process._promiseRejectEvent Local<Object> promiseRejectEvent = Object::New(env->isolate()); READONLY_DONT_ENUM_PROPERTY(process, diff --git a/src/node_api.cc b/src/node_api.cc index 095f98f64f..2101fcba02 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -18,8 +18,6 @@ #include "node_api.h" #include "node_internals.h" -#define NAPI_VERSION 2 - static napi_status napi_set_last_error(napi_env env, napi_status error_code, uint32_t engine_error_code = 0, diff --git a/src/node_version.h b/src/node_version.h index a28d0f335b..b8f56fdeaf 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -109,4 +109,7 @@ */ #define NODE_MODULE_VERSION 60 +// the NAPI_VERSION provided by this version of the runtime +#define NAPI_VERSION 2 + #endif // SRC_NODE_VERSION_H_ |