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
pull/14509/head
Rich Harris 3 weeks ago committed by GitHub
parent abb90d8737
commit aaea254102
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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);

Loading…
Cancel
Save