Skip to content

Commit

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

Expand Down Expand Up @@ -67,6 +68,14 @@ 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 +112,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
12 changes: 10 additions & 2 deletions src/node_metadata.h
Expand Up @@ -13,6 +13,8 @@
#endif
#endif // HAVE_OPENSSL

#include "uvwasi.h"

namespace node {

// if this is a release build and no explicit base has been set
Expand All @@ -37,7 +39,12 @@ namespace node {
V(modules) \
V(nghttp2) \
V(napi) \
V(llhttp) \
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)
Expand Down Expand Up @@ -67,7 +74,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 0d3d190

Please sign in to comment.