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