Skip to content

standalone_graph: zero-copy source string for compiled JS modules when contents are ASCII - #31557

Merged
Jarred-Sumner merged 3 commits into
mainfrom
claude/standalone-graph-encoding-fix
May 29, 2026
Merged

Jarred-Sumner merged 3 commits into
mainfrom
claude/standalone-graph-encoding-fix

standalone_graph: read encoding from serialized record instead of har…

e961c51
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed May 29, 2026 in 17m 18s

Code review found 1 important issue

Found 3 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/standalone_graph/StandaloneModuleGraph.rs:642 Latin1 encoding corrupts non-ASCII --banner/--footer in compiled executables

Annotations

Check failure on line 642 in src/standalone_graph/StandaloneModuleGraph.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Latin1 encoding corrupts non-ASCII --banner/--footer in compiled executables

Honoring `module.encoding` activates the `Latin1 → create_static_external` path for JS modules, but `to_bytes()` tags JS as Latin1 purely by loader type with no ASCII check — and `postProcessJSChunk` concatenates `--banner`/`--footer`/hashbang verbatim as UTF-8. So `bun build --compile --footer 'console.log("résumé")'` now prints `résumé` (and non-ASCII identifiers can SyntaxError), whereas before this PR the hardcoded `Binary → clone_utf8` path decoded it correctly. Also, the PR description's