Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n-api: expose n-api version in process.versions #18067

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/node_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
2 changes: 1 addition & 1 deletion test/parallel/test-process-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const common = require('../common');
const assert = require('assert');

const expected_keys = ['ares', 'http_parser', 'modules', 'node',
'uv', 'v8', 'zlib', 'nghttp2'];
'uv', 'v8', 'zlib', 'nghttp2', 'napi'];

if (common.hasCrypto) {
expected_keys.push('openssl');
Expand Down