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 2f1126e commit 1313e9c
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 @@ -10,6 +10,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 @@ -69,6 +70,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 @@ -107,6 +118,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 Down Expand Up @@ -41,6 +43,12 @@ namespace node {
V(cjs_module_lexer) \
V(base64)

#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 @@ -69,7 +77,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 @@ -17,6 +17,7 @@ const expected_keys = [
'llhttp',
'cjs_module_lexer',
'base64',
'uvwasi',
];

if (common.hasCrypto) {
Expand Down

0 comments on commit 1313e9c

Please sign in to comment.