Skip to content

Commit

Permalink
Revert use of import.meta.dirname in the compiler
Browse files Browse the repository at this point in the history
In emscripten-core#23349 we (I) accidentally broke running emscripten with node older
than v19 and as it happens debian/stable still ships v18:
https://packages.debian.org/bookworm/nodejs

This change reverts emscripten-core#23349 and also explicitly bumps the minimum version
up to v18.20.  I've also added some testing to CI to ensure we can
actually run using this version.

See emscripten-core#23396 and emscripten-core#23407
  • Loading branch information
sbc100 committed Jan 14, 2025
1 parent 7aa70ae commit f1fa941
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ See docs/process.md for more on how version tagging works.

4.0.1 (in development)
----------------------
- The mimimum version of node required to run emscripten was bumped from v16.20
to v18.20. Version 4.0 was mistakenly with change that required v20 but that
was revered. ()

4.0.0 - 01/14/25
----------------
Expand Down
6 changes: 5 additions & 1 deletion src/utility.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// General JS utilities - things that might be useful in any JS project.
// Nothing specific to Emscripten appears here.

import * as url from 'node:url';
import * as path from 'node:path';
import * as fs from 'node:fs';
import * as vm from 'node:vm';
Expand Down Expand Up @@ -230,8 +231,11 @@ export function read(filename) {
return fs.readFileSync(absolute, 'utf8');
}

// Use import.meta.dirname here once we drop support for node v18.
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));

function find(filename) {
for (const prefix of [process.cwd(), import.meta.dirname]) {
for (const prefix of [process.cwd(), __dirname]) {
const combined = path.join(prefix, filename);
if (fs.existsSync(combined)) {
return combined;
Expand Down
5 changes: 3 additions & 2 deletions test/test_sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,9 @@ def test_node(self):
for version, succeed in (('v0.8.0', False),
('v4.1.0', False),
('v10.18.0', False),
('v16.20.0', True),
('v16.20.1-pre', True),
('v16.20.0', False),
('v18.19.0', True),
('v18.19.1-pre', True),
('cheez', False)):
print(version, succeed)
delete_file(SANITY_FILE)
Expand Down
6 changes: 3 additions & 3 deletions tools/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
# Minimum node version required to run the emscripten compiler. This is
# distinct from the minimum version required to execute the generated code
# (settings.MIN_NODE_VERSION).
# This version currently matches the node version that we ship with emsdk
# which means that we can say for sure that this version is well supported.
MINIMUM_NODE_VERSION = (16, 20, 0)
# This is currently set ot v18.19 since this is the version of node available
# in debian/stable (bookworm).
MINIMUM_NODE_VERSION = (18, 19, 0)
EXPECTED_LLVM_VERSION = 20

# These get set by setup_temp_dirs
Expand Down

0 comments on commit f1fa941

Please sign in to comment.