From 44382e6866869c8f463fa1b4738ef8495b4ab611 Mon Sep 17 00:00:00 2001 From: Jithil P Ponnan Date: Sun, 27 Nov 2022 17:29:33 +1100 Subject: [PATCH] src: add uvwasi version src: add uvwasi version --- src/node_metadata.cc | 15 +++++++++++++++ src/node_metadata.h | 11 ++++++++++- test/parallel/test-process-versions.js | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/node_metadata.cc b/src/node_metadata.cc index a221dcde050ad7..4540a40ed3d2d8 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -8,6 +8,7 @@ #include "uv.h" #include "v8.h" #include "zlib.h" +#include "../deps/uvwasi/include/uvwasi.h" #if HAVE_OPENSSL #include @@ -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(); @@ -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) { diff --git a/src/node_metadata.h b/src/node_metadata.h index b7cacae4c3d430..16fc0090cc6517 100644 --- a/src/node_metadata.h +++ b/src/node_metadata.h @@ -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 @@ -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 @@ -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: diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index e63848b1faff90..2ec7a0f84a5280 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -13,6 +13,7 @@ const expected_keys = [ 'nghttp2', 'napi', 'llhttp', + 'uvwasi', ]; if (common.hasCrypto) {