1 |
|
|
#include "env-inl.h" |
2 |
|
|
#include "memory_tracker.h" |
3 |
|
|
#include "node.h" |
4 |
|
|
#include "node_i18n.h" |
5 |
|
|
#include "node_native_module_env.h" |
6 |
|
|
#include "node_options.h" |
7 |
|
|
#include "util-inl.h" |
8 |
|
|
|
9 |
|
|
namespace node { |
10 |
|
|
|
11 |
|
|
using v8::Context; |
12 |
|
|
using v8::Isolate; |
13 |
|
|
using v8::Local; |
14 |
|
|
using v8::Number; |
15 |
|
|
using v8::Object; |
16 |
|
|
using v8::Value; |
17 |
|
|
|
18 |
|
|
// The config binding is used to provide an internal view of compile or runtime |
19 |
|
|
// config options that are required internally by lib/*.js code. This is an |
20 |
|
|
// alternative to dropping additional properties onto the process object as |
21 |
|
|
// has been the practice previously in node.cc. |
22 |
|
|
|
23 |
|
5092 |
static void Initialize(Local<Object> target, |
24 |
|
|
Local<Value> unused, |
25 |
|
|
Local<Context> context, |
26 |
|
|
void* priv) { |
27 |
|
5092 |
Environment* env = Environment::GetCurrent(context); |
28 |
|
5092 |
Isolate* isolate = env->isolate(); |
29 |
|
|
|
30 |
|
|
#if defined(DEBUG) && DEBUG |
31 |
|
|
READONLY_TRUE_PROPERTY(target, "isDebugBuild"); |
32 |
|
|
#else |
33 |
|
15276 |
READONLY_FALSE_PROPERTY(target, "isDebugBuild"); |
34 |
|
|
#endif // defined(DEBUG) && DEBUG |
35 |
|
|
|
36 |
|
|
#if HAVE_OPENSSL |
37 |
|
15276 |
READONLY_TRUE_PROPERTY(target, "hasOpenSSL"); |
38 |
|
|
#else |
39 |
|
|
READONLY_FALSE_PROPERTY(target, "hasOpenSSL"); |
40 |
|
|
#endif // HAVE_OPENSSL |
41 |
|
|
|
42 |
|
|
#ifdef NODE_FIPS_MODE |
43 |
|
|
READONLY_TRUE_PROPERTY(target, "fipsMode"); |
44 |
|
|
#endif |
45 |
|
|
|
46 |
|
|
#ifdef NODE_HAVE_I18N_SUPPORT |
47 |
|
|
|
48 |
|
15276 |
READONLY_TRUE_PROPERTY(target, "hasIntl"); |
49 |
|
|
|
50 |
|
|
#ifdef NODE_HAVE_SMALL_ICU |
51 |
|
|
READONLY_TRUE_PROPERTY(target, "hasSmallICU"); |
52 |
|
|
#endif // NODE_HAVE_SMALL_ICU |
53 |
|
|
|
54 |
|
|
#if NODE_USE_V8_PLATFORM |
55 |
|
15276 |
READONLY_TRUE_PROPERTY(target, "hasTracing"); |
56 |
|
|
#endif |
57 |
|
|
|
58 |
|
|
#if !defined(NODE_WITHOUT_NODE_OPTIONS) |
59 |
|
15276 |
READONLY_TRUE_PROPERTY(target, "hasNodeOptions"); |
60 |
|
|
#endif |
61 |
|
|
|
62 |
|
|
#endif // NODE_HAVE_I18N_SUPPORT |
63 |
|
|
|
64 |
|
|
#if HAVE_INSPECTOR |
65 |
|
15276 |
READONLY_TRUE_PROPERTY(target, "hasInspector"); |
66 |
|
|
#else |
67 |
|
|
READONLY_FALSE_PROPERTY(target, "hasInspector"); |
68 |
|
|
#endif |
69 |
|
|
|
70 |
|
|
// configure --no-browser-globals |
71 |
|
|
#ifdef NODE_NO_BROWSER_GLOBALS |
72 |
|
|
READONLY_TRUE_PROPERTY(target, "noBrowserGlobals"); |
73 |
|
|
#else |
74 |
|
15276 |
READONLY_FALSE_PROPERTY(target, "noBrowserGlobals"); |
75 |
|
|
#endif // NODE_NO_BROWSER_GLOBALS |
76 |
|
|
|
77 |
|
20368 |
READONLY_PROPERTY(target, |
78 |
|
|
"bits", |
79 |
|
|
Number::New(isolate, 8 * sizeof(intptr_t))); |
80 |
|
|
|
81 |
|
|
#if defined HAVE_DTRACE || defined HAVE_ETW |
82 |
|
|
READONLY_TRUE_PROPERTY(target, "hasDtrace"); |
83 |
|
|
#endif |
84 |
|
|
|
85 |
|
20368 |
READONLY_PROPERTY(target, "hasCachedBuiltins", |
86 |
|
|
v8::Boolean::New(isolate, native_module::has_code_cache)); |
87 |
|
5092 |
} // InitConfig |
88 |
|
|
|
89 |
|
|
} // namespace node |
90 |
|
|
|
91 |
|
4943 |
NODE_MODULE_CONTEXT_AWARE_INTERNAL(config, node::Initialize) |