@rangojs/router 0.0.0-experimental.f2d1a2f1 → 0.0.0-experimental.f4a8e8de
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +8 -4
- package/README.md +318 -821
- package/dist/bin/rango.js +925 -271
- package/dist/testing/vitest.js +82 -0
- package/dist/types/__internal.d.ts +127 -0
- package/dist/types/bin/rango.d.ts +1 -0
- package/dist/types/browser/action-coordinator.d.ts +57 -0
- package/dist/types/browser/action-fence.d.ts +33 -0
- package/dist/types/browser/app-shell.d.ts +34 -0
- package/dist/types/browser/app-version.d.ts +6 -0
- package/dist/types/browser/connection-warmup.d.ts +31 -0
- package/dist/types/browser/cookie-name.d.ts +66 -0
- package/dist/types/browser/dev-discovery.d.ts +11 -0
- package/dist/types/browser/event-controller.d.ts +231 -0
- package/dist/types/browser/history-state.d.ts +26 -0
- package/dist/types/browser/index.d.ts +1 -0
- package/dist/types/browser/intercept-utils.d.ts +30 -0
- package/dist/types/browser/invalidate-client-cache.d.ts +17 -0
- package/dist/types/browser/link-interceptor.d.ts +53 -0
- package/dist/types/browser/logging.d.ts +33 -0
- package/dist/types/browser/merge-segment-loaders.d.ts +38 -0
- package/dist/types/browser/navigation-bridge.d.ts +39 -0
- package/dist/types/browser/navigation-client.d.ts +17 -0
- package/dist/types/browser/navigation-store-handle.d.ts +25 -0
- package/dist/types/browser/navigation-store.d.ts +85 -0
- package/dist/types/browser/navigation-transaction.d.ts +75 -0
- package/dist/types/browser/network-error-handler.d.ts +35 -0
- package/dist/types/browser/notify-listeners.d.ts +2 -0
- package/dist/types/browser/partial-update.d.ts +61 -0
- package/dist/types/browser/prefetch/cache.d.ts +224 -0
- package/dist/types/browser/prefetch/default-strategy.d.ts +31 -0
- package/dist/types/browser/prefetch/fetch.d.ts +52 -0
- package/dist/types/browser/prefetch/invalidation.d.ts +6 -0
- package/dist/types/browser/prefetch/loader.d.ts +12 -0
- package/dist/types/browser/prefetch/observer.d.ts +24 -0
- package/dist/types/browser/prefetch/policy.d.ts +13 -0
- package/dist/types/browser/prefetch/queue.d.ts +48 -0
- package/dist/types/browser/prefetch/resource-ready.d.ts +28 -0
- package/dist/types/browser/prefetch/runtime.d.ts +2 -0
- package/dist/types/browser/rango-state.d.ts +56 -0
- package/dist/types/browser/react/Link.d.ts +132 -0
- package/dist/types/browser/react/NavigationProvider.d.ts +88 -0
- package/dist/types/browser/react/ScrollRestoration.d.ts +78 -0
- package/dist/types/browser/react/context.d.ts +57 -0
- package/dist/types/browser/react/filter-segment-order.d.ts +35 -0
- package/dist/types/browser/react/index.d.ts +1 -0
- package/dist/types/browser/react/location-state-shared.d.ts +162 -0
- package/dist/types/browser/react/location-state.d.ts +29 -0
- package/dist/types/browser/react/mount-context.d.ts +23 -0
- package/dist/types/browser/react/nonce-context.d.ts +14 -0
- package/dist/types/browser/react/shallow-equal.d.ts +5 -0
- package/dist/types/browser/react/use-action.d.ts +61 -0
- package/dist/types/browser/react/use-handle.d.ts +21 -0
- package/dist/types/browser/react/use-href.d.ts +32 -0
- package/dist/types/browser/react/use-link-status.d.ts +36 -0
- package/dist/types/browser/react/use-mount.d.ts +24 -0
- package/dist/types/browser/react/use-navigation.d.ts +15 -0
- package/dist/types/browser/react/use-params.d.ts +21 -0
- package/dist/types/browser/react/use-pathname.d.ts +13 -0
- package/dist/types/browser/react/use-reverse.d.ts +40 -0
- package/dist/types/browser/react/use-router.d.ts +23 -0
- package/dist/types/browser/react/use-search-params.d.ts +19 -0
- package/dist/types/browser/react/use-segments.d.ts +29 -0
- package/dist/types/browser/response-adapter.d.ts +58 -0
- package/dist/types/browser/rsc-router.d.ts +146 -0
- package/dist/types/browser/scroll-restoration.d.ts +103 -0
- package/dist/types/browser/segment-reconciler.d.ts +74 -0
- package/dist/types/browser/segment-structure-assert.d.ts +16 -0
- package/dist/types/browser/server-action-bridge.d.ts +29 -0
- package/dist/types/browser/types.d.ts +546 -0
- package/dist/types/browser/validate-redirect-origin.d.ts +28 -0
- package/dist/types/build/collect-fallback-refs.d.ts +5 -0
- package/dist/types/build/generate-manifest.d.ts +106 -0
- package/dist/types/build/generate-route-types.d.ts +8 -0
- package/dist/types/build/index.d.ts +21 -0
- package/dist/types/build/merge-full-manifests.d.ts +3 -0
- package/dist/types/build/prefix-tree-utils.d.ts +56 -0
- package/dist/types/build/route-trie.d.ts +20 -0
- package/dist/types/build/route-types/ast-helpers.d.ts +3 -0
- package/dist/types/build/route-types/ast-route-extraction.d.ts +13 -0
- package/dist/types/build/route-types/codegen.d.ts +16 -0
- package/dist/types/build/route-types/include-resolution.d.ts +74 -0
- package/dist/types/build/route-types/param-extraction.d.ts +13 -0
- package/dist/types/build/route-types/per-module-writer.d.ts +20 -0
- package/dist/types/build/route-types/router-processing.d.ts +81 -0
- package/dist/types/build/route-types/scan-filter.d.ts +17 -0
- package/dist/types/build/route-types/source-scan.d.ts +13 -0
- package/dist/types/build/runtime-discovery.d.ts +24 -0
- package/dist/types/cache/background-task.d.ts +21 -0
- package/dist/types/cache/cache-error.d.ts +71 -0
- package/dist/types/cache/cache-exec-scope.d.ts +31 -0
- package/dist/types/cache/cache-key-utils.d.ts +43 -0
- package/dist/types/cache/cache-policy.d.ts +59 -0
- package/dist/types/cache/cache-runtime.d.ts +51 -0
- package/dist/types/cache/cache-scope.d.ts +215 -0
- package/dist/types/cache/cache-tag.d.ts +79 -0
- package/dist/types/cache/cf/cf-base64.d.ts +4 -0
- package/dist/types/cache/cf/cf-cache-constants.d.ts +112 -0
- package/dist/types/cache/cf/cf-cache-store.d.ts +616 -0
- package/dist/types/cache/cf/cf-cache-types.d.ts +365 -0
- package/dist/types/cache/cf/cf-kv-utils.d.ts +43 -0
- package/dist/types/cache/cf/cf-tag-marker-memo.d.ts +15 -0
- package/dist/types/cache/cf/cf-zone-purge.d.ts +31 -0
- package/dist/types/cache/cf/index.d.ts +4 -0
- package/dist/types/cache/document-cache.d.ts +71 -0
- package/dist/types/cache/handle-capture.d.ts +23 -0
- package/dist/types/cache/handle-snapshot.d.ts +39 -0
- package/dist/types/cache/index.d.ts +9 -0
- package/dist/types/cache/memory-segment-store.d.ts +163 -0
- package/dist/types/cache/profile-registry.d.ts +40 -0
- package/dist/types/cache/read-through-swr.d.ts +61 -0
- package/dist/types/cache/search-params-filter.d.ts +64 -0
- package/dist/types/cache/segment-codec.d.ts +78 -0
- package/dist/types/cache/shell-snapshot.d.ts +186 -0
- package/dist/types/cache/tag-invalidation.d.ts +74 -0
- package/dist/types/cache/taint.d.ts +77 -0
- package/dist/types/cache/types.d.ts +503 -0
- package/dist/types/cache/vercel/index.d.ts +1 -0
- package/dist/types/cache/vercel/vercel-cache-store.d.ts +268 -0
- package/dist/types/client-urls/client-root.d.ts +38 -0
- package/dist/types/client-urls/client-urls.d.ts +5 -0
- package/dist/types/client-urls/navigation.d.ts +38 -0
- package/dist/types/client-urls/revalidation-protocol.d.ts +25 -0
- package/dist/types/client-urls/server-projection.d.ts +57 -0
- package/dist/types/client-urls/types.d.ts +132 -0
- package/dist/types/client.d.ts +191 -0
- package/dist/types/client.rsc.d.ts +41 -0
- package/dist/types/cloudflare/index.d.ts +7 -0
- package/dist/types/cloudflare/tracing.d.ts +57 -0
- package/dist/types/component-utils.d.ts +46 -0
- package/dist/types/components/DefaultDocument.d.ts +13 -0
- package/dist/types/context-var.d.ts +84 -0
- package/dist/types/debug.d.ts +57 -0
- package/dist/types/decode-loader-results.d.ts +42 -0
- package/dist/types/default-error-boundary.d.ts +10 -0
- package/dist/types/defer.d.ts +89 -0
- package/dist/types/deps/browser.d.ts +1 -0
- package/dist/types/deps/html-stream-client.d.ts +1 -0
- package/dist/types/deps/html-stream-server.d.ts +1 -0
- package/dist/types/deps/rsc.d.ts +1 -0
- package/dist/types/deps/ssr.d.ts +1 -0
- package/dist/types/dev-discovery-protocol.d.ts +5 -0
- package/dist/types/encode-kv.d.ts +35 -0
- package/dist/types/errors.d.ts +227 -0
- package/dist/types/escape-script.d.ts +44 -0
- package/dist/types/handle.d.ts +93 -0
- package/dist/types/handles/MetaTags.d.ts +17 -0
- package/dist/types/handles/Scripts.d.ts +38 -0
- package/dist/types/handles/breadcrumbs.d.ts +43 -0
- package/dist/types/handles/deferred-resolution.d.ts +53 -0
- package/dist/types/handles/is-thenable.d.ts +10 -0
- package/dist/types/handles/meta.d.ts +43 -0
- package/dist/types/handles/script.d.ts +139 -0
- package/dist/types/host/cookie-handler.d.ts +8 -0
- package/dist/types/host/errors.d.ts +40 -0
- package/dist/types/host/index.d.ts +33 -0
- package/dist/types/host/pattern-matcher.d.ts +30 -0
- package/dist/types/host/router.d.ts +12 -0
- package/dist/types/host/testing.d.ts +41 -0
- package/dist/types/host/types.d.ts +148 -0
- package/dist/types/host/utils.d.ts +20 -0
- package/dist/types/href-client.d.ts +214 -0
- package/dist/types/index.d.ts +113 -0
- package/dist/types/index.rsc.d.ts +52 -0
- package/dist/types/internal-debug.d.ts +1 -0
- package/dist/types/loader-redirect.d.ts +18 -0
- package/dist/types/loader-store.d.ts +193 -0
- package/dist/types/loader.d.ts +18 -0
- package/dist/types/loader.rsc.d.ts +18 -0
- package/dist/types/missing-id-error.d.ts +1 -0
- package/dist/types/outlet-context.d.ts +24 -0
- package/dist/types/outlet-provider.d.ts +14 -0
- package/dist/types/prerender/build-shell-capture.d.ts +104 -0
- package/dist/types/prerender/param-hash.d.ts +6 -0
- package/dist/types/prerender/shell-manifest-key.d.ts +18 -0
- package/dist/types/prerender/store.d.ts +63 -0
- package/dist/types/prerender.d.ts +292 -0
- package/dist/types/redirect-origin.d.ts +67 -0
- package/dist/types/regex-escape.d.ts +6 -0
- package/dist/types/render-error-thrower.d.ts +13 -0
- package/dist/types/response-utils.d.ts +35 -0
- package/dist/types/reverse.d.ts +206 -0
- package/dist/types/root-error-boundary.d.ts +32 -0
- package/dist/types/route-content-wrapper.d.ts +81 -0
- package/dist/types/route-definition/dsl-helpers.d.ts +130 -0
- package/dist/types/route-definition/helper-factories.d.ts +22 -0
- package/dist/types/route-definition/helpers-types.d.ts +393 -0
- package/dist/types/route-definition/index.d.ts +7 -0
- package/dist/types/route-definition/redirect.d.ts +48 -0
- package/dist/types/route-definition/resolve-handler-use.d.ts +19 -0
- package/dist/types/route-definition/use-item-types.d.ts +1 -0
- package/dist/types/route-definition.d.ts +1 -0
- package/dist/types/route-map-builder.d.ts +102 -0
- package/dist/types/route-name.d.ts +27 -0
- package/dist/types/route-types.d.ts +172 -0
- package/dist/types/router/basename.d.ts +10 -0
- package/dist/types/router/content-negotiation.d.ts +91 -0
- package/dist/types/router/debug-manifest.d.ts +7 -0
- package/dist/types/router/error-handling.d.ts +110 -0
- package/dist/types/router/find-match.d.ts +19 -0
- package/dist/types/router/handler-context.d.ts +41 -0
- package/dist/types/router/instrument.d.ts +191 -0
- package/dist/types/router/intercept-resolution.d.ts +91 -0
- package/dist/types/router/lazy-includes.d.ts +26 -0
- package/dist/types/router/loader-resolution.d.ts +85 -0
- package/dist/types/router/logging.d.ts +41 -0
- package/dist/types/router/manifest.d.ts +8 -0
- package/dist/types/router/match-api.d.ts +19 -0
- package/dist/types/router/match-context.d.ts +184 -0
- package/dist/types/router/match-handlers.d.ts +48 -0
- package/dist/types/router/match-middleware/background-revalidation.d.ts +113 -0
- package/dist/types/router/match-middleware/cache-lookup.d.ts +126 -0
- package/dist/types/router/match-middleware/cache-store.d.ts +112 -0
- package/dist/types/router/match-middleware/index.d.ts +80 -0
- package/dist/types/router/match-middleware/intercept-resolution.d.ts +116 -0
- package/dist/types/router/match-middleware/segment-resolution.d.ts +94 -0
- package/dist/types/router/match-pipelines.d.ts +103 -0
- package/dist/types/router/match-result.d.ts +114 -0
- package/dist/types/router/metrics.d.ts +6 -0
- package/dist/types/router/middleware-types.d.ts +74 -0
- package/dist/types/router/middleware.d.ts +116 -0
- package/dist/types/router/navigation-snapshot.d.ts +51 -0
- package/dist/types/router/params-util.d.ts +8 -0
- package/dist/types/router/parse-pattern.d.ts +38 -0
- package/dist/types/router/pattern-matching.d.ts +169 -0
- package/dist/types/router/prefetch-cache-ttl.d.ts +27 -0
- package/dist/types/router/prefetch-default.d.ts +28 -0
- package/dist/types/router/prefetch-limits.d.ts +20 -0
- package/dist/types/router/prerender-match.d.ts +53 -0
- package/dist/types/router/preview-match.d.ts +22 -0
- package/dist/types/router/request-classification.d.ts +104 -0
- package/dist/types/router/revalidation.d.ts +64 -0
- package/dist/types/router/route-snapshot.d.ts +112 -0
- package/dist/types/router/route-trie-builder.d.ts +77 -0
- package/dist/types/router/router-context.d.ts +137 -0
- package/dist/types/router/router-interfaces.d.ts +461 -0
- package/dist/types/router/router-options.d.ts +792 -0
- package/dist/types/router/router-registry.d.ts +15 -0
- package/dist/types/router/segment-resolution/fresh.d.ts +55 -0
- package/dist/types/router/segment-resolution/helpers.d.ts +93 -0
- package/dist/types/router/segment-resolution/loader-cache.d.ts +33 -0
- package/dist/types/router/segment-resolution/loader-mask.d.ts +44 -0
- package/dist/types/router/segment-resolution/loader-snapshot.d.ts +90 -0
- package/dist/types/router/segment-resolution/mask-nested.d.ts +53 -0
- package/dist/types/router/segment-resolution/revalidation.d.ts +85 -0
- package/dist/types/router/segment-resolution/static-store.d.ts +17 -0
- package/dist/types/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
- package/dist/types/router/segment-resolution/view-transition-default.d.ts +27 -0
- package/dist/types/router/segment-resolution.d.ts +3 -0
- package/dist/types/router/segment-wrappers.d.ts +53 -0
- package/dist/types/router/state-cookie-name.d.ts +1 -0
- package/dist/types/router/substitute-pattern-params.d.ts +23 -0
- package/dist/types/router/telemetry-otel.d.ts +113 -0
- package/dist/types/router/telemetry.d.ts +216 -0
- package/dist/types/router/timeout.d.ts +107 -0
- package/dist/types/router/tracing.d.ts +139 -0
- package/dist/types/router/transition-when.d.ts +13 -0
- package/dist/types/router/trie-matching.d.ts +32 -0
- package/dist/types/router/types.d.ts +98 -0
- package/dist/types/router/url-params.d.ts +26 -0
- package/dist/types/router.d.ts +7 -0
- package/dist/types/rsc/capture-queue.d.ts +49 -0
- package/dist/types/rsc/full-payload.d.ts +22 -0
- package/dist/types/rsc/handler-context.d.ts +32 -0
- package/dist/types/rsc/handler.d.ts +9 -0
- package/dist/types/rsc/helpers.d.ts +127 -0
- package/dist/types/rsc/index.d.ts +17 -0
- package/dist/types/rsc/json-route-result.d.ts +20 -0
- package/dist/types/rsc/loader-fetch.d.ts +14 -0
- package/dist/types/rsc/manifest-init.d.ts +18 -0
- package/dist/types/rsc/nonce.d.ts +28 -0
- package/dist/types/rsc/origin-guard.d.ts +50 -0
- package/dist/types/rsc/progressive-enhancement.d.ts +19 -0
- package/dist/types/rsc/redirect-guard.d.ts +37 -0
- package/dist/types/rsc/render-pipeline.d.ts +148 -0
- package/dist/types/rsc/response-cache-serve.d.ts +46 -0
- package/dist/types/rsc/response-error.d.ts +19 -0
- package/dist/types/rsc/response-route-handler.d.ts +29 -0
- package/dist/types/rsc/routine-plan.d.ts +124 -0
- package/dist/types/rsc/rsc-rendering.d.ts +18 -0
- package/dist/types/rsc/runtime-warnings.d.ts +22 -0
- package/dist/types/rsc/server-action.d.ts +68 -0
- package/dist/types/rsc/shell-build-manifest.d.ts +90 -0
- package/dist/types/rsc/shell-capture-constants.d.ts +44 -0
- package/dist/types/rsc/shell-capture.d.ts +406 -0
- package/dist/types/rsc/shell-serve.d.ts +189 -0
- package/dist/types/rsc/ssr-setup.d.ts +73 -0
- package/dist/types/rsc/stream-idle.d.ts +60 -0
- package/dist/types/rsc/transition-gate.d.ts +23 -0
- package/dist/types/rsc/types.d.ts +328 -0
- package/dist/types/runtime-env.d.ts +1 -0
- package/dist/types/search-params.d.ts +125 -0
- package/dist/types/segment-content-promise.d.ts +13 -0
- package/dist/types/segment-fragments.d.ts +79 -0
- package/dist/types/segment-loader-promise.d.ts +22 -0
- package/dist/types/segment-system.d.ts +86 -0
- package/dist/types/serialize.d.ts +164 -0
- package/dist/types/server/context.d.ts +510 -0
- package/dist/types/server/cookie-parse.d.ts +10 -0
- package/dist/types/server/cookie-store.d.ts +107 -0
- package/dist/types/server/fetchable-loader-store.d.ts +20 -0
- package/dist/types/server/handle-store.d.ts +131 -0
- package/dist/types/server/loader-registry.d.ts +32 -0
- package/dist/types/server/request-context.d.ts +707 -0
- package/dist/types/server/root-layout.d.ts +3 -0
- package/dist/types/server.d.ts +16 -0
- package/dist/types/ssr/index.d.ts +233 -0
- package/dist/types/ssr/inject-rsc-eager.d.ts +3 -0
- package/dist/types/ssr/preinit-client-references.d.ts +71 -0
- package/dist/types/ssr/ssr-root.d.ts +69 -0
- package/dist/types/static-handler.d.ts +71 -0
- package/dist/types/testing/cache-status.d.ts +63 -0
- package/dist/types/testing/collect-handle.d.ts +20 -0
- package/dist/types/testing/dispatch.d.ts +127 -0
- package/dist/types/testing/dom.entry.d.ts +15 -0
- package/dist/types/testing/e2e/fixture.d.ts +37 -0
- package/dist/types/testing/e2e/index.d.ts +31 -0
- package/dist/types/testing/e2e/matchers.d.ts +17 -0
- package/dist/types/testing/e2e/page-helpers.d.ts +86 -0
- package/dist/types/testing/e2e/parity.d.ts +111 -0
- package/dist/types/testing/e2e/server.d.ts +35 -0
- package/dist/types/testing/flight-matchers.d.ts +55 -0
- package/dist/types/testing/flight-normalize.d.ts +1 -0
- package/dist/types/testing/flight-tree.d.ts +192 -0
- package/dist/types/testing/flight.d.ts +115 -0
- package/dist/types/testing/flight.entry.d.ts +27 -0
- package/dist/types/testing/generated-routes.d.ts +66 -0
- package/dist/types/testing/index.d.ts +54 -0
- package/dist/types/testing/internal/context.d.ts +225 -0
- package/dist/types/testing/internal/flight-client-globals.d.ts +1 -0
- package/dist/types/testing/internal/seed-vars.d.ts +30 -0
- package/dist/types/testing/render-handler.d.ts +160 -0
- package/dist/types/testing/render-route.d.ts +265 -0
- package/dist/types/testing/run-loader.d.ts +195 -0
- package/dist/types/testing/run-middleware.d.ts +132 -0
- package/dist/types/testing/run-transition-when.d.ts +78 -0
- package/dist/types/testing/shell-status.d.ts +81 -0
- package/dist/types/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
- package/dist/types/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
- package/dist/types/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
- package/dist/types/testing/vitest-stubs/version.d.ts +1 -0
- package/dist/types/testing/vitest.d.ts +205 -0
- package/dist/types/theme/ThemeProvider.d.ts +13 -0
- package/dist/types/theme/ThemeScript.d.ts +45 -0
- package/dist/types/theme/constants.d.ts +39 -0
- package/dist/types/theme/index.d.ts +29 -0
- package/dist/types/theme/theme-context.d.ts +21 -0
- package/dist/types/theme/theme-script.d.ts +26 -0
- package/dist/types/theme/types.d.ts +162 -0
- package/dist/types/theme/use-theme.d.ts +8 -0
- package/dist/types/types/boundaries.d.ts +110 -0
- package/dist/types/types/cache-types.d.ts +191 -0
- package/dist/types/types/error-types.d.ts +114 -0
- package/dist/types/types/global-namespace.d.ts +90 -0
- package/dist/types/types/handler-context.d.ts +658 -0
- package/dist/types/types/index.d.ts +11 -0
- package/dist/types/types/loader-types.d.ts +208 -0
- package/dist/types/types/request-scope.d.ts +93 -0
- package/dist/types/types/route-config.d.ts +105 -0
- package/dist/types/types/route-entry.d.ts +98 -0
- package/dist/types/types/segments.d.ts +246 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/types/urls/include-helper.d.ts +17 -0
- package/dist/types/urls/include-provider.d.ts +27 -0
- package/dist/types/urls/index.d.ts +6 -0
- package/dist/types/urls/path-helper-types.d.ts +198 -0
- package/dist/types/urls/path-helper.d.ts +12 -0
- package/dist/types/urls/pattern-types.d.ts +166 -0
- package/dist/types/urls/response-types.d.ts +67 -0
- package/dist/types/urls/type-extraction.d.ts +157 -0
- package/dist/types/urls/urls-function.d.ts +24 -0
- package/dist/types/urls.d.ts +1 -0
- package/dist/types/use-loader.d.ts +150 -0
- package/dist/types/vercel/index.d.ts +10 -0
- package/dist/types/vercel/tracing.d.ts +71 -0
- package/dist/types/vite/debug.d.ts +80 -0
- package/dist/types/vite/discovery/bundle-postprocess.d.ts +12 -0
- package/dist/types/vite/discovery/client-urls-projection.d.ts +53 -0
- package/dist/types/vite/discovery/dev-prerender-cache.d.ts +65 -0
- package/dist/types/vite/discovery/discover-routers.d.ts +17 -0
- package/dist/types/vite/discovery/discovery-errors.d.ts +113 -0
- package/dist/types/vite/discovery/gate-state.d.ts +79 -0
- package/dist/types/vite/discovery/prerender-collection.d.ts +24 -0
- package/dist/types/vite/discovery/route-types-writer.d.ts +32 -0
- package/dist/types/vite/discovery/self-gen-tracking.d.ts +22 -0
- package/dist/types/vite/discovery/shell-prerender-phase.d.ts +40 -0
- package/dist/types/vite/discovery/state.d.ts +170 -0
- package/dist/types/vite/discovery/virtual-module-codegen.d.ts +15 -0
- package/dist/types/vite/encryption-key.d.ts +2 -0
- package/dist/types/vite/index.d.ts +11 -0
- package/dist/types/vite/inject-client-debug.d.ts +56 -0
- package/dist/types/vite/plugin-types.d.ts +298 -0
- package/dist/types/vite/plugins/cjs-to-esm.d.ts +6 -0
- package/dist/types/vite/plugins/client-ref-dedup.d.ts +40 -0
- package/dist/types/vite/plugins/client-ref-hashing.d.ts +35 -0
- package/dist/types/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
- package/dist/types/vite/plugins/expose-action-id.d.ts +18 -0
- package/dist/types/vite/plugins/expose-id-utils.d.ts +37 -0
- package/dist/types/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
- package/dist/types/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
- package/dist/types/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
- package/dist/types/vite/plugins/expose-ids/router-transform.d.ts +13 -0
- package/dist/types/vite/plugins/expose-ids/types.d.ts +29 -0
- package/dist/types/vite/plugins/expose-internal-ids.d.ts +16 -0
- package/dist/types/vite/plugins/performance-tracks.d.ts +25 -0
- package/dist/types/vite/plugins/refresh-cmd.d.ts +20 -0
- package/dist/types/vite/plugins/server-ref-hashing.d.ts +24 -0
- package/dist/types/vite/plugins/server-reference-pattern.d.ts +1 -0
- package/dist/types/vite/plugins/use-cache-transform.d.ts +20 -0
- package/dist/types/vite/plugins/vercel-output.d.ts +85 -0
- package/dist/types/vite/plugins/version-injector.d.ts +21 -0
- package/dist/types/vite/plugins/version-plugin.d.ts +19 -0
- package/dist/types/vite/plugins/virtual-entries.d.ts +36 -0
- package/dist/types/vite/plugins/virtual-stub-plugin.d.ts +7 -0
- package/dist/types/vite/rango.d.ts +29 -0
- package/dist/types/vite/router-discovery.d.ts +23 -0
- package/dist/types/vite/utils/ast-handler-extract.d.ts +64 -0
- package/dist/types/vite/utils/banner.d.ts +2 -0
- package/dist/types/vite/utils/bundle-analysis.d.ts +28 -0
- package/dist/types/vite/utils/client-chunks.d.ts +55 -0
- package/dist/types/vite/utils/directive-prologue.d.ts +16 -0
- package/dist/types/vite/utils/forward-user-plugins.d.ts +37 -0
- package/dist/types/vite/utils/manifest-utils.d.ts +7 -0
- package/dist/types/vite/utils/package-resolution.d.ts +6 -0
- package/dist/types/vite/utils/prerender-utils.d.ts +32 -0
- package/dist/types/vite/utils/shared-utils.d.ts +67 -0
- package/dist/types.backup/__internal.d.ts +127 -0
- package/dist/types.backup/bin/rango.d.ts +1 -0
- package/dist/types.backup/browser/action-coordinator.d.ts +57 -0
- package/dist/types.backup/browser/action-fence.d.ts +33 -0
- package/dist/types.backup/browser/app-shell.d.ts +34 -0
- package/dist/types.backup/browser/app-version.d.ts +6 -0
- package/dist/types.backup/browser/connection-warmup.d.ts +31 -0
- package/dist/types.backup/browser/cookie-name.d.ts +66 -0
- package/dist/types.backup/browser/event-controller.d.ts +221 -0
- package/dist/types.backup/browser/history-state.d.ts +26 -0
- package/dist/types.backup/browser/index.d.ts +1 -0
- package/dist/types.backup/browser/intercept-utils.d.ts +30 -0
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +17 -0
- package/dist/types.backup/browser/link-interceptor.d.ts +43 -0
- package/dist/types.backup/browser/logging.d.ts +33 -0
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +38 -0
- package/dist/types.backup/browser/navigation-bridge.d.ts +27 -0
- package/dist/types.backup/browser/navigation-client.d.ts +17 -0
- package/dist/types.backup/browser/navigation-store-handle.d.ts +25 -0
- package/dist/types.backup/browser/navigation-store.d.ts +95 -0
- package/dist/types.backup/browser/navigation-transaction.d.ts +75 -0
- package/dist/types.backup/browser/network-error-handler.d.ts +35 -0
- package/dist/types.backup/browser/partial-update.d.ts +61 -0
- package/dist/types.backup/browser/prefetch/cache.d.ts +183 -0
- package/dist/types.backup/browser/prefetch/fetch.d.ts +52 -0
- package/dist/types.backup/browser/prefetch/observer.d.ts +27 -0
- package/dist/types.backup/browser/prefetch/policy.d.ts +13 -0
- package/dist/types.backup/browser/prefetch/queue.d.ts +48 -0
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +28 -0
- package/dist/types.backup/browser/rango-state.d.ts +52 -0
- package/dist/types.backup/browser/react/Link.d.ts +140 -0
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +88 -0
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +78 -0
- package/dist/types.backup/browser/react/context.d.ts +54 -0
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +35 -0
- package/dist/types.backup/browser/react/index.d.ts +1 -0
- package/dist/types.backup/browser/react/location-state-shared.d.ts +162 -0
- package/dist/types.backup/browser/react/location-state.d.ts +29 -0
- package/dist/types.backup/browser/react/mount-context.d.ts +23 -0
- package/dist/types.backup/browser/react/nonce-context.d.ts +14 -0
- package/dist/types.backup/browser/react/shallow-equal.d.ts +5 -0
- package/dist/types.backup/browser/react/use-action.d.ts +61 -0
- package/dist/types.backup/browser/react/use-handle.d.ts +21 -0
- package/dist/types.backup/browser/react/use-href.d.ts +32 -0
- package/dist/types.backup/browser/react/use-link-status.d.ts +36 -0
- package/dist/types.backup/browser/react/use-mount.d.ts +24 -0
- package/dist/types.backup/browser/react/use-navigation.d.ts +15 -0
- package/dist/types.backup/browser/react/use-params.d.ts +21 -0
- package/dist/types.backup/browser/react/use-pathname.d.ts +13 -0
- package/dist/types.backup/browser/react/use-reverse.d.ts +40 -0
- package/dist/types.backup/browser/react/use-router.d.ts +23 -0
- package/dist/types.backup/browser/react/use-search-params.d.ts +19 -0
- package/dist/types.backup/browser/react/use-segments.d.ts +29 -0
- package/dist/types.backup/browser/response-adapter.d.ts +58 -0
- package/dist/types.backup/browser/rsc-router.d.ts +141 -0
- package/dist/types.backup/browser/scroll-restoration.d.ts +103 -0
- package/dist/types.backup/browser/segment-reconciler.d.ts +74 -0
- package/dist/types.backup/browser/segment-structure-assert.d.ts +16 -0
- package/dist/types.backup/browser/server-action-bridge.d.ts +29 -0
- package/dist/types.backup/browser/types.d.ts +530 -0
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +28 -0
- package/dist/types.backup/build/collect-fallback-refs.d.ts +5 -0
- package/dist/types.backup/build/generate-manifest.d.ts +100 -0
- package/dist/types.backup/build/generate-route-types.d.ts +8 -0
- package/dist/types.backup/build/index.d.ts +21 -0
- package/dist/types.backup/build/prefix-tree-utils.d.ts +56 -0
- package/dist/types.backup/build/route-trie.d.ts +89 -0
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +3 -0
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/codegen.d.ts +16 -0
- package/dist/types.backup/build/route-types/include-resolution.d.ts +74 -0
- package/dist/types.backup/build/route-types/param-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +18 -0
- package/dist/types.backup/build/route-types/router-processing.d.ts +82 -0
- package/dist/types.backup/build/route-types/scan-filter.d.ts +17 -0
- package/dist/types.backup/build/route-types/source-scan.d.ts +13 -0
- package/dist/types.backup/build/runtime-discovery.d.ts +24 -0
- package/dist/types.backup/cache/background-task.d.ts +21 -0
- package/dist/types.backup/cache/cache-error.d.ts +71 -0
- package/dist/types.backup/cache/cache-key-utils.d.ts +35 -0
- package/dist/types.backup/cache/cache-policy.d.ts +59 -0
- package/dist/types.backup/cache/cache-runtime.d.ts +51 -0
- package/dist/types.backup/cache/cache-scope.d.ts +134 -0
- package/dist/types.backup/cache/cache-tag.d.ts +79 -0
- package/dist/types.backup/cache/cf/cf-base64.d.ts +4 -0
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +105 -0
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +481 -0
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +300 -0
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +22 -0
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +15 -0
- package/dist/types.backup/cache/cf/index.d.ts +3 -0
- package/dist/types.backup/cache/document-cache.d.ts +69 -0
- package/dist/types.backup/cache/handle-capture.d.ts +23 -0
- package/dist/types.backup/cache/handle-snapshot.d.ts +39 -0
- package/dist/types.backup/cache/index.d.ts +7 -0
- package/dist/types.backup/cache/memory-segment-store.d.ts +163 -0
- package/dist/types.backup/cache/profile-registry.d.ts +40 -0
- package/dist/types.backup/cache/read-through-swr.d.ts +60 -0
- package/dist/types.backup/cache/segment-codec.d.ts +78 -0
- package/dist/types.backup/cache/shell-snapshot.d.ts +162 -0
- package/dist/types.backup/cache/tag-invalidation.d.ts +74 -0
- package/dist/types.backup/cache/taint.d.ts +71 -0
- package/dist/types.backup/cache/types.d.ts +407 -0
- package/dist/types.backup/cache/vercel/index.d.ts +1 -0
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +267 -0
- package/dist/types.backup/client.d.ts +184 -0
- package/dist/types.backup/client.rsc.d.ts +39 -0
- package/dist/types.backup/cloudflare/index.d.ts +7 -0
- package/dist/types.backup/cloudflare/tracing.d.ts +53 -0
- package/dist/types.backup/component-utils.d.ts +46 -0
- package/dist/types.backup/components/DefaultDocument.d.ts +13 -0
- package/dist/types.backup/context-var.d.ts +84 -0
- package/dist/types.backup/debug.d.ts +57 -0
- package/dist/types.backup/decode-loader-results.d.ts +5 -0
- package/dist/types.backup/default-error-boundary.d.ts +10 -0
- package/dist/types.backup/defer.d.ts +89 -0
- package/dist/types.backup/deps/browser.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-client.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-server.d.ts +1 -0
- package/dist/types.backup/deps/rsc.d.ts +1 -0
- package/dist/types.backup/deps/ssr.d.ts +1 -0
- package/dist/types.backup/encode-kv.d.ts +35 -0
- package/dist/types.backup/errors.d.ts +226 -0
- package/dist/types.backup/escape-script.d.ts +44 -0
- package/dist/types.backup/handle.d.ts +93 -0
- package/dist/types.backup/handles/MetaTags.d.ts +17 -0
- package/dist/types.backup/handles/Scripts.d.ts +38 -0
- package/dist/types.backup/handles/breadcrumbs.d.ts +43 -0
- package/dist/types.backup/handles/deferred-resolution.d.ts +53 -0
- package/dist/types.backup/handles/is-thenable.d.ts +12 -0
- package/dist/types.backup/handles/meta.d.ts +43 -0
- package/dist/types.backup/handles/script.d.ts +139 -0
- package/dist/types.backup/host/cookie-handler.d.ts +8 -0
- package/dist/types.backup/host/errors.d.ts +40 -0
- package/dist/types.backup/host/index.d.ts +33 -0
- package/dist/types.backup/host/pattern-matcher.d.ts +30 -0
- package/dist/types.backup/host/router.d.ts +12 -0
- package/dist/types.backup/host/testing.d.ts +41 -0
- package/dist/types.backup/host/types.d.ts +148 -0
- package/dist/types.backup/host/utils.d.ts +20 -0
- package/dist/types.backup/href-client.d.ts +214 -0
- package/dist/types.backup/index.d.ts +112 -0
- package/dist/types.backup/index.rsc.d.ts +51 -0
- package/dist/types.backup/internal-debug.d.ts +1 -0
- package/dist/types.backup/loader-store.d.ts +193 -0
- package/dist/types.backup/loader.d.ts +18 -0
- package/dist/types.backup/loader.rsc.d.ts +18 -0
- package/dist/types.backup/missing-id-error.d.ts +1 -0
- package/dist/types.backup/outlet-context.d.ts +12 -0
- package/dist/types.backup/outlet-provider.d.ts +12 -0
- package/dist/types.backup/prerender/build-shell-capture.d.ts +104 -0
- package/dist/types.backup/prerender/param-hash.d.ts +6 -0
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +18 -0
- package/dist/types.backup/prerender/store.d.ts +62 -0
- package/dist/types.backup/prerender.d.ts +292 -0
- package/dist/types.backup/redirect-origin.d.ts +55 -0
- package/dist/types.backup/regex-escape.d.ts +6 -0
- package/dist/types.backup/render-error-thrower.d.ts +13 -0
- package/dist/types.backup/response-utils.d.ts +35 -0
- package/dist/types.backup/reverse.d.ts +206 -0
- package/dist/types.backup/root-error-boundary.d.ts +32 -0
- package/dist/types.backup/route-content-wrapper.d.ts +40 -0
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +130 -0
- package/dist/types.backup/route-definition/helper-factories.d.ts +22 -0
- package/dist/types.backup/route-definition/helpers-types.d.ts +392 -0
- package/dist/types.backup/route-definition/index.d.ts +7 -0
- package/dist/types.backup/route-definition/redirect.d.ts +48 -0
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +19 -0
- package/dist/types.backup/route-definition/use-item-types.d.ts +1 -0
- package/dist/types.backup/route-definition.d.ts +1 -0
- package/dist/types.backup/route-map-builder.d.ts +127 -0
- package/dist/types.backup/route-name.d.ts +27 -0
- package/dist/types.backup/route-types.d.ts +172 -0
- package/dist/types.backup/router/basename.d.ts +10 -0
- package/dist/types.backup/router/content-negotiation.d.ts +91 -0
- package/dist/types.backup/router/debug-manifest.d.ts +7 -0
- package/dist/types.backup/router/error-handling.d.ts +76 -0
- package/dist/types.backup/router/find-match.d.ts +19 -0
- package/dist/types.backup/router/handler-context.d.ts +41 -0
- package/dist/types.backup/router/instrument.d.ts +161 -0
- package/dist/types.backup/router/intercept-resolution.d.ts +79 -0
- package/dist/types.backup/router/lazy-includes.d.ts +26 -0
- package/dist/types.backup/router/loader-resolution.d.ts +63 -0
- package/dist/types.backup/router/logging.d.ts +41 -0
- package/dist/types.backup/router/manifest.d.ts +8 -0
- package/dist/types.backup/router/match-api.d.ts +19 -0
- package/dist/types.backup/router/match-context.d.ts +184 -0
- package/dist/types.backup/router/match-handlers.d.ts +49 -0
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +112 -0
- package/dist/types.backup/router/match-middleware/index.d.ts +80 -0
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +116 -0
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +94 -0
- package/dist/types.backup/router/match-pipelines.d.ts +103 -0
- package/dist/types.backup/router/match-result.d.ts +114 -0
- package/dist/types.backup/router/metrics.d.ts +6 -0
- package/dist/types.backup/router/middleware-types.d.ts +74 -0
- package/dist/types.backup/router/middleware.d.ts +116 -0
- package/dist/types.backup/router/navigation-snapshot.d.ts +22 -0
- package/dist/types.backup/router/params-util.d.ts +8 -0
- package/dist/types.backup/router/parse-pattern.d.ts +38 -0
- package/dist/types.backup/router/pattern-matching.d.ts +169 -0
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +27 -0
- package/dist/types.backup/router/prefetch-limits.d.ts +20 -0
- package/dist/types.backup/router/prerender-match.d.ts +50 -0
- package/dist/types.backup/router/preview-match.d.ts +22 -0
- package/dist/types.backup/router/request-classification.d.ts +104 -0
- package/dist/types.backup/router/revalidation.d.ts +57 -0
- package/dist/types.backup/router/route-snapshot.d.ts +112 -0
- package/dist/types.backup/router/router-context.d.ts +137 -0
- package/dist/types.backup/router/router-interfaces.d.ts +432 -0
- package/dist/types.backup/router/router-options.d.ts +738 -0
- package/dist/types.backup/router/router-registry.d.ts +15 -0
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +55 -0
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +93 -0
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +33 -0
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +44 -0
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +90 -0
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +53 -0
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +85 -0
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +17 -0
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +28 -0
- package/dist/types.backup/router/segment-resolution.d.ts +3 -0
- package/dist/types.backup/router/segment-wrappers.d.ts +53 -0
- package/dist/types.backup/router/state-cookie-name.d.ts +1 -0
- package/dist/types.backup/router/substitute-pattern-params.d.ts +23 -0
- package/dist/types.backup/router/telemetry-otel.d.ts +113 -0
- package/dist/types.backup/router/telemetry.d.ts +215 -0
- package/dist/types.backup/router/timeout.d.ts +68 -0
- package/dist/types.backup/router/tracing.d.ts +125 -0
- package/dist/types.backup/router/trie-matching.d.ts +32 -0
- package/dist/types.backup/router/types.d.ts +98 -0
- package/dist/types.backup/router/url-params.d.ts +26 -0
- package/dist/types.backup/router.d.ts +7 -0
- package/dist/types.backup/rsc/capture-queue.d.ts +6 -0
- package/dist/types.backup/rsc/full-payload.d.ts +22 -0
- package/dist/types.backup/rsc/handler-context.d.ts +31 -0
- package/dist/types.backup/rsc/handler.d.ts +9 -0
- package/dist/types.backup/rsc/helpers.d.ts +213 -0
- package/dist/types.backup/rsc/index.d.ts +17 -0
- package/dist/types.backup/rsc/json-route-result.d.ts +20 -0
- package/dist/types.backup/rsc/loader-fetch.d.ts +14 -0
- package/dist/types.backup/rsc/manifest-init.d.ts +18 -0
- package/dist/types.backup/rsc/nonce.d.ts +28 -0
- package/dist/types.backup/rsc/origin-guard.d.ts +50 -0
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +19 -0
- package/dist/types.backup/rsc/redirect-guard.d.ts +35 -0
- package/dist/types.backup/rsc/response-cache-serve.d.ts +46 -0
- package/dist/types.backup/rsc/response-error.d.ts +19 -0
- package/dist/types.backup/rsc/response-route-handler.d.ts +29 -0
- package/dist/types.backup/rsc/rsc-rendering.d.ts +23 -0
- package/dist/types.backup/rsc/runtime-warnings.d.ts +22 -0
- package/dist/types.backup/rsc/server-action.d.ts +68 -0
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +84 -0
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +27 -0
- package/dist/types.backup/rsc/shell-capture.d.ts +374 -0
- package/dist/types.backup/rsc/shell-serve.d.ts +136 -0
- package/dist/types.backup/rsc/ssr-setup.d.ts +48 -0
- package/dist/types.backup/rsc/transition-gate.d.ts +27 -0
- package/dist/types.backup/rsc/types.d.ts +290 -0
- package/dist/types.backup/runtime-env.d.ts +1 -0
- package/dist/types.backup/search-params.d.ts +125 -0
- package/dist/types.backup/segment-content-promise.d.ts +13 -0
- package/dist/types.backup/segment-fragments.d.ts +56 -0
- package/dist/types.backup/segment-loader-promise.d.ts +22 -0
- package/dist/types.backup/segment-system.d.ts +84 -0
- package/dist/types.backup/serialize.d.ts +164 -0
- package/dist/types.backup/server/context.d.ts +494 -0
- package/dist/types.backup/server/cookie-parse.d.ts +10 -0
- package/dist/types.backup/server/cookie-store.d.ts +107 -0
- package/dist/types.backup/server/fetchable-loader-store.d.ts +20 -0
- package/dist/types.backup/server/handle-store.d.ts +100 -0
- package/dist/types.backup/server/loader-registry.d.ts +32 -0
- package/dist/types.backup/server/request-context.d.ts +596 -0
- package/dist/types.backup/server/root-layout.d.ts +3 -0
- package/dist/types.backup/server.d.ts +15 -0
- package/dist/types.backup/ssr/index.d.ts +233 -0
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +3 -0
- package/dist/types.backup/ssr/preinit-client-references.d.ts +71 -0
- package/dist/types.backup/ssr/ssr-root.d.ts +69 -0
- package/dist/types.backup/static-handler.d.ts +57 -0
- package/dist/types.backup/testing/cache-status.d.ts +63 -0
- package/dist/types.backup/testing/collect-handle.d.ts +20 -0
- package/dist/types.backup/testing/dispatch.d.ts +123 -0
- package/dist/types.backup/testing/dom.entry.d.ts +15 -0
- package/dist/types.backup/testing/e2e/fixture.d.ts +37 -0
- package/dist/types.backup/testing/e2e/index.d.ts +30 -0
- package/dist/types.backup/testing/e2e/matchers.d.ts +17 -0
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +62 -0
- package/dist/types.backup/testing/e2e/parity.d.ts +111 -0
- package/dist/types.backup/testing/e2e/server.d.ts +35 -0
- package/dist/types.backup/testing/flight-matchers.d.ts +55 -0
- package/dist/types.backup/testing/flight-normalize.d.ts +1 -0
- package/dist/types.backup/testing/flight-tree.d.ts +192 -0
- package/dist/types.backup/testing/flight.d.ts +115 -0
- package/dist/types.backup/testing/flight.entry.d.ts +27 -0
- package/dist/types.backup/testing/generated-routes.d.ts +66 -0
- package/dist/types.backup/testing/index.d.ts +52 -0
- package/dist/types.backup/testing/internal/context.d.ts +225 -0
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +1 -0
- package/dist/types.backup/testing/internal/seed-vars.d.ts +30 -0
- package/dist/types.backup/testing/render-handler.d.ts +160 -0
- package/dist/types.backup/testing/render-route.d.ts +246 -0
- package/dist/types.backup/testing/run-loader.d.ts +186 -0
- package/dist/types.backup/testing/run-middleware.d.ts +132 -0
- package/dist/types.backup/testing/run-transition-when.d.ts +77 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +1 -0
- package/dist/types.backup/testing/vitest.d.ts +205 -0
- package/dist/types.backup/theme/ThemeProvider.d.ts +13 -0
- package/dist/types.backup/theme/ThemeScript.d.ts +45 -0
- package/dist/types.backup/theme/constants.d.ts +39 -0
- package/dist/types.backup/theme/index.d.ts +29 -0
- package/dist/types.backup/theme/theme-context.d.ts +21 -0
- package/dist/types.backup/theme/theme-script.d.ts +26 -0
- package/dist/types.backup/theme/types.d.ts +162 -0
- package/dist/types.backup/theme/use-theme.d.ts +8 -0
- package/dist/types.backup/types/boundaries.d.ts +93 -0
- package/dist/types.backup/types/cache-types.d.ts +191 -0
- package/dist/types.backup/types/error-types.d.ts +114 -0
- package/dist/types.backup/types/global-namespace.d.ts +90 -0
- package/dist/types.backup/types/handler-context.d.ts +658 -0
- package/dist/types.backup/types/index.d.ts +11 -0
- package/dist/types.backup/types/loader-types.d.ts +182 -0
- package/dist/types.backup/types/request-scope.d.ts +93 -0
- package/dist/types.backup/types/route-config.d.ts +105 -0
- package/dist/types.backup/types/route-entry.d.ts +95 -0
- package/dist/types.backup/types/segments.d.ts +234 -0
- package/dist/types.backup/types.d.ts +1 -0
- package/dist/types.backup/urls/include-helper.d.ts +17 -0
- package/dist/types.backup/urls/include-provider.d.ts +27 -0
- package/dist/types.backup/urls/index.d.ts +6 -0
- package/dist/types.backup/urls/path-helper-types.d.ts +197 -0
- package/dist/types.backup/urls/path-helper.d.ts +12 -0
- package/dist/types.backup/urls/pattern-types.d.ts +166 -0
- package/dist/types.backup/urls/response-types.d.ts +67 -0
- package/dist/types.backup/urls/type-extraction.d.ts +157 -0
- package/dist/types.backup/urls/urls-function.d.ts +24 -0
- package/dist/types.backup/urls.d.ts +1 -0
- package/dist/types.backup/use-loader.d.ts +150 -0
- package/dist/types.backup/vercel/index.d.ts +10 -0
- package/dist/types.backup/vercel/tracing.d.ts +70 -0
- package/dist/types.backup/vite/debug.d.ts +80 -0
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +12 -0
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +65 -0
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +17 -0
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +113 -0
- package/dist/types.backup/vite/discovery/gate-state.d.ts +79 -0
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +24 -0
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +32 -0
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +22 -0
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +40 -0
- package/dist/types.backup/vite/discovery/state.d.ts +162 -0
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +15 -0
- package/dist/types.backup/vite/index.d.ts +11 -0
- package/dist/types.backup/vite/inject-client-debug.d.ts +56 -0
- package/dist/types.backup/vite/plugin-types.d.ts +298 -0
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +6 -0
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +40 -0
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +35 -0
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +18 -0
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +37 -0
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +13 -0
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +29 -0
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +6 -0
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +25 -0
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +20 -0
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +20 -0
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +85 -0
- package/dist/types.backup/vite/plugins/version-injector.d.ts +21 -0
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +19 -0
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +36 -0
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +7 -0
- package/dist/types.backup/vite/rango.d.ts +29 -0
- package/dist/types.backup/vite/router-discovery.d.ts +23 -0
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +64 -0
- package/dist/types.backup/vite/utils/banner.d.ts +2 -0
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +28 -0
- package/dist/types.backup/vite/utils/client-chunks.d.ts +55 -0
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +16 -0
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +37 -0
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +7 -0
- package/dist/types.backup/vite/utils/package-resolution.d.ts +6 -0
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +32 -0
- package/dist/types.backup/vite/utils/shared-utils.d.ts +55 -0
- package/dist/vite/index.js +9695 -3592
- package/package.json +119 -39
- package/skills/api-client/SKILL.md +211 -0
- package/skills/breadcrumbs/SKILL.md +82 -5
- package/skills/bundle-analysis/SKILL.md +159 -0
- package/skills/cache-guide/SKILL.md +232 -34
- package/skills/caching/SKILL.md +375 -19
- package/skills/catalog.json +283 -0
- package/skills/cloudflare/SKILL.md +151 -0
- package/skills/cloudflare/agents/openai.yaml +4 -0
- package/skills/cloudflare/references/d1-and-local-dev.md +131 -0
- package/skills/cloudflare/references/streaming-and-deploy.md +107 -0
- package/skills/cloudflare/references/webhooks-and-crypto.md +147 -0
- package/skills/comparison/SKILL.md +50 -0
- package/skills/comparison/agents/openai.yaml +4 -0
- package/skills/comparison/references/framework-comparison.md +844 -0
- package/skills/composability/SKILL.md +124 -4
- package/skills/css/SKILL.md +76 -0
- package/skills/debug-manifest/SKILL.md +5 -11
- package/skills/defer-hydration/SKILL.md +235 -0
- package/skills/deployment-caching/SKILL.md +176 -0
- package/skills/document-cache/SKILL.md +116 -58
- package/skills/fonts/SKILL.md +1 -1
- package/skills/handler-use/SKILL.md +12 -10
- package/skills/hooks/SKILL.md +73 -699
- package/skills/hooks/data.md +273 -0
- package/skills/hooks/handle-and-actions.md +103 -0
- package/skills/hooks/navigation.md +110 -0
- package/skills/hooks/outlets.md +62 -0
- package/skills/hooks/state.md +228 -0
- package/skills/hooks/urls.md +135 -0
- package/skills/host-router/SKILL.md +129 -27
- package/skills/i18n/SKILL.md +276 -0
- package/skills/intercept/SKILL.md +75 -19
- package/skills/layout/SKILL.md +40 -19
- package/skills/links/SKILL.md +211 -17
- package/skills/loader/SKILL.md +230 -25
- package/skills/middleware/SKILL.md +58 -13
- package/skills/migrate-nextjs/SKILL.md +267 -33
- package/skills/migrate-nextjs/backend-host-swap.md +120 -0
- package/skills/migrate-react-router/SKILL.md +59 -671
- package/skills/migrate-react-router/component-migration.md +196 -0
- package/skills/migrate-react-router/data-and-actions.md +225 -0
- package/skills/migrate-react-router/route-mapping.md +271 -0
- package/skills/mime-routes/SKILL.md +55 -18
- package/skills/observability/SKILL.md +231 -0
- package/skills/parallel/SKILL.md +50 -10
- package/skills/ppr/SKILL.md +904 -0
- package/skills/prerender/SKILL.md +130 -68
- package/skills/rango/SKILL.md +321 -26
- package/skills/react-compiler/SKILL.md +168 -0
- package/skills/response-routes/SKILL.md +172 -52
- package/skills/route/SKILL.md +123 -9
- package/skills/router-setup/SKILL.md +53 -9
- package/skills/scripts/SKILL.md +179 -0
- package/skills/server-actions/SKILL.md +776 -0
- package/skills/shell-manifest/SKILL.md +185 -0
- package/skills/streams-and-websockets/SKILL.md +1 -1
- package/skills/tailwind/SKILL.md +28 -4
- package/skills/testing/SKILL.md +131 -0
- package/skills/testing/bindings.md +103 -0
- package/skills/testing/cache-prerender.md +172 -0
- package/skills/testing/client-components.md +131 -0
- package/skills/testing/e2e-parity.md +125 -0
- package/skills/testing/flight.md +91 -0
- package/skills/testing/handles.md +131 -0
- package/skills/testing/loader.md +128 -0
- package/skills/testing/middleware.md +99 -0
- package/skills/testing/render-handler.md +122 -0
- package/skills/testing/response-routes.md +95 -0
- package/skills/testing/reverse-and-types.md +85 -0
- package/skills/testing/server-actions.md +107 -0
- package/skills/testing/server-tree.md +128 -0
- package/skills/testing/setup.md +123 -0
- package/skills/theme/SKILL.md +1 -1
- package/skills/typesafety/SKILL.md +45 -628
- package/skills/typesafety/env-and-bindings.md +254 -0
- package/skills/typesafety/generated-files-and-cli.md +342 -0
- package/skills/typesafety/params-and-search.md +153 -0
- package/skills/typesafety/route-types.md +213 -0
- package/skills/use-cache/SKILL.md +121 -15
- package/skills/vercel/SKILL.md +149 -0
- package/skills/view-transitions/SKILL.md +341 -0
- package/src/__augment-tests__/augment.ts +81 -0
- package/src/__augment-tests__/augmented.check.ts +116 -0
- package/src/__internal.ts +0 -65
- package/src/browser/action-coordinator.ts +53 -36
- package/src/browser/action-fence.ts +47 -0
- package/src/browser/app-shell.ts +14 -27
- package/src/browser/connection-warmup.ts +134 -0
- package/src/browser/cookie-name.ts +140 -0
- package/src/browser/dev-discovery.ts +66 -0
- package/src/browser/event-controller.ts +400 -168
- package/src/browser/history-state.ts +21 -0
- package/src/browser/index.ts +3 -3
- package/src/browser/invalidate-client-cache.ts +52 -0
- package/src/browser/link-interceptor.ts +469 -20
- package/src/browser/logging.ts +28 -0
- package/src/browser/merge-segment-loaders.ts +6 -4
- package/src/browser/navigation-bridge.ts +164 -69
- package/src/browser/navigation-client.ts +199 -96
- package/src/browser/navigation-store-handle.ts +38 -0
- package/src/browser/navigation-store.ts +165 -345
- package/src/browser/navigation-transaction.ts +9 -59
- package/src/browser/network-error-handler.ts +34 -7
- package/src/browser/notify-listeners.ts +22 -0
- package/src/browser/partial-update.ts +219 -163
- package/src/browser/prefetch/cache.ts +240 -97
- package/src/browser/prefetch/default-strategy.ts +74 -0
- package/src/browser/prefetch/fetch.ts +317 -51
- package/src/browser/prefetch/invalidation.ts +30 -0
- package/src/browser/prefetch/loader.ts +111 -0
- package/src/browser/prefetch/observer.ts +50 -22
- package/src/browser/prefetch/queue.ts +25 -7
- package/src/browser/prefetch/runtime.ts +6 -0
- package/src/browser/rango-state.ts +177 -114
- package/src/browser/react/Link.tsx +115 -75
- package/src/browser/react/NavigationProvider.tsx +194 -143
- package/src/browser/react/ScrollRestoration.tsx +10 -6
- package/src/browser/react/context.ts +4 -0
- package/src/browser/react/filter-segment-order.ts +66 -7
- package/src/browser/react/index.ts +0 -48
- package/src/browser/react/location-state-shared.ts +178 -8
- package/src/browser/react/location-state.ts +39 -14
- package/src/browser/react/use-action.ts +6 -15
- package/src/browser/react/use-handle.ts +17 -14
- package/src/browser/react/use-href.tsx +8 -1
- package/src/browser/react/use-link-status.ts +33 -8
- package/src/browser/react/use-navigation.ts +10 -5
- package/src/browser/react/use-params.ts +11 -11
- package/src/browser/react/use-reverse.ts +106 -0
- package/src/browser/react/use-router.ts +21 -6
- package/src/browser/react/use-search-params.ts +0 -5
- package/src/browser/react/use-segments.ts +11 -21
- package/src/browser/response-adapter.ts +99 -8
- package/src/browser/rsc-router.tsx +230 -42
- package/src/browser/scroll-restoration.ts +37 -22
- package/src/browser/segment-reconciler.ts +31 -21
- package/src/browser/segment-structure-assert.ts +2 -2
- package/src/browser/server-action-bridge.ts +262 -65
- package/src/browser/types.ts +132 -47
- package/src/browser/validate-redirect-origin.ts +43 -16
- package/src/build/collect-fallback-refs.ts +107 -0
- package/src/build/generate-manifest.ts +213 -184
- package/src/build/generate-route-types.ts +3 -1
- package/src/build/index.ts +11 -3
- package/src/build/merge-full-manifests.ts +161 -0
- package/src/build/prefix-tree-utils.ts +123 -0
- package/src/build/route-trie.ts +43 -280
- package/src/build/route-types/ast-route-extraction.ts +15 -8
- package/src/build/route-types/codegen.ts +16 -5
- package/src/build/route-types/include-resolution.ts +513 -64
- package/src/build/route-types/param-extraction.ts +6 -3
- package/src/build/route-types/per-module-writer.ts +33 -12
- package/src/build/route-types/router-processing.ts +312 -204
- package/src/build/route-types/scan-filter.ts +1 -1
- package/src/build/route-types/source-scan.ts +216 -0
- package/src/build/runtime-discovery.ts +32 -29
- package/src/cache/cache-error.ts +104 -0
- package/src/cache/cache-exec-scope.ts +47 -0
- package/src/cache/cache-key-utils.ts +73 -15
- package/src/cache/cache-policy.ts +108 -34
- package/src/cache/cache-runtime.ts +566 -121
- package/src/cache/cache-scope.ts +383 -105
- package/src/cache/cache-tag.ts +149 -0
- package/src/cache/cf/cf-base64.ts +33 -0
- package/src/cache/cf/cf-cache-constants.ts +134 -0
- package/src/cache/cf/cf-cache-store.ts +3028 -391
- package/src/cache/cf/cf-cache-types.ts +417 -0
- package/src/cache/cf/cf-kv-utils.ts +84 -0
- package/src/cache/cf/cf-tag-marker-memo.ts +108 -0
- package/src/cache/cf/cf-zone-purge.ts +101 -0
- package/src/cache/cf/index.ts +11 -16
- package/src/cache/document-cache.ts +184 -53
- package/src/cache/handle-snapshot.ts +92 -1
- package/src/cache/index.ts +32 -20
- package/src/cache/memory-segment-store.ts +286 -37
- package/src/cache/profile-registry.ts +46 -31
- package/src/cache/read-through-swr.ts +66 -16
- package/src/cache/search-params-filter.ts +118 -0
- package/src/cache/segment-codec.ts +80 -25
- package/src/cache/shell-snapshot.ts +516 -0
- package/src/cache/tag-invalidation.ts +230 -0
- package/src/cache/taint.ts +28 -9
- package/src/cache/types.ts +323 -100
- package/src/cache/vercel/index.ts +11 -0
- package/src/cache/vercel/vercel-cache-store.ts +1264 -0
- package/src/client-urls/client-root.tsx +161 -0
- package/src/client-urls/client-urls.ts +665 -0
- package/src/client-urls/navigation.ts +237 -0
- package/src/client-urls/revalidation-protocol.ts +56 -0
- package/src/client-urls/server-projection.ts +563 -0
- package/src/client-urls/types.ts +178 -0
- package/src/client.rsc.tsx +48 -21
- package/src/client.tsx +77 -67
- package/src/cloudflare/index.ts +11 -0
- package/src/cloudflare/tracing.ts +112 -0
- package/src/component-utils.ts +19 -0
- package/src/components/DefaultDocument.tsx +8 -2
- package/src/context-var.ts +18 -6
- package/src/decode-loader-results.ts +160 -0
- package/src/defer.ts +185 -0
- package/src/deps/ssr.ts +4 -2
- package/src/dev-discovery-protocol.ts +11 -0
- package/src/encode-kv.ts +49 -0
- package/src/errors.ts +44 -4
- package/src/escape-script.ts +52 -0
- package/src/handle.ts +67 -37
- package/src/handles/MetaTags.tsx +24 -53
- package/src/handles/Scripts.tsx +183 -0
- package/src/handles/breadcrumbs.ts +35 -8
- package/src/handles/deferred-resolution.ts +134 -0
- package/src/handles/is-thenable.ts +16 -0
- package/src/handles/meta.ts +14 -40
- package/src/handles/script.ts +244 -0
- package/src/host/cookie-handler.ts +9 -60
- package/src/host/errors.ts +13 -22
- package/src/host/index.ts +9 -2
- package/src/host/pattern-matcher.ts +23 -52
- package/src/host/router.ts +107 -99
- package/src/host/testing.ts +40 -27
- package/src/host/types.ts +37 -4
- package/src/host/utils.ts +1 -1
- package/src/href-client.ts +137 -22
- package/src/index.rsc.ts +105 -12
- package/src/index.ts +102 -14
- package/src/internal-debug.ts +11 -10
- package/src/loader-redirect.tsx +47 -0
- package/src/loader-store.ts +500 -0
- package/src/loader.rsc.ts +20 -13
- package/src/loader.ts +12 -11
- package/src/missing-id-error.ts +68 -0
- package/src/outlet-context.ts +12 -0
- package/src/outlet-provider.tsx +16 -6
- package/src/prerender/build-shell-capture.ts +453 -0
- package/src/prerender/param-hash.ts +16 -16
- package/src/prerender/shell-manifest-key.ts +20 -0
- package/src/prerender/store.ts +47 -38
- package/src/prerender.ts +81 -13
- package/src/redirect-origin.ts +143 -0
- package/src/regex-escape.ts +8 -0
- package/src/render-error-thrower.tsx +20 -0
- package/src/response-utils.ts +34 -0
- package/src/reverse.ts +65 -40
- package/src/root-error-boundary.tsx +1 -19
- package/src/route-content-wrapper.tsx +112 -78
- package/src/route-definition/dsl-helpers.ts +300 -313
- package/src/route-definition/helper-factories.ts +28 -140
- package/src/route-definition/helpers-types.ts +92 -62
- package/src/route-definition/index.ts +1 -2
- package/src/route-definition/redirect.ts +44 -11
- package/src/route-definition/resolve-handler-use.ts +6 -1
- package/src/route-definition/use-item-types.ts +29 -0
- package/src/route-map-builder.ts +102 -74
- package/src/route-types.ts +19 -46
- package/src/router/basename.ts +14 -0
- package/src/router/content-negotiation.ts +120 -30
- package/src/router/error-handling.ts +110 -29
- package/src/router/find-match.ts +129 -30
- package/src/router/handler-context.ts +41 -57
- package/src/router/instrument.ts +401 -0
- package/src/router/intercept-resolution.ts +98 -21
- package/src/router/lazy-includes.ts +82 -58
- package/src/router/loader-resolution.ts +401 -85
- package/src/router/logging.ts +0 -6
- package/src/router/manifest.ts +74 -40
- package/src/router/match-api.ts +91 -55
- package/src/router/match-context.ts +0 -22
- package/src/router/match-handlers.ts +268 -171
- package/src/router/match-middleware/background-revalidation.ts +40 -24
- package/src/router/match-middleware/cache-lookup.ts +316 -302
- package/src/router/match-middleware/cache-store.ts +134 -52
- package/src/router/match-middleware/intercept-resolution.ts +0 -22
- package/src/router/match-middleware/segment-resolution.ts +0 -22
- package/src/router/match-pipelines.ts +1 -42
- package/src/router/match-result.ts +76 -79
- package/src/router/metrics.ts +17 -36
- package/src/router/middleware-types.ts +20 -110
- package/src/router/middleware.ts +275 -173
- package/src/router/navigation-snapshot.ts +51 -60
- package/src/router/params-util.ts +23 -0
- package/src/router/parse-pattern.ts +115 -0
- package/src/router/pattern-matching.ts +134 -154
- package/src/router/prefetch-cache-ttl.ts +51 -0
- package/src/router/prefetch-default.ts +59 -0
- package/src/router/prefetch-limits.ts +37 -0
- package/src/router/prerender-match.ts +159 -69
- package/src/router/preview-match.ts +6 -2
- package/src/router/request-classification.ts +50 -69
- package/src/router/revalidation.ts +146 -83
- package/src/router/route-snapshot.ts +14 -3
- package/src/router/route-trie-builder.ts +334 -0
- package/src/router/router-context.ts +6 -29
- package/src/router/router-interfaces.ts +168 -38
- package/src/router/router-options.ts +235 -11
- package/src/router/router-registry.ts +2 -5
- package/src/router/segment-resolution/fresh.ts +163 -88
- package/src/router/segment-resolution/helpers.ts +96 -18
- package/src/router/segment-resolution/loader-cache.ts +187 -39
- package/src/router/segment-resolution/loader-mask.ts +60 -0
- package/src/router/segment-resolution/loader-snapshot.ts +259 -0
- package/src/router/segment-resolution/mask-nested.ts +99 -0
- package/src/router/segment-resolution/revalidation.ts +316 -321
- package/src/router/segment-resolution/static-store.ts +55 -15
- package/src/router/segment-resolution/streamed-handler-telemetry.ts +52 -0
- package/src/router/segment-resolution/view-transition-default.ts +60 -0
- package/src/router/segment-resolution.ts +5 -1
- package/src/router/segment-wrappers.ts +6 -5
- package/src/router/state-cookie-name.ts +33 -0
- package/src/router/substitute-pattern-params.ts +75 -0
- package/src/router/telemetry-otel.ts +171 -200
- package/src/router/telemetry.ts +106 -20
- package/src/router/timeout.ts +53 -22
- package/src/router/tracing.ts +235 -0
- package/src/router/transition-when.ts +76 -0
- package/src/router/trie-matching.ts +170 -64
- package/src/router/types.ts +9 -63
- package/src/router/url-params.ts +13 -5
- package/src/router.ts +248 -77
- package/src/rsc/capture-queue.ts +218 -0
- package/src/rsc/full-payload.ts +77 -0
- package/src/rsc/handler-context.ts +4 -2
- package/src/rsc/handler.ts +562 -284
- package/src/rsc/helpers.ts +179 -9
- package/src/rsc/index.ts +2 -5
- package/src/rsc/json-route-result.ts +38 -0
- package/src/rsc/loader-fetch.ts +116 -40
- package/src/rsc/manifest-init.ts +55 -56
- package/src/rsc/nonce.ts +10 -1
- package/src/rsc/origin-guard.ts +39 -25
- package/src/rsc/progressive-enhancement.ts +377 -84
- package/src/rsc/redirect-guard.ts +102 -0
- package/src/rsc/render-pipeline.ts +611 -0
- package/src/rsc/response-cache-serve.ts +259 -0
- package/src/rsc/response-error.ts +79 -12
- package/src/rsc/response-route-handler.ts +73 -212
- package/src/rsc/routine-plan.ts +359 -0
- package/src/rsc/rsc-rendering.ts +1624 -171
- package/src/rsc/runtime-warnings.ts +23 -10
- package/src/rsc/server-action.ts +420 -139
- package/src/rsc/shell-build-manifest.ts +336 -0
- package/src/rsc/shell-capture-constants.ts +45 -0
- package/src/rsc/shell-capture.ts +2063 -0
- package/src/rsc/shell-serve.ts +337 -0
- package/src/rsc/ssr-setup.ts +111 -16
- package/src/rsc/stream-idle.ts +137 -0
- package/src/rsc/transition-gate.ts +86 -0
- package/src/rsc/types.ts +91 -5
- package/src/runtime-env.ts +18 -0
- package/src/search-params.ts +35 -30
- package/src/segment-fragments.ts +165 -0
- package/src/segment-loader-promise.ts +49 -4
- package/src/segment-system.tsx +441 -153
- package/src/serialize.ts +243 -0
- package/src/server/context.ts +416 -55
- package/src/server/cookie-parse.ts +32 -0
- package/src/server/cookie-store.ts +162 -15
- package/src/server/handle-store.ts +190 -70
- package/src/server/loader-registry.ts +33 -42
- package/src/server/request-context.ts +805 -177
- package/src/server.ts +7 -2
- package/src/ssr/index.tsx +631 -183
- package/src/ssr/inject-rsc-eager.ts +167 -0
- package/src/ssr/preinit-client-references.ts +106 -0
- package/src/ssr/ssr-root.tsx +262 -0
- package/src/static-handler.ts +28 -15
- package/src/testing/cache-status.ts +162 -0
- package/src/testing/collect-handle.ts +46 -0
- package/src/testing/dispatch.ts +951 -0
- package/src/testing/dom.entry.ts +22 -0
- package/src/testing/e2e/fixture.ts +188 -0
- package/src/testing/e2e/index.ts +147 -0
- package/src/testing/e2e/matchers.ts +35 -0
- package/src/testing/e2e/page-helpers.ts +319 -0
- package/src/testing/e2e/parity.ts +400 -0
- package/src/testing/e2e/server.ts +195 -0
- package/src/testing/flight-matchers.ts +97 -0
- package/src/testing/flight-normalize.ts +11 -0
- package/src/testing/flight-runtime.d.ts +57 -0
- package/src/testing/flight-tree.ts +682 -0
- package/src/testing/flight.entry.ts +52 -0
- package/src/testing/flight.ts +257 -0
- package/src/testing/generated-routes.ts +199 -0
- package/src/testing/index.ts +121 -0
- package/src/testing/internal/context.ts +380 -0
- package/src/testing/internal/flight-client-globals.ts +30 -0
- package/src/testing/internal/seed-vars.ts +54 -0
- package/src/testing/render-handler.ts +371 -0
- package/src/testing/render-route.tsx +667 -0
- package/src/testing/run-loader.ts +423 -0
- package/src/testing/run-middleware.ts +219 -0
- package/src/testing/run-transition-when.ts +197 -0
- package/src/testing/shell-status.ts +206 -0
- package/src/testing/vitest-stubs/cloudflare-email.ts +9 -0
- package/src/testing/vitest-stubs/cloudflare-workers.ts +21 -0
- package/src/testing/vitest-stubs/plugin-rsc.ts +16 -0
- package/src/testing/vitest-stubs/version.ts +5 -0
- package/src/testing/vitest.ts +305 -0
- package/src/theme/ThemeProvider.tsx +56 -84
- package/src/theme/ThemeScript.tsx +7 -9
- package/src/theme/constants.ts +52 -13
- package/src/theme/index.ts +0 -7
- package/src/theme/theme-context.ts +1 -5
- package/src/theme/theme-script.ts +22 -21
- package/src/theme/use-theme.ts +0 -3
- package/src/types/boundaries.ts +15 -35
- package/src/types/cache-types.ts +13 -4
- package/src/types/error-types.ts +30 -90
- package/src/types/global-namespace.ts +54 -41
- package/src/types/handler-context.ts +121 -30
- package/src/types/index.ts +3 -10
- package/src/types/loader-types.ts +38 -7
- package/src/types/request-scope.ts +8 -22
- package/src/types/route-config.ts +20 -52
- package/src/types/route-entry.ts +3 -6
- package/src/types/segments.ts +147 -14
- package/src/urls/include-helper.ts +38 -64
- package/src/urls/include-provider.ts +71 -0
- package/src/urls/index.ts +2 -11
- package/src/urls/path-helper-types.ts +76 -24
- package/src/urls/path-helper.ts +30 -110
- package/src/urls/pattern-types.ts +101 -19
- package/src/urls/response-types.ts +20 -19
- package/src/urls/type-extraction.ts +98 -154
- package/src/urls/urls-function.ts +1 -19
- package/src/use-loader.tsx +355 -109
- package/src/vercel/index.ts +11 -0
- package/src/vercel/tracing.ts +89 -0
- package/src/vite/debug.ts +102 -3
- package/src/vite/discovery/bundle-postprocess.ts +18 -14
- package/src/vite/discovery/client-urls-projection.ts +322 -0
- package/src/vite/discovery/dev-prerender-cache.ts +117 -0
- package/src/vite/discovery/discover-routers.ts +178 -151
- package/src/vite/discovery/discovery-errors.ts +255 -0
- package/src/vite/discovery/gate-state.ts +171 -0
- package/src/vite/discovery/prerender-collection.ts +125 -70
- package/src/vite/discovery/route-types-writer.ts +40 -84
- package/src/vite/discovery/self-gen-tracking.ts +27 -1
- package/src/vite/discovery/shell-prerender-phase.ts +397 -0
- package/src/vite/discovery/state.ts +104 -6
- package/src/vite/discovery/virtual-module-codegen.ts +226 -87
- package/src/vite/encryption-key.ts +29 -0
- package/src/vite/index.ts +12 -0
- package/src/vite/inject-client-debug.ts +88 -0
- package/src/vite/plugin-types.ts +243 -10
- package/src/vite/plugins/cjs-to-esm.ts +16 -19
- package/src/vite/plugins/client-ref-dedup.ts +16 -11
- package/src/vite/plugins/client-ref-hashing.ts +28 -15
- package/src/vite/plugins/cloudflare-protocol-stub.ts +1 -21
- package/src/vite/plugins/expose-action-id.ts +50 -97
- package/src/vite/plugins/expose-id-utils.ts +88 -55
- package/src/vite/plugins/expose-ids/export-analysis.ts +101 -34
- package/src/vite/plugins/expose-ids/handler-transform.ts +11 -90
- package/src/vite/plugins/expose-ids/loader-transform.ts +14 -24
- package/src/vite/plugins/expose-ids/router-transform.ts +118 -29
- package/src/vite/plugins/expose-internal-ids.ts +551 -486
- package/src/vite/plugins/performance-tracks.ts +25 -22
- package/src/vite/plugins/refresh-cmd.ts +1 -1
- package/src/vite/plugins/server-ref-hashing.ts +74 -0
- package/src/vite/plugins/server-reference-pattern.ts +10 -0
- package/src/vite/plugins/use-cache-transform.ts +73 -83
- package/src/vite/plugins/vercel-output.ts +384 -0
- package/src/vite/plugins/version-injector.ts +39 -29
- package/src/vite/plugins/version-plugin.ts +45 -40
- package/src/vite/plugins/virtual-entries.ts +193 -30
- package/src/vite/rango.ts +240 -128
- package/src/vite/router-discovery.ts +1518 -174
- package/src/vite/utils/ast-handler-extract.ts +26 -35
- package/src/vite/utils/bundle-analysis.ts +10 -15
- package/src/vite/utils/client-chunks.ts +184 -0
- package/src/vite/utils/directive-prologue.ts +40 -0
- package/src/vite/utils/forward-user-plugins.ts +171 -0
- package/src/vite/utils/manifest-utils.ts +1 -59
- package/src/vite/utils/package-resolution.ts +2 -73
- package/src/vite/utils/prerender-utils.ts +96 -49
- package/src/vite/utils/shared-utils.ts +156 -43
- package/src/browser/action-response-classifier.ts +0 -99
- package/src/browser/react/use-client-cache.ts +0 -58
- package/src/browser/shallow.ts +0 -40
- package/src/handles/index.ts +0 -7
- package/src/network-error-thrower.tsx +0 -23
- package/src/router/middleware-cookies.ts +0 -55
package/README.md
CHANGED
|
@@ -1,78 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Rango
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A code-first, type-safe React Server Components router. Django-inspired:
|
|
4
|
+
routes are expressed in one visible tree, URLs are built from names, and
|
|
5
|
+
everything past the core is opt-in.
|
|
4
6
|
|
|
5
|
-
> **Experimental:** This package is under active development. APIs may change
|
|
7
|
+
> **Experimental:** This package is under active development. APIs may change
|
|
8
|
+
> between releases. Install with `@experimental` tag.
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
This page is a tour: it builds one small shop and meets the entire core API
|
|
11
|
+
along the way — about six primitives. Everything else is opt-in and linked at
|
|
12
|
+
the end. For the design rationale behind these APIs, read
|
|
13
|
+
[Why Rango](https://github.com/ivogt/vite-rsc/blob/main/packages/rangojs-router/docs/why-rango.md); this page shows how it feels, that page
|
|
14
|
+
argues why it's right.
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
- **Structural composability** — Attach routes, loaders, middleware, handles, caching, prerendering, and static generation without hiding the route tree
|
|
11
|
-
- **Composable URL patterns** — Django-style `urls()` DSL with `path`, `layout`, `include`
|
|
12
|
-
- **Data loaders** — `createLoader()` with automatic streaming and Suspense integration
|
|
13
|
-
- **Live data layer** — Pre-render or cache the UI shell while loaders stay live by default at request time
|
|
14
|
-
- **Layouts & nesting** — Nested layouts with `<Outlet />` and parallel routes
|
|
15
|
-
- **Segment-level caching** — `cache()` DSL with TTL/SWR and pluggable cache stores
|
|
16
|
-
- **Middleware** — Route-level middleware with cookie and header access
|
|
17
|
-
- **Pre-rendering** — `Prerender()` and `Static()` handlers for build-time rendering
|
|
18
|
-
- **Theme support** — Light/dark mode with FOUC prevention and system detection
|
|
19
|
-
- **Host routing** — Multi-app routing by domain/subdomain via `@rangojs/router/host`
|
|
20
|
-
- **Response routes** — `path.json()`, `path.text()`, `path.xml()` for API endpoints
|
|
21
|
-
- **Trailing slash control** — Per-route canonical URLs with `"never"`, `"always"`, or `"ignore"`
|
|
22
|
-
- **CLI codegen** — `rango generate` for route type generation
|
|
16
|
+
## Start a new app
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- [Execution model](./docs/internal/execution-model.md)
|
|
27
|
-
- [Semantic change checklist](./docs/internal/semantic-change-checklist.md)
|
|
28
|
-
- [Stability roadmap](./docs/internal/stability-roadmap.md)
|
|
29
|
-
|
|
30
|
-
## Installation
|
|
18
|
+
The recommended path is to scaffold a complete app with
|
|
19
|
+
[`create-rango`](https://github.com/rangojs/templates):
|
|
31
20
|
|
|
32
21
|
```bash
|
|
33
|
-
|
|
22
|
+
pnpm create rango my-app
|
|
34
23
|
```
|
|
35
24
|
|
|
36
|
-
|
|
25
|
+
Select a deployment target with `--template basic`, `--template cloudflare`, or
|
|
26
|
+
`--template vercel`. The templates include streaming RSC, typed routes, Server
|
|
27
|
+
Actions, Tailwind CSS, and production deployment configuration. For a plain
|
|
28
|
+
JavaScript Node app, add `--template basic --js`. With npm, run
|
|
29
|
+
`npm create rango@latest my-app`. The scaffolder currently requires Node.js 24
|
|
30
|
+
or newer.
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
npm install react @vitejs/plugin-rsc
|
|
40
|
-
```
|
|
32
|
+
## Install manually
|
|
41
33
|
|
|
42
|
-
|
|
34
|
+
If you are adding Rango to an existing Vite RSC project:
|
|
43
35
|
|
|
44
36
|
```bash
|
|
45
|
-
npm install @
|
|
37
|
+
npm install @rangojs/router@experimental react @vitejs/plugin-rsc
|
|
46
38
|
```
|
|
47
39
|
|
|
48
|
-
## Import Paths
|
|
49
|
-
|
|
50
|
-
Use these import paths consistently:
|
|
51
|
-
|
|
52
|
-
- `@rangojs/router` — server/RSC router APIs, route DSL, `createRouter`, `urls`, `redirect`, `Prerender`, `Static`, shared types
|
|
53
|
-
- `@rangojs/router/client` — hooks and components such as `Link`, `Outlet`, `href`, `useNavigation`, `useLoader`, `useAction`, `useLocationState`
|
|
54
|
-
- `@rangojs/router/cache` — public cache APIs such as `CFCacheStore`, `MemorySegmentCacheStore`, `createDocumentCacheMiddleware`
|
|
55
|
-
- `@rangojs/router/host`, `@rangojs/router/theme`, `@rangojs/router/vite` — specialized public subpaths
|
|
56
|
-
- `@rangojs/router/rsc`, `@rangojs/router/ssr` — advanced server-only integration subpaths for custom request/HTML pipelines
|
|
57
|
-
|
|
58
|
-
Use only subpaths that are explicitly exported from the package. Avoid deep imports such as `@rangojs/router/cache/cf`.
|
|
59
|
-
|
|
60
|
-
`@rangojs/router` is conditionally resolved. Server-only root APIs such as
|
|
61
|
-
`createRouter()`, `urls()`, `redirect()`, `Prerender()`, and `cookies()` rely on
|
|
62
|
-
the `react-server` export condition and are meant to run in router definitions,
|
|
63
|
-
handlers, and other RSC/server modules. Outside that environment the root entry
|
|
64
|
-
falls back to stub implementations that throw guidance errors.
|
|
65
|
-
|
|
66
|
-
If you hit a root-entrypoint stub error:
|
|
67
|
-
|
|
68
|
-
- hooks and components like `Link`, `Outlet`, `useLoader`, `useNavigation`, and `MetaTags` belong in `@rangojs/router/client`
|
|
69
|
-
- cache APIs like `CFCacheStore` and `createDocumentCacheMiddleware` belong in `@rangojs/router/cache`
|
|
70
|
-
- host-router APIs belong in `@rangojs/router/host`
|
|
71
|
-
|
|
72
|
-
## Quick Start
|
|
73
|
-
|
|
74
|
-
### Vite Config
|
|
75
|
-
|
|
76
40
|
```ts
|
|
77
41
|
// vite.config.ts
|
|
78
42
|
import react from "@vitejs/plugin-react";
|
|
@@ -84,903 +48,436 @@ export default defineConfig({
|
|
|
84
48
|
});
|
|
85
49
|
```
|
|
86
50
|
|
|
87
|
-
|
|
51
|
+
The `cloudflare` preset targets Cloudflare Workers (add
|
|
52
|
+
`@cloudflare/vite-plugin`); the `vercel` preset emits a ready-to-deploy
|
|
53
|
+
`.vercel/output` (Build Output API) from a plain `vite build` — see the
|
|
54
|
+
[`/vercel` skill](./skills/vercel/SKILL.md); omit `preset` for the default
|
|
55
|
+
Node setup.
|
|
88
56
|
|
|
89
|
-
|
|
90
|
-
`@rangojs/router`.
|
|
57
|
+
## Using the skills with your coding agent
|
|
91
58
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
59
|
+
This package ships agent skills in `node_modules/@rangojs/router/skills/` —
|
|
60
|
+
task-focused guides written for LLM coding agents. Start at
|
|
61
|
+
`skills/rango/SKILL.md` (the mental model + catalog); a machine-readable index
|
|
62
|
+
is at `skills/catalog.json`.
|
|
95
63
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
64
|
+
- **Claude Code**: point it at the skills (e.g. "read
|
|
65
|
+
node_modules/@rangojs/router/skills/rango/SKILL.md before routing work"), or
|
|
66
|
+
copy/symlink the directories you use into your project's `.claude/skills/`.
|
|
67
|
+
- **Other agents (Cursor, Codex CLI, Gemini CLI, ...)**: these harnesses
|
|
68
|
+
auto-discover skills from `.agents/skills/` in your project (or
|
|
69
|
+
`~/.agents/skills/`) — copy or symlink the skill directories you use from
|
|
70
|
+
`node_modules/@rangojs/router/skills/<name>` into `.agents/skills/<name>`.
|
|
71
|
+
The files are plain markdown; cross-references like `/loader` name sibling
|
|
72
|
+
skill directories.
|
|
100
73
|
|
|
101
|
-
|
|
102
|
-
// reverse("home") -> "/"
|
|
103
|
-
```
|
|
74
|
+
## 1. Pages
|
|
104
75
|
|
|
105
|
-
|
|
76
|
+
A router is a tree. `path()` places a page, `layout()` wraps children,
|
|
77
|
+
`{ name }` gives a route an identity:
|
|
106
78
|
|
|
107
79
|
```tsx
|
|
80
|
+
// src/router.tsx
|
|
108
81
|
import { createRouter, urls } from "@rangojs/router";
|
|
109
|
-
import {
|
|
82
|
+
import { Document } from "./document";
|
|
83
|
+
import { ShopLayout } from "./layouts/shop";
|
|
84
|
+
import { HomePage } from "./routes/home";
|
|
85
|
+
import { ProductPage } from "./routes/product";
|
|
110
86
|
|
|
111
|
-
const urlpatterns = urls(({ path,
|
|
112
|
-
|
|
113
|
-
|
|
87
|
+
const urlpatterns = urls(({ path, layout }) => [
|
|
88
|
+
layout(<ShopLayout />, () => [
|
|
89
|
+
path("/", HomePage, { name: "home" }),
|
|
90
|
+
path("/products/:slug", ProductPage, { name: "product" }),
|
|
91
|
+
]),
|
|
114
92
|
]);
|
|
115
93
|
|
|
116
|
-
export const router = createRouter().routes(urlpatterns);
|
|
117
|
-
// reverse("blog.post", { slug: "hello-world" }) -> "/blog/hello-world"
|
|
94
|
+
export const router = createRouter({ document: Document }).routes(urlpatterns);
|
|
118
95
|
```
|
|
119
96
|
|
|
120
|
-
|
|
97
|
+
```tsx
|
|
98
|
+
// src/layouts/shop.tsx
|
|
99
|
+
import { Outlet } from "@rangojs/router/client";
|
|
100
|
+
|
|
101
|
+
export function ShopLayout() {
|
|
102
|
+
return (
|
|
103
|
+
<div>
|
|
104
|
+
<nav>Shop</nav>
|
|
105
|
+
<main>
|
|
106
|
+
<Outlet /> {/* child routes render here */}
|
|
107
|
+
</main>
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
121
112
|
|
|
122
113
|
```tsx
|
|
123
114
|
// src/document.tsx
|
|
124
115
|
"use client";
|
|
125
116
|
|
|
126
117
|
import type { ReactNode } from "react";
|
|
127
|
-
import { MetaTags } from "@rangojs/router/client";
|
|
118
|
+
import { MetaTags, Scripts } from "@rangojs/router/client";
|
|
128
119
|
|
|
129
120
|
export function Document({ children }: { children: ReactNode }) {
|
|
130
121
|
return (
|
|
131
122
|
<html lang="en">
|
|
132
123
|
<head>
|
|
133
124
|
<MetaTags />
|
|
125
|
+
<Scripts />
|
|
134
126
|
</head>
|
|
135
|
-
<body>
|
|
127
|
+
<body>
|
|
128
|
+
<Scripts position="body" />
|
|
129
|
+
{children}
|
|
130
|
+
</body>
|
|
136
131
|
</html>
|
|
137
132
|
);
|
|
138
133
|
}
|
|
139
134
|
```
|
|
140
135
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
Rango is a named-route router first.
|
|
144
|
-
|
|
145
|
-
Paths define where a route lives. Names define how the app refers to it.
|
|
146
|
-
|
|
147
|
-
It is also structurally composable.
|
|
148
|
-
|
|
149
|
-
As an app grows, routes can pull in external handlers, loaders, middleware, handles, cache policy, intercepts, prerendering, and static generation while keeping the route tree visible at the composition site.
|
|
150
|
-
|
|
151
|
-
### Named Routes
|
|
152
|
-
|
|
153
|
-
```tsx
|
|
154
|
-
import { urls } from "@rangojs/router";
|
|
155
|
-
|
|
156
|
-
const urlpatterns = urls(({ path }) => [
|
|
157
|
-
path("/", HomePage, { name: "home" }),
|
|
158
|
-
path("/product/:slug", ProductPage, { name: "product" }),
|
|
159
|
-
path("/search/:query?", SearchPage, { name: "search" }),
|
|
160
|
-
path("/files/*", FilesPage, { name: "files" }),
|
|
161
|
-
]);
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
Use `ctx.reverse()` from handler context as the default way to link to routes from server code:
|
|
165
|
-
|
|
166
|
-
```tsx
|
|
167
|
-
const ProductPage: Handler<"product"> = (ctx) => {
|
|
168
|
-
const url = ctx.reverse("product", { slug: "widget" }); // "/product/widget"
|
|
169
|
-
const searchUrl = ctx.reverse("search", undefined, { q: "rsc" }); // "/search?q=rsc"
|
|
170
|
-
return <Link to={url}>Widget</Link>;
|
|
171
|
-
};
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
`router.reverse()` (exported from the router module) is the same function without a handler context, useful in scripts or tests. In request code, prefer `ctx.reverse()` — it auto-fills mount params from the current match.
|
|
175
|
-
|
|
176
|
-
### Composable URL Modules
|
|
177
|
-
|
|
178
|
-
Local route names compose cleanly with `include(..., { name })`:
|
|
179
|
-
|
|
180
|
-
```tsx
|
|
181
|
-
import { urls } from "@rangojs/router";
|
|
182
|
-
|
|
183
|
-
export const blogPatterns = urls(({ path }) => [
|
|
184
|
-
path("/", BlogIndexPage, { name: "index" }),
|
|
185
|
-
path("/:slug", BlogPostPage, { name: "post" }),
|
|
186
|
-
]);
|
|
187
|
-
|
|
188
|
-
export const urlpatterns = urls(({ path, include }) => [
|
|
189
|
-
path("/", HomePage, { name: "home" }),
|
|
190
|
-
include("/blog", blogPatterns, { name: "blog" }),
|
|
191
|
-
]);
|
|
192
|
-
|
|
193
|
-
router.reverse("blog.index"); // "/blog"
|
|
194
|
-
router.reverse("blog.post", { slug: "hello-world" }); // "/blog/hello-world"
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
This is the core composition model:
|
|
198
|
-
|
|
199
|
-
- Paths stay local to the module that defines them
|
|
200
|
-
- Names become stable references across the app
|
|
201
|
-
- `include()` scales those names without forcing raw path-string coupling
|
|
202
|
-
|
|
203
|
-
### Structural Composability
|
|
204
|
-
|
|
205
|
-
Rango avoids the usual tradeoff between modularity and visibility.
|
|
206
|
-
|
|
207
|
-
You can extract route behavior into separate files or packages and still keep one readable route definition that shows the structure of the app.
|
|
208
|
-
|
|
209
|
-
```tsx
|
|
210
|
-
import { urls } from "@rangojs/router";
|
|
211
|
-
import { ProductPage } from "./routes/product";
|
|
212
|
-
import { ProductLoader } from "./loaders/product";
|
|
213
|
-
import { productMiddleware } from "./middleware/product";
|
|
214
|
-
import { productRevalidate } from "./revalidation/product";
|
|
215
|
-
|
|
216
|
-
const shopPatterns = urls(({ path, loader, middleware, revalidate, cache }) => [
|
|
217
|
-
path("/product/:slug", ProductPage, { name: "product" }, () => [
|
|
218
|
-
middleware(productMiddleware),
|
|
219
|
-
loader(ProductLoader),
|
|
220
|
-
revalidate(productRevalidate),
|
|
221
|
-
cache({ ttl: 300 }),
|
|
222
|
-
]),
|
|
223
|
-
]);
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
The route tree stays explicit even when behavior is modular.
|
|
227
|
-
|
|
228
|
-
This applies to:
|
|
229
|
-
|
|
230
|
-
- external route modules mounted with `include()`
|
|
231
|
-
- imported loaders, middleware, and handles attached at the route site
|
|
232
|
-
- prerendering and static generation attached without turning the route tree opaque
|
|
233
|
-
|
|
234
|
-
### Loaders As the Live Data Layer
|
|
235
|
-
|
|
236
|
-
Rango separates app structure from app data.
|
|
237
|
-
|
|
238
|
-
Routes, layouts, and pre-rendered segments can be static or cached, while
|
|
239
|
-
loaders stay live by default and re-resolve at request time.
|
|
240
|
-
|
|
241
|
-
This means you can pre-render or cache the shell of a page without freezing its
|
|
242
|
-
data.
|
|
136
|
+
(The built-in `DefaultDocument` already wires all of this — a custom document
|
|
137
|
+
is optional.)
|
|
243
138
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
- `loader()` provides fresh request-time data
|
|
247
|
-
- individual loaders can opt into caching explicitly when needed
|
|
248
|
-
|
|
249
|
-
```tsx
|
|
250
|
-
import { urls, Prerender } from "@rangojs/router";
|
|
251
|
-
import { ArticleLoader } from "./loaders/article";
|
|
252
|
-
|
|
253
|
-
const docsPatterns = urls(({ path, loader }) => [
|
|
254
|
-
path("/docs/:slug", Prerender(DocsArticle), { name: "docs.article" }, () => [
|
|
255
|
-
loader(ArticleLoader), // fresh by default
|
|
256
|
-
]),
|
|
257
|
-
]);
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
Pre-render the page, keep the data live.
|
|
261
|
-
|
|
262
|
-
### Typed Handlers
|
|
263
|
-
|
|
264
|
-
Route handlers receive a typed context with params, search params, and `reverse()`:
|
|
139
|
+
A handler is a function of `ctx`. Typing it by route name gives typed params
|
|
140
|
+
— the Vite plugin generates the route map automatically, nothing to register:
|
|
265
141
|
|
|
266
142
|
```tsx
|
|
143
|
+
// src/routes/product.tsx
|
|
267
144
|
import type { Handler } from "@rangojs/router";
|
|
268
145
|
|
|
269
146
|
export const ProductPage: Handler<"product"> = (ctx) => {
|
|
270
|
-
|
|
271
|
-
const homeUrl = ctx.reverse("home"); // type-safe URL by route name
|
|
272
|
-
return <h1>Product: {slug}</h1>;
|
|
147
|
+
return <h1>{ctx.params.slug}</h1>; // slug: string, from the pattern
|
|
273
148
|
};
|
|
274
149
|
```
|
|
275
150
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
All handler typing styles are supported, but they solve different problems:
|
|
279
|
-
|
|
280
|
-
- `Handler<"product">` — default for named app routes
|
|
281
|
-
- `Handler<".post", ScopedRouteMap<"blog">>` — best for reusable included modules
|
|
282
|
-
- `Handler<"/blog/:slug">` — good for unnamed or local-only extracted handlers
|
|
283
|
-
- `Handler<{ slug: string }>` — escape hatch for advanced or decoupled cases
|
|
284
|
-
|
|
285
|
-
Example of a scoped local name inside a mounted module:
|
|
151
|
+
And because routes have names, URLs are built, never hand-written:
|
|
286
152
|
|
|
287
153
|
```tsx
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
type BlogRoutes = ScopedRouteMap<"blog">;
|
|
292
|
-
|
|
293
|
-
export const BlogPostPage: Handler<".post", BlogRoutes> = (ctx) => {
|
|
294
|
-
return <a href={ctx.reverse(".index")}>Back to blog</a>;
|
|
295
|
-
};
|
|
154
|
+
const url = ctx.reverse("product", { slug: "espresso-cup" });
|
|
155
|
+
// "/products/espresso-cup" — name and params compile-time checked
|
|
296
156
|
```
|
|
297
157
|
|
|
298
|
-
|
|
158
|
+
Rename `/products/:slug` to `/shop/:slug` in the one place it's defined and
|
|
159
|
+
every link, redirect, and prefetch follows. In client components, `href()`
|
|
160
|
+
validates static paths against the registered patterns:
|
|
161
|
+
`<Link to={href("/")}>Home</Link>`.
|
|
299
162
|
|
|
300
|
-
|
|
163
|
+
The tree is also lazy-first, which is the shape serverless cold starts want.
|
|
164
|
+
`include()` mounts a whole route module under a prefix — and with the async
|
|
165
|
+
form, `include("/shop", () => import("./shop"))`, the group is code-split:
|
|
166
|
+
its module doesn't load or run until a request matches it, a group nobody
|
|
167
|
+
visits never evaluates at all, and warm requests run zero route handlers.
|
|
168
|
+
Boot cost stays flat as the app grows — one module body at startup, not one
|
|
169
|
+
per group — while matching stays an `O(path length)` prefix trie, identical
|
|
170
|
+
in dev and production. None of this is assumed: the trie is benchmarked
|
|
171
|
+
in-repo against multi-thousand-route manifests, and the lazy guarantees are
|
|
172
|
+
pinned by run-count tests (see
|
|
173
|
+
[matching & lazy discovery](https://github.com/ivogt/vite-rsc/blob/main/packages/rangojs-router/docs/internal/matching-and-lazy-discovery.md)).
|
|
174
|
+
Grow the tree without watching the boot time.
|
|
301
175
|
|
|
302
|
-
|
|
176
|
+
That's a working site. Everything below adds to this app.
|
|
303
177
|
|
|
304
|
-
|
|
305
|
-
const urlpatterns = urls(({ path }) => [
|
|
306
|
-
path("/search", SearchPage, {
|
|
307
|
-
name: "search",
|
|
308
|
-
search: { q: "string", page: "number?", sort: "string?" },
|
|
309
|
-
}),
|
|
310
|
-
]);
|
|
178
|
+
## 2. Data
|
|
311
179
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
const { q, page, sort } = ctx.search;
|
|
315
|
-
// q: string, page: number | undefined, sort: string | undefined
|
|
316
|
-
};
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
### Trailing Slash Handling
|
|
320
|
-
|
|
321
|
-
Trailing slash behavior is a current `path()` feature.
|
|
322
|
-
|
|
323
|
-
Set it per route with `trailingSlash`:
|
|
180
|
+
The product page needs data. A handler is an async server component — fetch
|
|
181
|
+
where you render:
|
|
324
182
|
|
|
325
183
|
```tsx
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
name: "docs",
|
|
333
|
-
trailingSlash: "always",
|
|
334
|
-
}),
|
|
335
|
-
path("/webhook", WebhookHandler, {
|
|
336
|
-
name: "webhook",
|
|
337
|
-
trailingSlash: "ignore",
|
|
338
|
-
}),
|
|
339
|
-
]);
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
Modes:
|
|
343
|
-
|
|
344
|
-
- `"never"` — canonical URL has no trailing slash, redirects `/about/` to `/about`
|
|
345
|
-
- `"always"` — canonical URL has a trailing slash, redirects `/docs` to `/docs/`
|
|
346
|
-
- `"ignore"` — matches both forms without redirect
|
|
347
|
-
|
|
348
|
-
Default behavior when `trailingSlash` is omitted:
|
|
349
|
-
|
|
350
|
-
- There is no separate global default mode
|
|
351
|
-
- If the pattern is defined without a trailing slash, the canonical URL is the no-slash form
|
|
352
|
-
- If the pattern is defined with a trailing slash, the canonical URL is the slash form
|
|
353
|
-
- The router redirects to the canonical form based on the pattern you defined
|
|
354
|
-
|
|
355
|
-
The recommended public API is the per-route `path(..., { trailingSlash })` option. Use `"ignore"` sparingly, especially on content pages, because `/x` and `/x/` are distinct URLs.
|
|
356
|
-
|
|
357
|
-
### Response Routes
|
|
358
|
-
|
|
359
|
-
Define API endpoints that bypass the RSC pipeline:
|
|
360
|
-
|
|
361
|
-
```tsx
|
|
362
|
-
const urlpatterns = urls(({ path }) => [
|
|
363
|
-
path.json("/api/health", () => ({ status: "ok" }), { name: "health" }),
|
|
364
|
-
path.text("/robots.txt", () => "User-agent: *\nAllow: /", { name: "robots" }),
|
|
365
|
-
path.xml("/feed.xml", () => "<rss>...</rss>", { name: "feed" }),
|
|
366
|
-
]);
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
Response types available: `path.json()`, `path.text()`, `path.html()`, `path.xml()`, `path.image()`, `path.stream()`, `path.any()`.
|
|
370
|
-
|
|
371
|
-
## Layouts & Nesting
|
|
372
|
-
|
|
373
|
-
### Layouts with Outlet
|
|
374
|
-
|
|
375
|
-
```tsx
|
|
376
|
-
import { urls } from "@rangojs/router";
|
|
377
|
-
|
|
378
|
-
const urlpatterns = urls(({ path, layout }) => [
|
|
379
|
-
layout(<MainLayout />, () => [
|
|
380
|
-
path("/", HomePage, { name: "home" }),
|
|
381
|
-
path("/about", AboutPage, { name: "about" }),
|
|
382
|
-
]),
|
|
383
|
-
]);
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
```tsx
|
|
387
|
-
"use client";
|
|
388
|
-
import { Outlet } from "@rangojs/router/client";
|
|
389
|
-
|
|
390
|
-
function MainLayout() {
|
|
391
|
-
return (
|
|
392
|
-
<div>
|
|
393
|
-
<nav>...</nav>
|
|
394
|
-
<Outlet />
|
|
395
|
-
</div>
|
|
396
|
-
);
|
|
397
|
-
}
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
### Loading Skeletons
|
|
401
|
-
|
|
402
|
-
```tsx
|
|
403
|
-
const urlpatterns = urls(({ path, loading }) => [
|
|
404
|
-
path("/product/:slug", ProductPage, { name: "product" }, () => [
|
|
405
|
-
loading(<ProductSkeleton />),
|
|
406
|
-
]),
|
|
407
|
-
]);
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
### Parallel Routes
|
|
411
|
-
|
|
412
|
-
```tsx
|
|
413
|
-
const urlpatterns = urls(({ path, layout, parallel, loader, loading }) => [
|
|
414
|
-
layout(BlogLayout, () => [
|
|
415
|
-
parallel({ "@sidebar": BlogSidebarHandler }, () => [
|
|
416
|
-
loader(BlogSidebarLoader),
|
|
417
|
-
loading(<SidebarSkeleton />),
|
|
418
|
-
]),
|
|
419
|
-
path("/blog", BlogIndexPage, { name: "blog" }),
|
|
420
|
-
path("/blog/:slug", BlogPostPage, { name: "blogPost" }),
|
|
421
|
-
]),
|
|
422
|
-
]);
|
|
184
|
+
// src/routes/product.tsx
|
|
185
|
+
export const ProductPage: Handler<"product"> = async (ctx) => {
|
|
186
|
+
const product = await db.products.find(ctx.params.slug);
|
|
187
|
+
ctx.use(Meta)({ title: product.name }); // metadata where the data is
|
|
188
|
+
return <ProductView product={product} />;
|
|
189
|
+
};
|
|
423
190
|
```
|
|
424
191
|
|
|
425
|
-
|
|
192
|
+
That's the default data path. React Router and Remix split data into a
|
|
193
|
+
loader beside the component because components couldn't fetch; RSC collapses
|
|
194
|
+
the split, and Rango doesn't reintroduce it. (That `ctx.use(Meta)` line is
|
|
195
|
+
also the whole metadata story: push tags where the data already is, layouts
|
|
196
|
+
set title templates, deeper segments override — no separate metadata export,
|
|
197
|
+
no second fetch.)
|
|
426
198
|
|
|
427
|
-
|
|
199
|
+
Loaders enter when data needs a life of its own. First case: a **client
|
|
200
|
+
component** needs server data — the stock badge is interactive, but the
|
|
201
|
+
stock lives in the database:
|
|
428
202
|
|
|
429
203
|
```tsx
|
|
204
|
+
// src/loaders/stock.ts
|
|
430
205
|
import { createLoader } from "@rangojs/router";
|
|
431
206
|
|
|
432
|
-
export const
|
|
433
|
-
|
|
434
|
-
return
|
|
207
|
+
export const StockLoader = createLoader(async (ctx) => {
|
|
208
|
+
"use server";
|
|
209
|
+
return db.stockFor(ctx.params.slug);
|
|
435
210
|
});
|
|
436
211
|
```
|
|
437
212
|
|
|
438
|
-
### Using in Server Components (Handlers)
|
|
439
|
-
|
|
440
213
|
```tsx
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
const { posts } = await ctx.use(BlogSidebarLoader);
|
|
446
|
-
return (
|
|
447
|
-
<ul>
|
|
448
|
-
{posts.map((p) => (
|
|
449
|
-
<li key={p.slug}>{p.title}</li>
|
|
450
|
-
))}
|
|
451
|
-
</ul>
|
|
452
|
-
);
|
|
453
|
-
}
|
|
214
|
+
path("/products/:slug", ProductPage, { name: "product" }, () => [
|
|
215
|
+
loader(StockLoader),
|
|
216
|
+
loading(<ProductSkeleton />),
|
|
217
|
+
]),
|
|
454
218
|
```
|
|
455
219
|
|
|
456
|
-
### Using in Client Components
|
|
457
|
-
|
|
458
220
|
```tsx
|
|
221
|
+
// src/components/stock-badge.tsx
|
|
459
222
|
"use client";
|
|
460
223
|
import { useLoader } from "@rangojs/router/client";
|
|
461
|
-
import {
|
|
224
|
+
import { StockLoader } from "../loaders/stock";
|
|
462
225
|
|
|
463
|
-
function
|
|
464
|
-
const { data } = useLoader(
|
|
465
|
-
return
|
|
466
|
-
<ul>
|
|
467
|
-
{data.posts.map((p) => (
|
|
468
|
-
<li key={p.slug}>{p.title}</li>
|
|
469
|
-
))}
|
|
470
|
-
</ul>
|
|
471
|
-
);
|
|
226
|
+
export function StockBadge() {
|
|
227
|
+
const { data } = useLoader(StockLoader);
|
|
228
|
+
return <span>{data.inStock ? "In stock" : "Sold out"}</span>;
|
|
472
229
|
}
|
|
473
230
|
```
|
|
474
231
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
path("/blog", BlogIndexPage, { name: "blog" }, () => [
|
|
480
|
-
loader(BlogSidebarLoader),
|
|
481
|
-
]),
|
|
482
|
-
]);
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
## Navigation & Links
|
|
486
|
-
|
|
487
|
-
### Named Routes with `ctx.reverse()` (Server)
|
|
488
|
-
|
|
489
|
-
In server components and handlers, use `ctx.reverse()` to generate URLs by route name. This is the default — it is typed, auto-fills mount params from the current match, and resolves both local (`.name`) and absolute (`name.sub`) names:
|
|
232
|
+
Loaders run in parallel with the handler and stream; `loading()` opts the
|
|
233
|
+
segment into skeleton-then-stream. Without it, document requests arrive
|
|
234
|
+
**ready** — the HTML ships with data in place; the skeleton is a per-segment
|
|
235
|
+
choice, not the first impression.
|
|
490
236
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
const backUrl = ctx.reverse("blog");
|
|
497
|
-
return <Link to={backUrl}>Back to blog</Link>;
|
|
498
|
-
};
|
|
499
|
-
```
|
|
237
|
+
The rule of thumb: fetch in the **handler** when the data belongs to the
|
|
238
|
+
rendered page — it will be frozen with the shell if you cache it (step 4).
|
|
239
|
+
Put data in a **loader** when it must outlive the shell: shared with client
|
|
240
|
+
components, fresh on every hit even when the segment is cached, refetchable
|
|
241
|
+
from the client, or revalidated on its own after actions.
|
|
500
242
|
|
|
501
|
-
|
|
243
|
+
## 3. Mutations
|
|
502
244
|
|
|
503
|
-
|
|
245
|
+
Users add to cart. A server action is a plain `"use server"` function; the
|
|
246
|
+
form posts to it with standard React 19 hooks — and it works without
|
|
247
|
+
JavaScript:
|
|
504
248
|
|
|
505
249
|
```tsx
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
### Client Components
|
|
511
|
-
|
|
512
|
-
**`reverse()` is server-only.** It depends on the route manifest and handler context — neither is available in the browser bundle. Client components receive URLs as props, loader data, or server-action return values:
|
|
250
|
+
// src/actions/cart.ts
|
|
251
|
+
"use server";
|
|
513
252
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
function BlogIndex(ctx: HandlerContext) {
|
|
517
|
-
return (
|
|
518
|
-
<Nav
|
|
519
|
-
home={ctx.reverse("home")}
|
|
520
|
-
post={ctx.reverse("blogPost", { slug: "my-post" })}
|
|
521
|
-
/>
|
|
522
|
-
);
|
|
253
|
+
export async function addToCart(productId: string) {
|
|
254
|
+
await db.cart.insert({ productId });
|
|
523
255
|
}
|
|
524
256
|
```
|
|
525
257
|
|
|
526
258
|
```tsx
|
|
259
|
+
// src/components/add-to-cart.tsx
|
|
527
260
|
"use client";
|
|
528
|
-
import {
|
|
261
|
+
import { useActionState } from "react";
|
|
262
|
+
import { addToCart } from "../actions/cart";
|
|
529
263
|
|
|
530
|
-
export function
|
|
264
|
+
export function AddToCart({ productId }: { productId: string }) {
|
|
265
|
+
const [, action, pending] = useActionState(() => addToCart(productId), null);
|
|
531
266
|
return (
|
|
532
|
-
<
|
|
533
|
-
<
|
|
534
|
-
|
|
535
|
-
</nav>
|
|
267
|
+
<form action={action}>
|
|
268
|
+
<button disabled={pending}>{pending ? "Adding…" : "Add to cart"}</button>
|
|
269
|
+
</form>
|
|
536
270
|
);
|
|
537
271
|
}
|
|
538
272
|
```
|
|
539
273
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
In client components, use `href()` for compile-time path validation on static path strings:
|
|
274
|
+
After an action, route segments and loaders re-render by default so the UI
|
|
275
|
+
reflects the new state. `revalidate()` narrows that to the segments that
|
|
276
|
+
actually own the data — matched by action **reference**, so renames are
|
|
277
|
+
compile errors, not stale predicates:
|
|
545
278
|
|
|
546
279
|
```tsx
|
|
547
|
-
|
|
548
|
-
import { Link, href } from "@rangojs/router/client";
|
|
549
|
-
|
|
550
|
-
function Nav() {
|
|
551
|
-
return (
|
|
552
|
-
<nav>
|
|
553
|
-
<Link to={href("/")}>Home</Link>
|
|
554
|
-
<Link to={href("/blog")} prefetch="adaptive">
|
|
555
|
-
Blog
|
|
556
|
-
</Link>
|
|
557
|
-
<Link to={href("/about")}>About</Link>
|
|
558
|
-
</nav>
|
|
559
|
-
);
|
|
560
|
-
}
|
|
561
|
-
```
|
|
562
|
-
|
|
563
|
-
`href()` validates that the path matches a registered route pattern at compile time (e.g. `/blog/my-post` matches `/blog/:slug`).
|
|
280
|
+
import * as CartActions from "./actions/cart";
|
|
564
281
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
function SearchForm() {
|
|
572
|
-
const router = useRouter();
|
|
573
|
-
const nav = useNavigation();
|
|
574
|
-
|
|
575
|
-
function handleSubmit(query: string) {
|
|
576
|
-
router.push(`/search?q=${encodeURIComponent(query)}`);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
return <form onSubmit={...}>{nav.state !== "idle" && <Spinner />}</form>;
|
|
580
|
-
}
|
|
581
|
-
```
|
|
582
|
-
|
|
583
|
-
### Scroll Restoration
|
|
584
|
-
|
|
585
|
-
```tsx
|
|
586
|
-
"use client";
|
|
587
|
-
import { ScrollRestoration } from "@rangojs/router/client";
|
|
588
|
-
|
|
589
|
-
function Document({ children }) {
|
|
590
|
-
return (
|
|
591
|
-
<html>
|
|
592
|
-
<body>
|
|
593
|
-
{children}
|
|
594
|
-
<ScrollRestoration />
|
|
595
|
-
</body>
|
|
596
|
-
</html>
|
|
597
|
-
);
|
|
598
|
-
}
|
|
599
|
-
```
|
|
600
|
-
|
|
601
|
-
## Includes (Composable Modules)
|
|
602
|
-
|
|
603
|
-
Split URL patterns into composable modules with `include()`:
|
|
604
|
-
|
|
605
|
-
```tsx
|
|
606
|
-
// src/api/urls.tsx
|
|
607
|
-
import { urls } from "@rangojs/router";
|
|
608
|
-
|
|
609
|
-
export const apiPatterns = urls(({ path }) => [
|
|
610
|
-
path.json("/health", () => ({ status: "ok" }), { name: "health" }),
|
|
611
|
-
path.json("/products", getProducts, { name: "products" }),
|
|
612
|
-
]);
|
|
613
|
-
|
|
614
|
-
// src/urls.tsx
|
|
615
|
-
import { urls } from "@rangojs/router";
|
|
616
|
-
import { apiPatterns } from "./api/urls";
|
|
617
|
-
|
|
618
|
-
export const urlpatterns = urls(({ path, include }) => [
|
|
619
|
-
path("/", HomePage, { name: "home" }),
|
|
620
|
-
include("/api", apiPatterns, { name: "api" }),
|
|
621
|
-
// Mounts apiPatterns under /api: /api/health, /api/products
|
|
622
|
-
]);
|
|
282
|
+
path("/cart", CartPage, { name: "cart" }, () => [
|
|
283
|
+
loader(CartLoader, () => [
|
|
284
|
+
revalidate((ctx) => ctx.isAction(CartActions) || undefined),
|
|
285
|
+
]),
|
|
286
|
+
]),
|
|
623
287
|
```
|
|
624
288
|
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
289
|
+
Notice what you didn't write: no API endpoint, no fetch wrapper, and no
|
|
290
|
+
client-cache invalidation call. Actions invalidate the client-side caches
|
|
291
|
+
(history entries, prefetches, HTTP cache key) automatically — a no-op action
|
|
292
|
+
can opt out per invocation with `keepClientCache()`.
|
|
628
293
|
|
|
629
|
-
|
|
294
|
+
## 4. Speed
|
|
630
295
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
Without a `name`, included routes are local to the mounted module. They still match requests and render normally, but their names are hidden from the generated route map and cannot be reversed globally. Use `{ name: "" }` to merge children into the parent namespace without adding a prefix.
|
|
638
|
-
|
|
639
|
-
**`{ name: "" }` is flattening, not isolation.** Flattened routes behave as if defined inline at the include site — dot-local reverse (`.name`) can reach any sibling route at root scope, including routes from other `{ name: "" }` mounts. If you need module-level isolation, omit the `name` option or use a namespace.
|
|
640
|
-
|
|
641
|
-
## Middleware
|
|
296
|
+
Production traffic. Wrap a segment in `cache()` and the rendered shell —
|
|
297
|
+
including everything the handler fetched — is stored, while every loader on
|
|
298
|
+
it keeps running fresh on each hit. This is where the handler-vs-loader
|
|
299
|
+
choice from step 2 pays off: handler data freezes with the shell, the
|
|
300
|
+
`StockLoader` stays live. Cached shell, live data, one line:
|
|
642
301
|
|
|
643
302
|
```tsx
|
|
644
|
-
const urlpatterns = urls(({ path,
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
)
|
|
652
|
-
|
|
653
|
-
},
|
|
654
|
-
() => [path("/dashboard", DashboardPage, { name: "dashboard" })],
|
|
655
|
-
),
|
|
656
|
-
]);
|
|
657
|
-
```
|
|
658
|
-
|
|
659
|
-
## Caching
|
|
660
|
-
|
|
661
|
-
### Route-Level Caching
|
|
662
|
-
|
|
663
|
-
```tsx
|
|
664
|
-
const urlpatterns = urls(({ path, cache }) => [
|
|
665
|
-
cache({ ttl: 60, swr: 300 }, () => [
|
|
666
|
-
path("/blog", BlogIndexPage, { name: "blog" }),
|
|
667
|
-
path("/blog/:slug", BlogPostPage, { name: "blogPost" }),
|
|
303
|
+
const urlpatterns = urls(({ path, layout, loader, loading, cache }) => [
|
|
304
|
+
layout(<ShopLayout />, () => [
|
|
305
|
+
path("/", HomePage, { name: "home" }),
|
|
306
|
+
cache({ ttl: 600, swr: 3600, tags: ["products"] }, () => [
|
|
307
|
+
path("/products/:slug", ProductPage, { name: "product" }, () => [
|
|
308
|
+
loader(StockLoader), // never cached: re-runs on every hit
|
|
309
|
+
loading(<ProductSkeleton />),
|
|
310
|
+
]),
|
|
311
|
+
]),
|
|
668
312
|
]),
|
|
669
313
|
]);
|
|
670
314
|
```
|
|
671
315
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
import { createRouter } from "@rangojs/router";
|
|
676
|
-
import {
|
|
677
|
-
CFCacheStore,
|
|
678
|
-
createDocumentCacheMiddleware,
|
|
679
|
-
} from "@rangojs/router/cache";
|
|
680
|
-
|
|
681
|
-
export const router = createRouter({
|
|
682
|
-
document: Document,
|
|
683
|
-
cache: (env) => ({
|
|
684
|
-
store: new CFCacheStore({
|
|
685
|
-
defaults: { ttl: 60, swr: 300 },
|
|
686
|
-
ctx: env.ctx,
|
|
687
|
-
}),
|
|
688
|
-
}),
|
|
689
|
-
})
|
|
690
|
-
.use(createDocumentCacheMiddleware())
|
|
691
|
-
.routes(urlpatterns);
|
|
692
|
-
```
|
|
693
|
-
|
|
694
|
-
Available cache stores:
|
|
695
|
-
|
|
696
|
-
- `CFCacheStore` — Cloudflare edge cache (production)
|
|
697
|
-
- `MemorySegmentCacheStore` — In-memory cache (development/testing)
|
|
698
|
-
|
|
699
|
-
## Pre-rendering
|
|
700
|
-
|
|
701
|
-
Pre-rendering generates route segments at build time. The worker handles all requests — there are no static files served from assets.
|
|
702
|
-
|
|
703
|
-
### Static Segments
|
|
704
|
-
|
|
705
|
-
Use `Static()` for segments rendered once at build time (no params). Works on `path()`, `layout()`, and `parallel()`:
|
|
316
|
+
Wire a store once on the router (`MemorySegmentCacheStore` for dev,
|
|
317
|
+
`CFCacheStore` for Cloudflare — see the [`/caching` skill](./skills/caching/SKILL.md)),
|
|
318
|
+
and bust by tag from the mutation that changes the data:
|
|
706
319
|
|
|
707
320
|
```tsx
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
return <article>...</article>;
|
|
712
|
-
});
|
|
321
|
+
// src/actions/products.ts
|
|
322
|
+
"use server";
|
|
323
|
+
import { updateTag } from "@rangojs/router";
|
|
713
324
|
|
|
714
|
-
export
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
{items.map((i) => (
|
|
719
|
-
<a key={i.slug} href={i.slug}>
|
|
720
|
-
{i.title}
|
|
721
|
-
</a>
|
|
722
|
-
))}
|
|
723
|
-
</nav>
|
|
724
|
-
);
|
|
725
|
-
});
|
|
325
|
+
export async function renameProduct(id: string, name: string) {
|
|
326
|
+
await db.products.rename(id, name);
|
|
327
|
+
await updateTag("products"); // awaitable, read-your-own-writes
|
|
328
|
+
}
|
|
726
329
|
```
|
|
727
330
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
Use `Prerender()` for route-scoped pre-rendering. With params, provide `getParams` first, handler second:
|
|
331
|
+
Navigation speed is a `Link` prop away:
|
|
731
332
|
|
|
732
333
|
```tsx
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
async () => {
|
|
737
|
-
const slugs = await getAllBlogSlugs();
|
|
738
|
-
return slugs.map((slug) => ({ slug }));
|
|
739
|
-
},
|
|
740
|
-
async (ctx) => {
|
|
741
|
-
const post = await getPost(ctx.params.slug);
|
|
742
|
-
return <article>{post.content}</article>;
|
|
743
|
-
},
|
|
744
|
-
);
|
|
334
|
+
<Link to={url} prefetch="viewport">
|
|
335
|
+
{product.name}
|
|
336
|
+
</Link>
|
|
745
337
|
```
|
|
746
338
|
|
|
747
|
-
|
|
339
|
+
A fully-prefetched navigation commits a **finished page** — no skeleton, no
|
|
340
|
+
loading flash — and staying correct is the router's job: every action
|
|
341
|
+
invalidates the prefetch caches by default, so a prefetched page can't show
|
|
342
|
+
pre-mutation data.
|
|
748
343
|
|
|
749
|
-
|
|
344
|
+
To move the shell's cost to build time entirely, `Prerender()` bakes it while
|
|
345
|
+
loaders stay live at runtime — same mental model, earlier cache write. See
|
|
346
|
+
the [`/prerender` skill](./skills/prerender/SKILL.md).
|
|
750
347
|
|
|
751
|
-
|
|
752
|
-
import { Prerender, Passthrough } from "@rangojs/router";
|
|
753
|
-
|
|
754
|
-
export const ProductPageDef = Prerender(
|
|
755
|
-
async () => {
|
|
756
|
-
const featured = await db.getFeaturedProducts();
|
|
757
|
-
return featured.map((p) => ({ id: p.id }));
|
|
758
|
-
},
|
|
759
|
-
async (ctx) => {
|
|
760
|
-
const product = await db.getProduct(ctx.params.id);
|
|
761
|
-
return <Product data={product} />;
|
|
762
|
-
},
|
|
763
|
-
);
|
|
764
|
-
|
|
765
|
-
// In route definition:
|
|
766
|
-
path(
|
|
767
|
-
"/products/:id",
|
|
768
|
-
Passthrough(ProductPageDef, async (ctx) => {
|
|
769
|
-
const product = await ctx.env.DB.getProduct(ctx.params.id);
|
|
770
|
-
return <Product data={product} />;
|
|
771
|
-
}),
|
|
772
|
-
);
|
|
773
|
-
```
|
|
348
|
+
## 5. An API, when you need one
|
|
774
349
|
|
|
775
|
-
|
|
350
|
+
Response routes live in the same tree — `path.json()`, `path.text()`,
|
|
351
|
+
`path.xml()`, `path.image()`, `path.stream()`:
|
|
776
352
|
|
|
777
353
|
```tsx
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
},
|
|
783
|
-
async (ctx) => {
|
|
784
|
-
const product = await db.getProduct(ctx.params.id);
|
|
785
|
-
if (!product.published) return ctx.passthrough();
|
|
786
|
-
return <Product data={product} />;
|
|
787
|
-
},
|
|
788
|
-
);
|
|
354
|
+
path("/products/:slug", ProductPage, { name: "product" }),
|
|
355
|
+
path.json("/products/:slug", (ctx) => db.products.find(ctx.params.slug), {
|
|
356
|
+
name: "productJson",
|
|
357
|
+
}),
|
|
789
358
|
```
|
|
790
359
|
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
360
|
+
Same URL: browsers get the page, API clients get JSON, negotiated by
|
|
361
|
+
`Accept` header in the route trie. Handlers return bare values; errors
|
|
362
|
+
serialize as RFC 9457 `application/problem+json`. The payload type is
|
|
363
|
+
inferred from the handler — no codegen:
|
|
794
364
|
|
|
795
365
|
```ts
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
)
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
366
|
+
type Product = RouteResponse<typeof urlpatterns, "productJson">;
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
See the [`/api-client` skill](./skills/api-client/SKILL.md) for a small typed
|
|
370
|
+
client over these endpoints.
|
|
371
|
+
|
|
372
|
+
## Everything else, when you need it
|
|
373
|
+
|
|
374
|
+
That was the core: `path`/`layout`/`include`, names, loaders, actions +
|
|
375
|
+
`revalidate`, `cache`, response routes. The rest is opt-in — reach for it
|
|
376
|
+
when the requirement appears:
|
|
377
|
+
|
|
378
|
+
| I need to… | Skill |
|
|
379
|
+
| ----------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
380
|
+
| guard or shape requests (auth, headers) | [`/middleware`](./skills/middleware/SKILL.md) |
|
|
381
|
+
| multi-column layouts, independent slots | [`/parallel`](./skills/parallel/SKILL.md) |
|
|
382
|
+
| open a route as a modal on soft navigation | [`/intercept`](./skills/intercept/SKILL.md) |
|
|
383
|
+
| compose route modules / sub-apps | [`/route`](./skills/route/SKILL.md), [`/composability`](./skills/composability/SKILL.md) |
|
|
384
|
+
| cache a single function or component | [`/use-cache`](./skills/use-cache/SKILL.md), [`/cache-guide`](./skills/cache-guide/SKILL.md) |
|
|
385
|
+
| feed live loaders from a cached shell | [`/shell-manifest`](./skills/shell-manifest/SKILL.md) |
|
|
386
|
+
| edge caching with Cache-Control | [`/document-cache`](./skills/document-cache/SKILL.md) |
|
|
387
|
+
| light/dark mode without FOUC | [`/theme`](./skills/theme/SKILL.md) |
|
|
388
|
+
| analytics / third-party scripts with CSP nonce | [`/scripts`](./skills/scripts/SKILL.md) |
|
|
389
|
+
| locale routing | [`/i18n`](./skills/i18n/SKILL.md) |
|
|
390
|
+
| SSE and WebSockets | [`/streams-and-websockets`](./skills/streams-and-websockets/SKILL.md) |
|
|
391
|
+
| multi-app routing by domain | [`/host-router`](./skills/host-router/SKILL.md) |
|
|
392
|
+
| animate navigations | [`/view-transitions`](./skills/view-transitions/SKILL.md) |
|
|
393
|
+
| test loaders, middleware, handlers, Flight | [`/testing`](./skills/testing/SKILL.md) |
|
|
394
|
+
| see where request time goes | [`/observability`](./skills/observability/SKILL.md) |
|
|
395
|
+
| deploy to Vercel (cache store, tracing, output) | [`/vercel`](./skills/vercel/SKILL.md) |
|
|
396
|
+
| choose in-function vs CDN caching | [`/deployment-caching`](./skills/deployment-caching/SKILL.md) |
|
|
397
|
+
| compare Rango with Next.js / TanStack / Waku | [`/comparison`](./skills/comparison/SKILL.md) |
|
|
398
|
+
|
|
399
|
+
The [`/rango` skill](./skills/rango/SKILL.md) is the full catalog and the
|
|
400
|
+
mental model that ties it together.
|
|
401
|
+
|
|
402
|
+
## Reference
|
|
403
|
+
|
|
404
|
+
### Imports and subpaths
|
|
405
|
+
|
|
406
|
+
| Export | Description |
|
|
407
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
408
|
+
| `@rangojs/router` | Server/RSC core and shared types: `createRouter`, `urls`, `createLoader`, `Handler`, `Prerender`, `Meta` |
|
|
409
|
+
| `@rangojs/router/client` | Client: `Link`, `Outlet`, `href`, `useNavigation`, `useLoader`, `MetaTags` |
|
|
410
|
+
| `@rangojs/router/cache` | Cache: `CFCacheStore`, `VercelCacheStore`, `MemorySegmentCacheStore`, `createDocumentCacheMiddleware` |
|
|
411
|
+
| `@rangojs/router/theme` | Theme: `useTheme`, `ThemeProvider`, `ThemeScript` |
|
|
412
|
+
| `@rangojs/router/host` | Host routing: `createHostRouter`, `defineHosts`, `isNoRouteMatchError` |
|
|
413
|
+
| `@rangojs/router/vercel` | Vercel: `createVercelTracing` (phase spans via `@vercel/otel`'s global tracer) |
|
|
414
|
+
| `@rangojs/router/vite` | Vite plugin: `rango()` |
|
|
415
|
+
| `@rangojs/router/testing` | Consumer testing primitives: `runLoader`, `runMiddleware`, `dispatch` (plus `/testing/dom`, `/testing/flight`, `/testing/e2e`) |
|
|
416
|
+
| `@rangojs/router/rsc` | Advanced server pipeline APIs: `createRSCHandler`, request-context access |
|
|
417
|
+
| `@rangojs/router/ssr` | Advanced SSR bridge APIs: `createSSRHandler` |
|
|
418
|
+
|
|
419
|
+
Use only subpaths that are explicitly exported; avoid deep imports.
|
|
420
|
+
|
|
421
|
+
The root entry is conditionally resolved: server-only APIs (`createRouter`,
|
|
422
|
+
`urls`, `redirect`, `Prerender`, `cookies`) run under the `react-server`
|
|
423
|
+
condition and throw guidance errors elsewhere. If you hit a root-entrypoint
|
|
424
|
+
stub error: hooks and components (`Link`, `Outlet`, `useLoader`, `MetaTags`)
|
|
425
|
+
live in `@rangojs/router/client`; cache APIs in `@rangojs/router/cache`;
|
|
426
|
+
host APIs in `@rangojs/router/host`.
|
|
427
|
+
|
|
428
|
+
### Type safety
|
|
429
|
+
|
|
430
|
+
The Vite plugin generates `router.named-routes.gen.ts` automatically (on dev
|
|
431
|
+
startup, HMR, and builds), registering route names, params, and search
|
|
432
|
+
schemas globally via `Rango.GeneratedRouteMap`. That powers `Handler<"name">`,
|
|
433
|
+
`ctx.reverse()`, and `RouteParams<"name">` with no manual registration.
|
|
434
|
+
|
|
435
|
+
For response-aware and path-based utilities (`href()`, `Rango.Path`,
|
|
436
|
+
`RouteResponse`), augment `Rango.RegisteredRoutes` once:
|
|
820
437
|
|
|
821
438
|
```ts
|
|
822
|
-
// Custom factory
|
|
823
|
-
rango({
|
|
824
|
-
buildEnv: async (ctx) => {
|
|
825
|
-
const { getPlatformProxy } = await import("wrangler");
|
|
826
|
-
const proxy = await getPlatformProxy();
|
|
827
|
-
return { env: proxy.env, dispose: proxy.dispose };
|
|
828
|
-
},
|
|
829
|
-
});
|
|
830
|
-
|
|
831
|
-
// Plain object (Node.js)
|
|
832
|
-
rango({ buildEnv: { DATABASE_URL: process.env.DATABASE_URL } });
|
|
833
|
-
```
|
|
834
|
-
|
|
835
|
-
Build-time env applies to both production builds and dev on-demand prerender. Without `buildEnv`, accessing `ctx.env` in a Prerender handler throws with a clear error.
|
|
836
|
-
|
|
837
|
-
## Theme
|
|
838
|
-
|
|
839
|
-
### Router Configuration
|
|
840
|
-
|
|
841
|
-
```tsx
|
|
842
|
-
export const router = createRouter({
|
|
843
|
-
document: Document,
|
|
844
|
-
theme: {
|
|
845
|
-
defaultTheme: "light",
|
|
846
|
-
themes: ["light", "dark", "system"],
|
|
847
|
-
attribute: "class",
|
|
848
|
-
enableSystem: true,
|
|
849
|
-
},
|
|
850
|
-
}).routes(urlpatterns);
|
|
851
|
-
```
|
|
852
|
-
|
|
853
|
-
### Theme Toggle
|
|
854
|
-
|
|
855
|
-
```tsx
|
|
856
|
-
"use client";
|
|
857
|
-
import { useTheme } from "@rangojs/router/theme";
|
|
858
|
-
|
|
859
|
-
function ThemeToggle() {
|
|
860
|
-
const { theme, setTheme, themes } = useTheme();
|
|
861
|
-
return (
|
|
862
|
-
<select value={theme} onChange={(e) => setTheme(e.target.value)}>
|
|
863
|
-
{themes.map((t) => (
|
|
864
|
-
<option key={t}>{t}</option>
|
|
865
|
-
))}
|
|
866
|
-
</select>
|
|
867
|
-
);
|
|
868
|
-
}
|
|
869
|
-
```
|
|
870
|
-
|
|
871
|
-
## Host Routing
|
|
872
|
-
|
|
873
|
-
Route requests to different apps based on domain/subdomain patterns using `@rangojs/router/host`:
|
|
874
|
-
|
|
875
|
-
```tsx
|
|
876
|
-
// worker.rsc.tsx
|
|
877
|
-
import { createHostRouter } from "@rangojs/router/host";
|
|
878
|
-
|
|
879
|
-
const hostRouter = createHostRouter();
|
|
880
|
-
|
|
881
|
-
hostRouter.host(["*.localhost"]).map(() => import("./apps/admin/handler.js"));
|
|
882
|
-
hostRouter.host(["localhost"]).map(() => import("./apps/site/handler.js"));
|
|
883
|
-
hostRouter.fallback().map(() => import("./apps/site/handler.js"));
|
|
884
|
-
|
|
885
|
-
export default {
|
|
886
|
-
async fetch(request, env, ctx) {
|
|
887
|
-
return hostRouter.match(request, { env, ctx });
|
|
888
|
-
},
|
|
889
|
-
};
|
|
890
|
-
```
|
|
891
|
-
|
|
892
|
-
Each sub-app has its own `createRouter()` and `urls()`. The host router lazily imports the matched app's handler. Patterns are matched in registration order — register more specific patterns (subdomains) before catch-alls.
|
|
893
|
-
|
|
894
|
-
## Meta Tags
|
|
895
|
-
|
|
896
|
-
Accumulate meta tags across route segments using the built-in `Meta` handle:
|
|
897
|
-
|
|
898
|
-
```tsx
|
|
899
|
-
import { Meta } from "@rangojs/router";
|
|
900
|
-
import type { HandlerContext } from "@rangojs/router";
|
|
901
|
-
|
|
902
|
-
export function BlogPostPage(ctx: HandlerContext) {
|
|
903
|
-
const meta = ctx.use(Meta);
|
|
904
|
-
meta({ title: "My Blog Post" });
|
|
905
|
-
meta({ name: "description", content: "A great blog post" });
|
|
906
|
-
meta({ property: "og:title", content: "My Blog Post" });
|
|
907
|
-
|
|
908
|
-
return <article>...</article>;
|
|
909
|
-
}
|
|
910
|
-
```
|
|
911
|
-
|
|
912
|
-
Render collected tags in the document with `<MetaTags />` from `@rangojs/router/client`.
|
|
913
|
-
|
|
914
|
-
## CLI: `rango generate`
|
|
915
|
-
|
|
916
|
-
Route types are generated automatically by the Vite plugin. The CLI is a manual fallback for generating types outside the dev server (e.g. in CI or for IDE support before first `pnpm dev`):
|
|
917
|
-
|
|
918
|
-
```bash
|
|
919
|
-
npx rango generate src/router.tsx
|
|
920
|
-
npx rango generate src/ # recursive scan
|
|
921
|
-
npx rango generate src/urls.tsx src/api/ # mix files and directories
|
|
922
|
-
```
|
|
923
|
-
|
|
924
|
-
Auto-detects file type:
|
|
925
|
-
|
|
926
|
-
- Files with `createRouter` → `*.named-routes.gen.ts` with global route map
|
|
927
|
-
- Files with `urls()` → `*.gen.ts` with per-module route names, params, and search types
|
|
928
|
-
|
|
929
|
-
## Type Safety
|
|
930
|
-
|
|
931
|
-
The Vite plugin automatically generates a `router.named-routes.gen.ts` file that globally registers route names, patterns, and search schemas via `RSCRouter.GeneratedRouteMap`. This powers server-side named-route typing such as `Handler<"name">`, `ctx.reverse()`, `getRequestContext().reverse()`, and `RouteParams<"name">` without any manual route registration. The gen file is updated on dev server startup, HMR, and production builds.
|
|
932
|
-
|
|
933
|
-
Use the generated map by default. Augment `RSCRouter.RegisteredRoutes` only when you need the richer `typeof router.routeMap` shape globally, especially for response-aware and path-based utilities.
|
|
934
|
-
|
|
935
|
-
```typescript
|
|
936
439
|
// router.tsx
|
|
937
440
|
const router = createRouter<AppBindings>({}).routes(urlpatterns);
|
|
938
441
|
|
|
442
|
+
// The alias is required: an interface heritage clause cannot take a `typeof`
|
|
443
|
+
// type query directly (TS1109), so extend through a named alias.
|
|
444
|
+
type AppRoutes = typeof router.routeMap;
|
|
445
|
+
|
|
939
446
|
declare global {
|
|
940
|
-
namespace
|
|
447
|
+
namespace Rango {
|
|
941
448
|
interface Env extends AppEnv {}
|
|
942
|
-
interface
|
|
943
|
-
interface RegisteredRoutes extends typeof router.routeMap {}
|
|
449
|
+
interface RegisteredRoutes extends AppRoutes {}
|
|
944
450
|
}
|
|
945
451
|
}
|
|
946
452
|
```
|
|
947
453
|
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
- `GeneratedRouteMap` (auto-generated) — use for server-side named-route typing: `Handler<"name">`, `ctx.reverse()`, `Prerender<"name">`
|
|
951
|
-
- `typeof router.routeMap` — use when you need route entries with response metadata
|
|
952
|
-
- `RegisteredRoutes` (manual augmentation) — use to expose `typeof router.routeMap` globally for `href()`, `PathResponse`, `ValidPaths`, and other path/response-aware utilities
|
|
454
|
+
See the [`/typesafety` skill](./skills/typesafety/SKILL.md) for the full
|
|
455
|
+
surface breakdown.
|
|
953
456
|
|
|
954
|
-
|
|
955
|
-
`ctx.reverse()` by default. If you want type-safe local names for a specific
|
|
956
|
-
module, use `scopedReverse<typeof localPatterns>(ctx.reverse)` or
|
|
957
|
-
`scopedReverse<routes>(ctx.reverse)` with a generated local route type.
|
|
457
|
+
### CLI
|
|
958
458
|
|
|
959
|
-
|
|
459
|
+
Route types are generated by the Vite plugin; the CLI is the manual fallback
|
|
460
|
+
for CI or pre-first-run IDE support:
|
|
960
461
|
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
| `@rangojs/router/cache` | Cache: `CFCacheStore`, `MemorySegmentCacheStore`, `createDocumentCacheMiddleware` |
|
|
966
|
-
| `@rangojs/router/theme` | Theme: `useTheme`, `ThemeProvider`, `ThemeScript` |
|
|
967
|
-
| `@rangojs/router/host` | Host routing: `createHostRouter`, `defineHosts` |
|
|
968
|
-
| `@rangojs/router/vite` | Vite plugin: `rango()` |
|
|
969
|
-
| `@rangojs/router/rsc` | Advanced server pipeline APIs: `createRSCHandler`, request-context access |
|
|
970
|
-
| `@rangojs/router/ssr` | Advanced SSR bridge APIs: `createSSRHandler` |
|
|
971
|
-
| `@rangojs/router/server` | Internal build/runtime utilities for advanced integrations |
|
|
972
|
-
| `@rangojs/router/build` | Build utilities |
|
|
462
|
+
```bash
|
|
463
|
+
npx rango generate src/router.tsx # global named-route map
|
|
464
|
+
npx rango generate src/ # recursive scan
|
|
465
|
+
```
|
|
973
466
|
|
|
974
|
-
|
|
975
|
-
or components, import from `@rangojs/router/client`; if you need cache or host
|
|
976
|
-
APIs, use their dedicated subpaths.
|
|
467
|
+
### Examples
|
|
977
468
|
|
|
978
|
-
|
|
469
|
+
- [`e2e/mini`](https://github.com/ivogt/vite-rsc/tree/main/packages/rangojs-router/e2e/mini) — single-file demo app
|
|
470
|
+
- [`cloudflare-basic`](https://github.com/ivogt/vite-rsc/tree/main/tests/cloudflare-basic) — Cloudflare Workers with caching, loaders, theme, and pre-rendering
|
|
471
|
+
- [`cloudflare-multi-router`](https://github.com/ivogt/vite-rsc/tree/main/examples/cloudflare-multi-router) — multi-app host routing
|
|
472
|
+
- [`vercel-basic`](https://github.com/ivogt/vite-rsc/tree/main/examples/vercel-basic) — Vercel deployment with `preset: "vercel"`, `VercelCacheStore`, and OTel tracing
|
|
473
|
+
- [`vercel-multi-router`](https://github.com/ivogt/vite-rsc/tree/main/examples/vercel-multi-router) — multi-app host routing on Vercel (single function, routed by Host header)
|
|
979
474
|
|
|
980
|
-
|
|
475
|
+
### Going deeper
|
|
981
476
|
|
|
982
|
-
- [
|
|
983
|
-
- [
|
|
477
|
+
- [Why Rango](https://github.com/ivogt/vite-rsc/blob/main/packages/rangojs-router/docs/why-rango.md) — the design rationale, claim by claim
|
|
478
|
+
- [Framework comparison](./skills/comparison/references/framework-comparison.md) — Rango vs Next.js App Router, TanStack Start, and Waku, capability by capability
|
|
479
|
+
- [Docs index](https://github.com/ivogt/vite-rsc/blob/main/packages/rangojs-router/docs/README.md) — architecture, caching, prerender, testing
|
|
480
|
+
- [Execution model](https://github.com/ivogt/vite-rsc/blob/main/packages/rangojs-router/docs/internal/execution-model.md) — the runtime contract
|
|
984
481
|
|
|
985
482
|
## License
|
|
986
483
|
|