[PR #669] [MERGED] fix: map route segment revalidate to Nitro routeRules SWR #757

Closed
opened 2026-05-06 13:09:58 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/669
Author: @Divkix
Created: 3/23/2026
Status: Merged
Merged: 3/29/2026
Merged by: @james-elicx

Base: mainHead: fix/nitro-route-rules-swr


📝 Commits (10+)

  • 7e8701d fix: map route segment revalidate to Nitro routeRules SWR
  • b5edd23 fix: address review feedback for Nitro routeRules SWR
  • ef0597a fix: format import statement in index.ts
  • 6edb174 fix: remove unnecessary ?? {} in spread operator to satisfy lint
  • 247890f fix: prefix unused handler parameter with underscore to satisfy lint
  • 5ff1d4e fix: nitro routeRules integration - duplicate execution, mkdirSync, type safety, and tests
  • ae50317 fix: configure Nitro routeRules before build
  • 14c106e fix: convert :param route patterns to /** globs for Nitro routeRules
  • 54d4cea fix(build): fix convertToNitroPattern regex for consecutive dynamic segments
  • ba0751b fix: map route params to correct rou3 wildcards in Nitro routeRules

📊 Changes

3 files changed (+521 additions, -0 deletions)

View changed files

packages/vinext/src/build/nitro-route-rules.ts (+132 -0)
📝 packages/vinext/src/index.ts (+45 -0)
tests/nitro-route-rules.test.ts (+344 -0)

📄 Description

Summary

  • Add generateNitroRouteRules() to convert ISR routes (App Router export const revalidate = N and Pages Router getStaticProps with revalidate) to Nitro's routeRules format with swr values
  • Add vinext:nitro-route-rules writeBundle hook that emits routeRules to .output/nitro.json when Nitro plugin is detected

Fixes

Closes #648

Testing

  • All 9 new generateNitroRouteRules unit tests pass
  • All 85 build-report tests pass
  • All 176 routing + build-report tests pass

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/669 **Author:** [@Divkix](https://github.com/Divkix) **Created:** 3/23/2026 **Status:** ✅ Merged **Merged:** 3/29/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/nitro-route-rules-swr` --- ### 📝 Commits (10+) - [`7e8701d`](https://github.com/cloudflare/vinext/commit/7e8701def3ab8e830ac738bfcdd3c065c5b71ea3) fix: map route segment revalidate to Nitro routeRules SWR - [`b5edd23`](https://github.com/cloudflare/vinext/commit/b5edd235294f80d62f16c4355b80b98fac7e9554) fix: address review feedback for Nitro routeRules SWR - [`ef0597a`](https://github.com/cloudflare/vinext/commit/ef0597a4fbdb6e59bd8838e4e951bd4ab458b12c) fix: format import statement in index.ts - [`6edb174`](https://github.com/cloudflare/vinext/commit/6edb1743c3af4ef4f36b21ab8c38cf1cbd5f56fc) fix: remove unnecessary ?? {} in spread operator to satisfy lint - [`247890f`](https://github.com/cloudflare/vinext/commit/247890f139e7d6bf66690e1c6a894f210c61c718) fix: prefix unused handler parameter with underscore to satisfy lint - [`5ff1d4e`](https://github.com/cloudflare/vinext/commit/5ff1d4e232f8fa90f3f6055133e3f79682e34bb3) fix: nitro routeRules integration - duplicate execution, mkdirSync, type safety, and tests - [`ae50317`](https://github.com/cloudflare/vinext/commit/ae5031754cabe517df0a910756a4f2cf6ea5186b) fix: configure Nitro routeRules before build - [`14c106e`](https://github.com/cloudflare/vinext/commit/14c106e9b5bbaf5bb6d5ee3501fb6819be5e37dc) fix: convert :param route patterns to /** globs for Nitro routeRules - [`54d4cea`](https://github.com/cloudflare/vinext/commit/54d4cea30f94e9149d7f11ffe36abd3724e87117) fix(build): fix convertToNitroPattern regex for consecutive dynamic segments - [`ba0751b`](https://github.com/cloudflare/vinext/commit/ba0751b807a5490b620e38b95d786ebca87068a0) fix: map route params to correct rou3 wildcards in Nitro routeRules ### 📊 Changes **3 files changed** (+521 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `packages/vinext/src/build/nitro-route-rules.ts` (+132 -0) 📝 `packages/vinext/src/index.ts` (+45 -0) ➕ `tests/nitro-route-rules.test.ts` (+344 -0) </details> ### 📄 Description ## Summary - Add `generateNitroRouteRules()` to convert ISR routes (App Router `export const revalidate = N` and Pages Router `getStaticProps` with `revalidate`) to Nitro's `routeRules` format with `swr` values - Add `vinext:nitro-route-rules` writeBundle hook that emits routeRules to `.output/nitro.json` when Nitro plugin is detected ## Fixes Closes #648 ## Testing - All 9 new `generateNitroRouteRules` unit tests pass - All 85 build-report tests pass - All 176 routing + build-report tests pass --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:09:58 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#757
No description provided.