* fix: map route segment revalidate to Nitro routeRules SWR
- Add generateNitroRouteRules() to convert ISR routes to Nitro format
- Add writeBundle hook (vinext:nitro-route-rules) that emits routeRules
to .output/nitro.json when Nitro plugin is detected
- Closes#648
* fix: address review feedback for Nitro routeRules SWR
- Add Number.isFinite() guard to prevent Infinity serializing to null in JSON
- Replace Object.assign with per-route deep merge to preserve existing Nitro route fields
- Add parse error handling with warning + skip to avoid clobbering invalid nitro.json
- Fix Infinity test case to assert no rule is produced (reflects real behavior)
- Fix test pattern from [slug] to :slug (matches AppRoute.pattern syntax)
Note: shims.test.ts failures are pre-existing on main (React 19 SSR hook issues)
* fix: format import statement in index.ts
* fix: remove unnecessary ?? {} in spread operator to satisfy lint
* fix: prefix unused handler parameter with underscore to satisfy lint
* fix: nitro routeRules integration - duplicate execution, mkdirSync, type safety, and tests
- Add hasAppDir guard to prevent duplicate writeBundle execution in App Router multi-env builds
- Add mkdirSync with recursive:true before writing nitro.json to handle missing .output/ dir
- Use proper AppRoute[] and Route[] types instead of any[]
- Add clarifying comment on Infinity revalidate defensive test case
- Add TODO note (verified with URLPattern test) that vinext :param syntax works natively with Nitro's rou3 router
- Add integration tests for nitro.json file I/O: directory creation, content correctness, merge behavior, and empty routeRules handling
* fix: configure Nitro routeRules before build
Nitro reads routeRules from config during compilation, so mutating .output/nitro.json after writeBundle was the wrong integration point. Move ISR rule generation into nitro.setup and cover merge behavior with dedicated tests.
* fix: convert :param route patterns to /** globs for Nitro routeRules
Nitro routeRules use radix3 toRouteMatcher which documents exact paths
and /** glob patterns, not :param segments. Added convertToNitroPattern()
to translate vinext internal route syntax before emitting routeRules keys.
Also adds reviewer-requested documentation comments on the hand-rolled
NitroRouteConfig type, plugin cast, redundant scanning note, and test guards.
Signed-off-by: Divanshu Chauhan <divkix@divkix.me>
Made-with: Cursor
* fix(build): fix convertToNitroPattern regex for consecutive dynamic segments
- Replace regex with split-map-join approach to handle consecutive
dynamic segments correctly (e.g., /:a/:b now converts to /**/**)
- Add test coverage for consecutive dynamic segment conversion
- Fix mergeNitroRouteRules tests to use /** glob patterns for consistency
Fixes review feedback from ask-bonk on PR #669
* fix: map route params to correct rou3 wildcards in Nitro routeRules
Map bare :param segments to * (single-segment wildcard) and :param+/:param*
to ** (multi-segment wildcard) per rou3 semantics. Update doc comment to
reference rou3 instead of radix3. Fixes review feedback about semantic
correctness of route pattern conversion.
* docs: fix garbled JSDoc example for consecutive dynamic segments
The JSDoc example for /:a/:b was rendering with literal backticks that
made it hard to read. Changed '->' to 'produces' for clarity while
keeping the backticks around the wildcard patterns to prevent the
parser from interpreting /* as a comment start.
---------
Signed-off-by: Divanshu Chauhan <divkix@divkix.me>