Skip to content

build: re-export FastResponse and srvx types - #4499

Open
schplitt wants to merge 4 commits into
nitrojs:mainfrom
schplitt:feat/reexport_srvx
Open

build: re-export FastResponse and srvx types#4499
schplitt wants to merge 4 commits into
nitrojs:mainfrom
schplitt:feat/reexport_srvx

Conversation

@schplitt

@schplitt schplitt commented Jul 30, 2026

Copy link
Copy Markdown

closes #4498

I deemed the rest of the exports of srvx not necessary for usage in nitro so I only included the root package

@schplitt
schplitt requested a review from pi0 as a code owner July 30, 2026 18:04
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

@schplitt is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Nitro updates its srvx type re-exports: the declaration module adds request and runtime context types and removes response and URL types, while the runtime module removes ServerRequest and retains FastResponse and FastURL.

Changes

srvx type re-export

Layer / File(s) Summary
Updated srvx exports
src/types/srvx.ts, src/runtime/nitro.ts
The declaration module re-exports ServerRequest, ServerRequestContext, and ServerRuntimeContext; the runtime module re-exports only FastResponse and FastURL.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses a valid conventional commit prefix and summarizes the export changes.
Description check ✅ Passed The description is related to the srvx re-export change and the Nitro usage context.
Linked Issues check ✅ Passed The changes align with #4498 by adjusting srvx exports to support Nitro usage.
Out of Scope Changes check ✅ Passed The PR only changes exported type surfaces and does not introduce unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@pi0 pi0 changed the title chore: add srvx module re-export build: add srvx module re-export Jul 30, 2026
Comment thread package.json Outdated
"./context": "./dist/runtime/context.mjs",
"./database": "./dist/runtime/database.mjs",
"./h3": "./lib/h3.mjs",
"./srvx": "./lib/srvx.mjs",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exporting all can be risky against breaking change surface (srvx 0.12 to 0.13 could drop some for example), instead we can simply export FastResponse from main nitro subpath

@schplitt schplitt Jul 30, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright. I know I needed FastURL and ServerRequest aswell as the types for those + ServerRequestContext, ServerRuntimeContext in the past

These can go under the nitro subpath aswell?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have nitro/types subpath for types. Not sure about ServerRequestContext i guess it needs explicit declaration for srvx to extend

@schplitt schplitt Jul 30, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the exports :)

@pi0 pi0 changed the title build: add srvx module re-export build: re-export srvx.FastResponse Jul 30, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/runtime/nitro.ts`:
- Around line 26-27: Update the srvx type export declaration in the runtime
entry point to also export ServerRequestContext and ServerRuntimeContext,
matching the complete type surface exposed by src/types/srvx.ts and the
ServerRequestContext usage in serverFetch.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae0ccc18-623a-42d7-b688-12cac4201b82

📥 Commits

Reviewing files that changed from the base of the PR and between d5d4cf9 and a1209b6.

📒 Files selected for processing (2)
  • src/runtime/nitro.ts
  • src/types/srvx.ts

Comment thread src/runtime/nitro.ts Outdated
Comment on lines +26 to +27
// srvx
export type { FastResponse, FastURL, ServerRequest } from "srvx";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep the srvx type exports consistent across Nitro entry points.

src/types/srvx.ts exposes ServerRequestContext and ServerRuntimeContext, but this runtime entry point omits both. Since serverFetch already accepts ServerRequestContext, consumers cannot import the complete advertised srvx type surface from the runtime module.

Proposed fix
-export type { FastResponse, FastURL, ServerRequest } from "srvx";
+export type {
+  FastResponse,
+  FastURL,
+  ServerRequest,
+  ServerRequestContext,
+  ServerRuntimeContext,
+} from "srvx";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// srvx
export type { FastResponse, FastURL, ServerRequest } from "srvx";
// srvx
export type {
FastResponse,
FastURL,
ServerRequest,
ServerRequestContext,
ServerRuntimeContext,
} from "srvx";
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/runtime/nitro.ts` around lines 26 - 27, Update the srvx type export
declaration in the runtime entry point to also export ServerRequestContext and
ServerRuntimeContext, matching the complete type surface exposed by
src/types/srvx.ts and the ServerRequestContext usage in serverFetch.

@pi0 pi0 changed the title build: re-export srvx.FastResponse build: re-export FastResponse and srvx types Jul 30, 2026
Comment thread src/types/srvx.ts Outdated
Comment on lines +2 to +3
FastResponse,
FastURL,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think we need to export these types. FastURL type is URL same for FastResponse which is also already exported from main

Suggested change
FastResponse,
FastURL,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea right! Thanks for being patient

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/runtime/nitro.ts`:
- Line 27: Update the srvx type re-exports in the Nitro entry point to include
ServerRequestContext and ServerRuntimeContext alongside FastResponse and
FastURL. Keep ServerRequest removed, and ensure consumers importing types from
this module receive the complete supported srvx contract.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 21274f75-5534-4238-934a-ee7e213f7ce2

📥 Commits

Reviewing files that changed from the base of the PR and between a1209b6 and d05d202.

📒 Files selected for processing (2)
  • src/runtime/nitro.ts
  • src/types/srvx.ts
💤 Files with no reviewable changes (1)
  • src/types/srvx.ts

Comment thread src/runtime/nitro.ts
export type { H3Event, EventHandlerRequest, EventHandlerWithFetch } from "h3";

// srvx
export type { FastResponse, FastURL } from "srvx";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep srvx context exports consistent across Nitro entry points.

Removing ServerRequest matches the PR objective, but this entry point still omits ServerRequestContext and ServerRuntimeContext, which are exposed by src/types/srvx.ts and used by Nitro’s request APIs. Consumers importing Nitro types from this module cannot access the complete srvx contract.

At minimum, re-export the context types here, or confirm that they are intentionally declaration-only and adjust the public typing contract accordingly.

#!/bin/bash
rg -n -C 3 '\b(ServerRequestContext|ServerRuntimeContext|serverFetch)\b' src
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/runtime/nitro.ts` at line 27, Update the srvx type re-exports in the
Nitro entry point to include ServerRequestContext and ServerRuntimeContext
alongside FastResponse and FastURL. Keep ServerRequest removed, and ensure
consumers importing types from this module receive the complete supported srvx
contract.

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.

[Feature] Re-Export srvx similar to h3

2 participants