From 688671ec2328ed1739a2fb0ecf74a98d35d5e2b9 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 27 May 2026 17:20:15 -0400 Subject: [PATCH] chore: fix printing in sandbox (#18311) when `PRINT` is true, the sandbox should write out the printed code. at present it doesn't do this if `AST` is not also true --- playgrounds/sandbox/run.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/playgrounds/sandbox/run.js b/playgrounds/sandbox/run.js index f79243d4e7..3b0602f716 100644 --- a/playgrounds/sandbox/run.js +++ b/playgrounds/sandbox/run.js @@ -59,19 +59,21 @@ for (const generate of /** @type {const} */ (['client', 'server'])) { mkdirp(path.dirname(output_js)); if (generate === 'client') { - if (AST) { + if (AST || PRINT) { const ast = parse(source, { modern: true }); - write( - `${cwd}/output/ast/${file}.json`, - JSON.stringify( - ast, - (key, value) => (typeof value === 'bigint' ? ['BigInt', value.toString()] : value), - '\t' - ) - ); + if (AST) { + write( + `${cwd}/output/ast/${file}.json`, + JSON.stringify( + ast, + (key, value) => (typeof value === 'bigint' ? ['BigInt', value.toString()] : value), + '\t' + ) + ); + } if (PRINT) { const printed = print(ast);