Make body hold parser-aware and stream Next.js processing - #1135
Draft
prk-Jr wants to merge 16 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
</body>tail, preventing inline JavaScript or JSON literals from holding most of the page.Changes
crates/trusted-server-core/src/html_processor.rscrates/trusted-server-core/src/integrations/google_tag_manager.rscrates/trusted-server-core/src/integrations/mod.rscrates/trusted-server-core/src/integrations/nextjs/html_post_process.rscrates/trusted-server-core/src/integrations/nextjs/mod.rscrates/trusted-server-core/src/integrations/nextjs/rsc.rscrates/trusted-server-core/src/integrations/nextjs/rsc_placeholders.rscrates/trusted-server-core/src/integrations/nextjs/rsc_stream.rscrates/trusted-server-core/src/integrations/nextjs/script_rewriter.rscrates/trusted-server-core/src/integrations/nextjs/shared.rscrates/trusted-server-core/src/integrations/registry.rscrates/trusted-server-core/src/publisher.rsdocs/guide/integrations/nextjs.mddocs/superpowers/specs/2026-09-07-850-parser-aware-body-hold-nextjs-streaming-design.mddocs/superpowers/plans/2026-09-07-850-parser-aware-body-hold-nextjs-streaming.mdCloses
Closes #850
Test plan
cargo test-fastly && cargo test-axumcargo clippy-fastly && cargo clippy-axumcargo fmt --all -- --checkcd crates/trusted-server-js/lib && npx vitest run(blocked by the existing CommonJS/ESM incompatibility betweenhtml-encoding-snifferand@exodus/bytes; no JS files changed)cd crates/trusted-server-js/lib && npm run formatcd docs && npm run formatcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1fastly compute servecargo test-cloudflare,cargo test-spin,cargo clippy-cloudflare,cargo clippy-cloudflare-wasm,cargo clippy-spin-native, andcargo clippy-spin-wasmChecklist
unwrap()in production code — useexpect("should ...")println!)