/src/node/src/node_config.cc
Line | Count | Source |
1 | | #include "env-inl.h" |
2 | | #include "memory_tracker.h" |
3 | | #include "node.h" |
4 | | #include "node_builtins.h" |
5 | | #include "node_i18n.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 time |
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 | | // Command line arguments are already accessible in the JS land via |
24 | | // require('internal/options').getOptionValue('--some-option'). Do not add them |
25 | | // here. |
26 | | static void Initialize(Local<Object> target, |
27 | | Local<Value> unused, |
28 | | Local<Context> context, |
29 | 122k | void* priv) { |
30 | 122k | Environment* env = Environment::GetCurrent(context); |
31 | 122k | Isolate* isolate = env->isolate(); |
32 | | |
33 | | #if defined(DEBUG) && DEBUG |
34 | | READONLY_TRUE_PROPERTY(target, "isDebugBuild"); |
35 | | #else |
36 | 122k | READONLY_FALSE_PROPERTY(target, "isDebugBuild"); |
37 | 122k | #endif // defined(DEBUG) && DEBUG |
38 | | |
39 | 122k | #if HAVE_OPENSSL |
40 | 122k | READONLY_TRUE_PROPERTY(target, "hasOpenSSL"); |
41 | | #else |
42 | | READONLY_FALSE_PROPERTY(target, "hasOpenSSL"); |
43 | | #endif // HAVE_OPENSSL |
44 | | |
45 | 122k | READONLY_TRUE_PROPERTY(target, "fipsMode"); |
46 | | |
47 | 122k | #ifdef NODE_HAVE_I18N_SUPPORT |
48 | | |
49 | 122k | READONLY_TRUE_PROPERTY(target, "hasIntl"); |
50 | | |
51 | | #ifdef NODE_HAVE_SMALL_ICU |
52 | | READONLY_TRUE_PROPERTY(target, "hasSmallICU"); |
53 | | #endif // NODE_HAVE_SMALL_ICU |
54 | | |
55 | 122k | #if NODE_USE_V8_PLATFORM |
56 | 122k | READONLY_TRUE_PROPERTY(target, "hasTracing"); |
57 | 122k | #endif |
58 | | |
59 | 122k | #if !defined(NODE_WITHOUT_NODE_OPTIONS) |
60 | 122k | READONLY_TRUE_PROPERTY(target, "hasNodeOptions"); |
61 | 122k | #endif |
62 | | |
63 | 122k | #endif // NODE_HAVE_I18N_SUPPORT |
64 | | |
65 | 122k | #if HAVE_INSPECTOR |
66 | 122k | READONLY_TRUE_PROPERTY(target, "hasInspector"); |
67 | | #else |
68 | | READONLY_FALSE_PROPERTY(target, "hasInspector"); |
69 | | #endif |
70 | | |
71 | | // configure --no-browser-globals |
72 | | #ifdef NODE_NO_BROWSER_GLOBALS |
73 | | READONLY_TRUE_PROPERTY(target, "noBrowserGlobals"); |
74 | | #else |
75 | 122k | READONLY_FALSE_PROPERTY(target, "noBrowserGlobals"); |
76 | 122k | #endif // NODE_NO_BROWSER_GLOBALS |
77 | | |
78 | 122k | READONLY_PROPERTY(target, "bits", Number::New(isolate, 8 * sizeof(intptr_t))); |
79 | 122k | } // InitConfig |
80 | | |
81 | | } // namespace node |
82 | | |
83 | | NODE_BINDING_CONTEXT_AWARE_INTERNAL(config, node::Initialize) |