forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnode_metadata.h
More file actions
158 lines (132 loc) · 5.08 KB
/
node_metadata.h
File metadata and controls
158 lines (132 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#ifndef SRC_NODE_METADATA_H_
#define SRC_NODE_METADATA_H_
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include <array>
#include <string>
#include <utility>
#include "node_version.h"
#if HAVE_OPENSSL
#include <openssl/crypto.h>
#include <quic/guard.h>
#ifndef OPENSSL_NO_QUIC
#include <openssl/quic.h>
#endif
#endif // HAVE_OPENSSL
namespace node {
// if this is a release build and no explicit base has been set
// substitute the standard release download URL
#ifndef NODE_RELEASE_URLBASE
#if NODE_VERSION_IS_RELEASE
#define NODE_RELEASE_URLBASE "https://nodejs.org/download/release/"
#endif // NODE_VERSION_IS_RELEASE
#endif // NODE_RELEASE_URLBASE
#if defined(NODE_RELEASE_URLBASE)
#define NODE_HAS_RELEASE_URLS
#endif
#if HAVE_AMARO && !defined(NODE_SHARED_BUILTIN_AMARO_DIST_INDEX_PATH)
#define NODE_VERSIONS_KEY_AMARO(V) V(amaro)
#else
#define NODE_VERSIONS_KEY_AMARO(V)
#endif
#ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH
#define NODE_VERSIONS_KEY_UNDICI(V) V(undici)
#else
#define NODE_VERSIONS_KEY_UNDICI(V)
#endif
#define NODE_VERSIONS_KEYS_BASE(V) \
V(node) \
V(v8) \
V(uv) \
V(zlib) \
V(brotli) \
V(zstd) \
V(ares) \
V(modules) \
V(nghttp2) \
V(napi) \
V(llhttp) \
V(uvwasi) \
V(acorn) \
V(simdjson) \
V(simdutf) \
V(ada) \
V(nbytes) \
V(ngtcp2) \
V(nghttp3) \
NODE_VERSIONS_KEY_AMARO(V) \
NODE_VERSIONS_KEY_UNDICI(V) \
V(cjs_module_lexer)
#if HAVE_OPENSSL
#define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl) V(ncrypto)
#else
#define NODE_VERSIONS_KEY_CRYPTO(V)
#endif
#ifdef NODE_HAVE_I18N_SUPPORT
#define NODE_VERSIONS_KEY_INTL(V) \
V(cldr) \
V(icu) \
V(tz) \
V(unicode)
#else
#define NODE_VERSIONS_KEY_INTL(V)
#endif // NODE_HAVE_I18N_SUPPORT
#if HAVE_SQLITE
#define NODE_VERSIONS_KEY_SQLITE(V) V(sqlite)
#else
#define NODE_VERSIONS_KEY_SQLITE(V)
#endif
#define NODE_VERSIONS_KEYS(V) \
NODE_VERSIONS_KEYS_BASE(V) \
NODE_VERSIONS_KEY_CRYPTO(V) \
NODE_VERSIONS_KEY_INTL(V) \
NODE_VERSIONS_KEY_SQLITE(V)
#define V(key) +1
constexpr int NODE_VERSIONS_KEY_COUNT = NODE_VERSIONS_KEYS(V);
#undef V
class Metadata {
public:
Metadata();
Metadata(Metadata&) = delete;
Metadata(Metadata&&) = delete;
Metadata operator=(Metadata&) = delete;
Metadata operator=(Metadata&&) = delete;
struct Versions {
Versions();
#ifdef NODE_HAVE_I18N_SUPPORT
// Must be called on the main thread after
// i18n::InitializeICUDirectory()
void InitializeIntlVersions();
#endif // NODE_HAVE_I18N_SUPPORT
#define V(key) std::string key;
NODE_VERSIONS_KEYS(V)
#undef V
std::array<std::pair<std::string_view, std::string_view>,
NODE_VERSIONS_KEY_COUNT>
pairs() const;
};
struct Release {
Release();
std::string name;
#if NODE_VERSION_IS_LTS
std::string lts;
#endif // NODE_VERSION_IS_LTS
#ifdef NODE_HAS_RELEASE_URLS
std::string source_url;
std::string headers_url;
#ifdef _WIN32
std::string lib_url;
#endif // _WIN32
#endif // NODE_HAS_RELEASE_URLS
};
Versions versions;
const Release release;
const std::string arch;
const std::string platform;
};
// Per-process global
namespace per_process {
extern Metadata metadata;
}
} // namespace node
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#endif // SRC_NODE_METADATA_H_