3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-19 14:45:44 +01:00

Refuse markdown past V8's longest string on every engine, before building it

This commit is contained in:
2026-10-11 23:26:20 +02:00
parent 7a27f6b81c
commit 25a17e1ed3
19 changed files with 203 additions and 90 deletions
+8
View File
@@ -0,0 +1,8 @@
import { failure, type ConvertErrorPath, type Result } from './result.ts'
// V8's longest string, held on every engine so a document converts alike everywhere (docs/decisions.md §Markdown past V8's longest string is refused on every engine).
export const longestOutput = 2 ** 29 - 24
export function tooLong<T>(path: ConvertErrorPath): Result<T> {
return failure('unsupported-node-shape', `the markdown would be longer than ${longestOutput} characters, the longest string V8 holds`, path)
}