From aaea2541020b24769180e64b106dc90d92f98f4f Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 2 Dec 2024 09:50:33 -0500 Subject: [PATCH] chore: serialize bigint AST, albeit incorrectly (#14504) playgrounds/sandbox/run.js doesn't work for components containing bigints, because they can't be serialized to JSON. There isn't really a great fix for this issue but this at least allows the sandbox to run --- playgrounds/sandbox/run.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/playgrounds/sandbox/run.js b/playgrounds/sandbox/run.js index 4531e7182da8..771dcc668eed 100644 --- a/playgrounds/sandbox/run.js +++ b/playgrounds/sandbox/run.js @@ -46,7 +46,14 @@ for (const generate of /** @type {const} */ (['client', 'server'])) { modern: true }); - fs.writeFileSync(`${cwd}/output/${file}.json`, JSON.stringify(ast, null, '\t')); + fs.writeFileSync( + `${cwd}/output/${file}.json`, + JSON.stringify( + ast, + (key, value) => (typeof value === 'bigint' ? ['BigInt', value.toString()] : value), + '\t' + ) + ); try { const migrated = migrate(source);