Skip to content

Commit 954d4b4

Browse files
committed
cli: add --enable-all-experimentals build flag
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
1 parent 2071c44 commit 954d4b4

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

common.gypi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
'python%': 'python',
1616

1717
'node_shared%': 'false',
18+
'node_enable_experimentals%': 0,
1819
'force_dynamic_crt%': 0,
1920
'node_use_v8_platform%': 'true',
2021
'node_use_bundled_v8%': 'true',
@@ -437,6 +438,9 @@
437438
}],
438439
# The defines bellow must include all things from the external_v8_defines
439440
# list in v8/BUILD.gn.
441+
['node_enable_experimentals==1', {
442+
'defines': ['NODE_ENABLE_EXPERIMENTALS'],
443+
}],
440444
['v8_enable_v8_checks == 1', {
441445
'defines': ['V8_ENABLE_CHECKS'],
442446
}],

configure.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,12 @@
797797
default=None,
798798
help='Enable the --trace-maps flag in V8 (use at your own risk)')
799799

800+
parser.add_argument('--enable-all-experimentals',
801+
action='store_true',
802+
dest='enable_all_experimentals',
803+
default=None,
804+
help='Enable all experimental features by default')
805+
800806
parser.add_argument('--experimental-enable-pointer-compression',
801807
action='store_true',
802808
dest='enable_pointer_compression',
@@ -1803,6 +1809,7 @@ def configure_node_cctest_sources(o):
18031809
def configure_node(o):
18041810
if options.dest_os == 'android':
18051811
o['variables']['OS'] = 'android'
1812+
o['variables']['node_enable_experimentals'] = B(options.enable_all_experimentals)
18061813
o['variables']['node_prefix'] = options.prefix
18071814
o['variables']['node_install_npm'] = b(not options.without_npm)
18081815
o['variables']['node_install_corepack'] = b(options.with_corepack)

src/node_options.h

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ class DebugOptions : public Options {
112112
std::vector<std::string>* argv) override;
113113
};
114114

115+
#ifdef NODE_ENABLE_EXPERIMENTALS
116+
#define EXPERIMENTALS_DEFAULT_VALUE true
117+
#else
118+
#define EXPERIMENTALS_DEFAULT_VALUE false
119+
#endif
120+
115121
class EnvironmentOptions : public Options {
116122
public:
117123
bool abort_on_uncaught_exception = false;
@@ -122,19 +128,19 @@ class EnvironmentOptions : public Options {
122128
bool require_module = true;
123129
std::string dns_result_order;
124130
bool enable_source_maps = false;
125-
bool experimental_addon_modules = false;
126-
bool experimental_eventsource = false;
131+
bool experimental_addon_modules = EXPERIMENTALS_DEFAULT_VALUE;
132+
bool experimental_eventsource = EXPERIMENTALS_DEFAULT_VALUE;
127133
bool experimental_fetch = true;
128-
bool experimental_ffi = false;
134+
bool experimental_ffi = EXPERIMENTALS_DEFAULT_VALUE;
129135
bool experimental_websocket = true;
130136
bool experimental_sqlite = true;
131-
bool experimental_stream_iter = false;
137+
bool experimental_stream_iter = EXPERIMENTALS_DEFAULT_VALUE;
132138
bool webstorage = HAVE_SQLITE;
133-
bool experimental_quic = false;
139+
bool experimental_quic = EXPERIMENTALS_DEFAULT_VALUE;
134140
std::string localstorage_file;
135141
bool experimental_global_navigator = true;
136142
bool experimental_global_web_crypto = true;
137-
bool experimental_import_meta_resolve = false;
143+
bool experimental_import_meta_resolve = EXPERIMENTALS_DEFAULT_VALUE;
138144
std::string input_type; // Value of --input-type
139145
bool entry_is_url = false;
140146
bool permission = false;
@@ -149,7 +155,7 @@ class EnvironmentOptions : public Options {
149155
bool allow_ffi = false;
150156
bool allow_worker_threads = false;
151157
bool experimental_repl_await = true;
152-
bool experimental_vm_modules = false;
158+
bool experimental_vm_modules = EXPERIMENTALS_DEFAULT_VALUE;
153159
bool async_context_frame = true;
154160
bool expose_internals = false;
155161
bool force_node_api_uncaught_exceptions_policy = false;
@@ -176,10 +182,11 @@ class EnvironmentOptions : public Options {
176182
uint64_t cpu_prof_interval = kDefaultCpuProfInterval;
177183
std::string cpu_prof_name;
178184
bool cpu_prof = false;
179-
bool experimental_network_inspection = false;
180-
bool experimental_worker_inspection = false;
181-
bool experimental_storage_inspection = false;
182-
bool experimental_inspector_network_resource = false;
185+
bool experimental_network_inspection = EXPERIMENTALS_DEFAULT_VALUE;
186+
bool experimental_worker_inspection = EXPERIMENTALS_DEFAULT_VALUE;
187+
bool experimental_storage_inspection = EXPERIMENTALS_DEFAULT_VALUE;
188+
bool experimental_inspector_network_resource =
189+
EXPERIMENTALS_DEFAULT_VALUE;
183190
std::string heap_prof_dir;
184191
std::string heap_prof_name;
185192
static const uint64_t kDefaultHeapProfInterval = 512 * 1024;

0 commit comments

Comments
 (0)