1 #ifndef SRC_NODE_METADATA_H_ 2 #define SRC_NODE_METADATA_H_ 3 4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 5 6 #include <string> 7 #include "node_version.h" 8 9 #if HAVE_OPENSSL 10 #include <openssl/crypto.h> 11 #if NODE_OPENSSL_HAS_QUIC 12 #include <openssl/quic.h> 13 #endif 14 #endif // HAVE_OPENSSL 15 16 namespace node { 17 18 // if this is a release build and no explicit base has been set 19 // substitute the standard release download URL 20 #ifndef NODE_RELEASE_URLBASE 21 #if NODE_VERSION_IS_RELEASE 22 #define NODE_RELEASE_URLBASE "https://nodejs.org/download/release/" 23 #endif // NODE_VERSION_IS_RELEASE 24 #endif // NODE_RELEASE_URLBASE 25 26 #if defined(NODE_RELEASE_URLBASE) 27 #define NODE_HAS_RELEASE_URLS 28 #endif 29 30 #ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH 31 #define NODE_VERSIONS_KEY_UNDICI(V) V(undici) 32 #else 33 #define NODE_VERSIONS_KEY_UNDICI(V) 34 #endif 35 36 #define NODE_VERSIONS_KEYS_BASE(V) \ 37 V(node) \ 38 V(v8) \ 39 V(uv) \ 40 V(zlib) \ 41 V(brotli) \ 42 V(ares) \ 43 V(modules) \ 44 V(nghttp2) \ 45 V(napi) \ 46 V(llhttp) \ 47 V(uvwasi) \ 48 V(acorn) \ 49 V(simdutf) \ 50 V(ada) \ 51 NODE_VERSIONS_KEY_UNDICI(V) \ 52 V(cjs_module_lexer) \ 53 V(base64) 54 55 #if HAVE_OPENSSL 56 #define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl) 57 #else 58 #define NODE_VERSIONS_KEY_CRYPTO(V) 59 #endif 60 61 #ifdef NODE_HAVE_I18N_SUPPORT 62 #define NODE_VERSIONS_KEY_INTL(V) \ 63 V(cldr) \ 64 V(icu) \ 65 V(tz) \ 66 V(unicode) 67 #else 68 #define NODE_VERSIONS_KEY_INTL(V) 69 #endif // NODE_HAVE_I18N_SUPPORT 70 71 #ifdef OPENSSL_INFO_QUIC 72 #define NODE_VERSIONS_KEY_QUIC(V) \ 73 V(ngtcp2) \ 74 V(nghttp3) 75 #else 76 #define NODE_VERSIONS_KEY_QUIC(V) 77 #endif 78 79 #define NODE_VERSIONS_KEYS(V) \ 80 NODE_VERSIONS_KEYS_BASE(V) \ 81 NODE_VERSIONS_KEY_CRYPTO(V) \ 82 NODE_VERSIONS_KEY_INTL(V) \ 83 NODE_VERSIONS_KEY_QUIC(V) 84 85 class Metadata { 86 public: 87 Metadata(); 88 Metadata(Metadata&) = delete; 89 Metadata(Metadata&&) = delete; 90 Metadata operator=(Metadata&) = delete; 91 Metadata operator=(Metadata&&) = delete; 92 93 struct Versions { 94 Versions(); 95 96 #ifdef NODE_HAVE_I18N_SUPPORT 97 // Must be called on the main thread after 98 // i18n::InitializeICUDirectory() 99 void InitializeIntlVersions(); 100 #endif // NODE_HAVE_I18N_SUPPORT 101 102 #define V(key) std::string key; 103 NODE_VERSIONS_KEYS(V) 104 #undef V 105 }; 106 107 struct Release { 108 Release(); 109 110 std::string name; 111 #if NODE_VERSION_IS_LTS 112 std::string lts; 113 #endif // NODE_VERSION_IS_LTS 114 115 #ifdef NODE_HAS_RELEASE_URLS 116 std::string source_url; 117 std::string headers_url; 118 #ifdef _WIN32 119 std::string lib_url; 120 #endif // _WIN32 121 #endif // NODE_HAS_RELEASE_URLS 122 }; 123 124 Versions versions; 125 const Release release; 126 const std::string arch; 127 const std::string platform; 128 }; 129 130 // Per-process global 131 namespace per_process { 132 extern Metadata metadata; 133 } 134 135 } // namespace node 136 137 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 138 #endif // SRC_NODE_METADATA_H_ 139