Skip to content

Commit 0cb8646

Browse files
sbc100kripken
andauthored
Avoid injecting --experimental-wasm-bigint into #! line when creating node-runnable output (#24808)
This was the last remaining usage of `node_bigint_flags` in the compiler so this function was moved into test code where it is still used. IIUC its better not to do this at all for a few reasons: 1. The version of node used in the emscripten compiler is not the same as the version that will be used the run the output program, so basing these flags on `settings.NODE_JS` is just wrong. 2. If folks want to target older versions of node we already have ways to do that `-sMIN_NODE_VERSION`. They can also add this flag themselves when running the output program. I don't think is out business to inject node flags here. --------- Co-authored-by: Alon Zakai <[email protected]>
1 parent e77e985 commit 0cb8646

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ See docs/process.md for more on how version tagging works.
2020

2121
4.0.12 (in development)
2222
-----------------------
23+
- The `#!` line that emscripten, under some circumstances, will add to the
24+
generated JS code no longer injects the `--experimental-wasm-bigint` node
25+
flag. This flag is not needed on recent versions of node, and in fact
26+
errors there, so it's not possible to know if it's safe to include. (#24808)
2327
- In `-sMODULARIZE` mode the factory function will now always return a promise,
2428
even when `WASM_ASYNC_COMPILATION` is disabled. This is because emscripten
2529
has other features that might also return async module creation (e.g. loading

test/common.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,15 @@ def decorated(self, *args, **kwargs):
275275
return decorated
276276

277277

278+
def node_bigint_flags(node_version):
279+
# The --experimental-wasm-bigint flag was added in v12, and then removed (enabled by default)
280+
# in v16.
281+
if node_version and node_version < (16, 0, 0) and node_version >= (12, 0, 0):
282+
return ['--experimental-wasm-bigint']
283+
else:
284+
return []
285+
286+
278287
# Used to mark dependencies in various tests to npm developer dependency
279288
# packages, which might not be installed on Emscripten end users' systems.
280289
def requires_dev_dependency(package):
@@ -1214,7 +1223,7 @@ def setUp(self):
12141223
# Opt in to node v15 default behaviour:
12151224
# https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode
12161225
self.node_args.append('--unhandled-rejections=throw')
1217-
self.node_args += shared.node_bigint_flags(nodejs)
1226+
self.node_args += node_bigint_flags(node_version)
12181227

12191228
# If the version we are running tests in is lower than the version that
12201229
# emcc targets then we need to tell emcc to target that older version.

tools/link.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,6 @@ def check_human_readable_list(items):
467467
def make_js_executable(script):
468468
src = read_file(script)
469469
cmd = config.NODE_JS
470-
if settings.WASM_BIGINT:
471-
cmd += shared.node_bigint_flags(config.NODE_JS)
472470
if len(cmd) > 1 or not os.path.isabs(cmd[0]):
473471
# Using -S (--split-string) here means that arguments to the executable are
474472
# correctly parsed. We don't do this by default because old versions of env

tools/shared.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,6 @@ def check_node_version():
344344
return version
345345

346346

347-
def node_bigint_flags(nodejs):
348-
node_version = get_node_version(nodejs)
349-
# The --experimental-wasm-bigint flag was added in v12, and then removed (enabled by default)
350-
# in v16.
351-
if node_version and node_version < (16, 0, 0) and node_version >= (12, 0, 0):
352-
return ['--experimental-wasm-bigint']
353-
else:
354-
return []
355-
356-
357347
def node_reference_types_flags(nodejs):
358348
node_version = get_node_version(nodejs)
359349
# reference types were enabled by default in node v18.

0 commit comments

Comments
 (0)