Skip to content

Commit

Permalink
src: add uvwasi version
Browse files Browse the repository at this point in the history
src: add uvwasi version
  • Loading branch information
MrJithil committed Nov 27, 2022
1 parent 8d0c214 commit 44382e6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/node_metadata.cc
Expand Up @@ -8,6 +8,7 @@
#include "uv.h"
#include "v8.h"
#include "zlib.h"
#include "../deps/uvwasi/include/uvwasi.h"

#if HAVE_OPENSSL
#include <openssl/opensslv.h>
Expand Down Expand Up @@ -67,6 +68,16 @@ void Metadata::Versions::InitializeIntlVersions() {
}
#endif // NODE_HAVE_I18N_SUPPORT

// define the UVWASI_VERSION if UVWASI_VERSION_* exists
#if defined(UVWASI_VERSION_MAJOR) &&
defined(UVWASI_VERSION_MINOR) &&
defined(UVWASI_VERSION_PATCH)

#define UVWASI_VERSION STRINGIFY(UVWASI_VERSION_MAJOR) "." /
STRINGIFY(UVWASI_VERSION_MINOR) "." /
STRINGIFY(UVWASI_VERSION_PATCH)
#endif // UVWASI_VERSION_MAJOR UVWASI_VERSION_MINOR UVWASI_VERSION_PATCH

Metadata::Versions::Versions() {
node = NODE_VERSION_STRING;
v8 = v8::V8::GetVersion();
Expand Down Expand Up @@ -103,6 +114,10 @@ Metadata::Versions::Versions() {
ngtcp2 = NGTCP2_VERSION;
nghttp3 = NGHTTP3_VERSION;
#endif

#ifdef UVWASI_VERSION
uvwasi = UVWASI_VERSION;
#endif // UVWASI_VERSION
}

Metadata::Release::Release() : name(NODE_RELEASE) {
Expand Down
11 changes: 10 additions & 1 deletion src/node_metadata.h
Expand Up @@ -13,6 +13,8 @@
#endif
#endif // HAVE_OPENSSL

#include "../deps/uvwasi/include/uvwasi.h"

namespace node {

// if this is a release build and no explicit base has been set
Expand All @@ -39,6 +41,12 @@ namespace node {
V(napi) \
V(llhttp) \

#if defined(UVWASI_VERSION_MAJOR) &&
defined(UVWASI_VERSION_MINOR) &&
defined(UVWASI_VERSION_PATCH)
#define NODE_VERSIONS_UVWASI(V) V(uvwasi)
#endif // UVWASI_VERSION_PATCH UVWASI_VERSION_MINOR UVWASI_VERSION_MAJOR

#if HAVE_OPENSSL
#define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl)
#else
Expand Down Expand Up @@ -67,7 +75,8 @@ namespace node {
NODE_VERSIONS_KEYS_BASE(V) \
NODE_VERSIONS_KEY_CRYPTO(V) \
NODE_VERSIONS_KEY_INTL(V) \
NODE_VERSIONS_KEY_QUIC(V)
NODE_VERSIONS_KEY_QUIC(V) \
NODE_VERSIONS_UVWASI(V)

class Metadata {
public:
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-process-versions.js
Expand Up @@ -13,6 +13,7 @@ const expected_keys = [
'nghttp2',
'napi',
'llhttp',
'uvwasi',
];

if (common.hasCrypto) {
Expand Down

0 comments on commit 44382e6

Please sign in to comment.