Skip to content

Commit aaea254

Browse files
authored
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
1 parent abb90d8 commit aaea254

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

playgrounds/sandbox/run.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ for (const generate of /** @type {const} */ (['client', 'server'])) {
4646
modern: true
4747
});
4848

49-
fs.writeFileSync(`${cwd}/output/${file}.json`, JSON.stringify(ast, null, '\t'));
49+
fs.writeFileSync(
50+
`${cwd}/output/${file}.json`,
51+
JSON.stringify(
52+
ast,
53+
(key, value) => (typeof value === 'bigint' ? ['BigInt', value.toString()] : value),
54+
'\t'
55+
)
56+
);
5057

5158
try {
5259
const migrated = migrate(source);

0 commit comments

Comments
 (0)