PRISM compile pass
When a source file's JSX runtime is{" "}
@bext-stack/framework, bext-turbopack runs prism_compile::optimize on the source BEFORE tsc-rs sees
it. Static-foldable subtrees collapse to JS string literals; dynamic
JSX (function children, runtime ternaries with non-string branches,
component invocations whose body isn't statically foldable) falls
through to the runtime h() helper.
Selected before / after pairs
| Pattern | Source (TSX) | After compile pass |
|---|---|---|
| static element with text | | |
| interpolated text | | |
| attribute | | |
| ternary class (folded with __bextEsc) | | |
| list .map (folded inline) | | |
| fully static subtree | | |
| dynamic root component (bails) | | |
Why it matters
- Static text and elements skip the runtime tag-formatting cost entirely — they're string literals at the bundle level.
-
Attribute interpolation goes through
__bextEscat compile time, so XSS protection is wired in even when the runtimeh()helper isn't called. -
Dynamic shapes can be folded if every leaf is a
string literal or the shape pattern is recognized. The fall-through
to
h()is correct, just slower per-element.
Toggle off with BEXT_PRISM_COMPILE=0 at compile time
to see the un-folded shape (useful for diffing build output).