From 130c494f307b9820ea84f07651b7b4cf8f5f1d0b Mon Sep 17 00:00:00 2001 From: Spotandjake <40705786+spotandjake@users.noreply.github.com> Date: Thu, 16 Jan 2025 23:58:30 -0500 Subject: [PATCH] feat(cli): Support node v22 and v23 (#2207) Co-authored-by: Oscar Spencer --- cli/bin/grainrun.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/bin/grainrun.js b/cli/bin/grainrun.js index 8532637ff..f7899d423 100644 --- a/cli/bin/grainrun.js +++ b/cli/bin/grainrun.js @@ -8,9 +8,10 @@ const v8 = require("v8"); * This method should be used with care. Changing settings after the VM has started may result * in unpredictable behavior, including crashes and data loss; or it may simply do nothing. * - * This seems to work for our needs with Node 18, but we should be cautious when updating. + * This is valid in Node 18, 19, 20, and 21. */ -v8.setFlagsFromString("--experimental-wasm-return-call"); +if (process.version.match(/^v(18|19|20|21)\./)) + v8.setFlagsFromString("--experimental-wasm-return-call"); const { readFile } = require("fs/promises"); const { WASI } = require("wasi");