Skip to content

perf: enable srvx FastResponse globally for node builds - #4910

Merged
pi0 merged 1 commit into
mainfrom
feat/fast-response
Oct 23, 2026
Merged

pi0 merged 1 commit into
mainfrom
feat/fast-response

Conversation

@pi0x

@pi0x pi0x commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Adds a features.fastResponse flag that replaces the global Response with srvx FastResponse, so new Response() in user code skips the native Response overhead on Node.js.

  • Defaults to the node option (enabled for Node.js based presets, disabled for workers).
  • Implemented as a polyfill (#nitro/runtime/polyfills/fast-response) added to the build env before user polyfills, so it applies to prod entries, dev and prerender.
  • instanceof Response keeps working for both native and fast responses.
  • No-op on Bun, Deno and the standard preset, where srvx FastResponse is the native Response.

Set features: { fastResponse: false } to opt out.

🤖 Generated with AI assistant

Adds `features.fastResponse` (defaults to `node`) to replace the global `Response` with srvx `FastResponse`.
@pi0x
pi0x requested a review from pi0 as a code owner October 23, 2026 05:18
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nitro.build Ready Ready Preview Oct 23, 2026 5:18am UTC

Request Review

@pi0 pi0 changed the title feat: enable srvx FastResponse globally for node builds perf: enable srvx FastResponse globally for node builds Oct 23, 2026
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5771e4db-8435-4b41-b2fe-8a8bd28dc8cf
📥 Commits

Reviewing files that changed from the base of the PR and between 1e251cd and 9271d4f.

📒 Files selected for processing: 8
  • docs/3.config/0.index.md
  • src/build/env.ts
  • src/runtime/internal/polyfills/fast-response.ts
  • src/types/config.ts
  • test/fixture/server/routes/fast-response.ts
  • test/presets/vercel.test.ts
  • test/tests.ts
  • test/unit/build-env.test.ts
+-------------------------------------------------------------------------------+
| Design to test. Start thinking about testing before you write a line of code. |
+-------------------------------------------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nitro@4910

commit: 9271d4f

This branch was successfully deployed

1 active deployment
Preview — 9271d4fb Deployed Oct 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants