@rangojs/router 0.0.0-experimental.ea6d5eec → 0.0.0-experimental.ea9f40f2
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 +303 -741
- package/dist/__internal.d.ts +83 -0
- package/dist/__internal.d.ts.map +1 -0
- package/dist/__internal.js +19 -0
- package/dist/__internal.js.map +1 -0
- package/dist/__mocks__/version.d.ts +7 -0
- package/dist/__mocks__/version.d.ts.map +1 -0
- package/dist/__mocks__/version.js +7 -0
- package/dist/__mocks__/version.js.map +1 -0
- package/dist/__tests__/client-href.test.d.ts +2 -0
- package/dist/__tests__/client-href.test.d.ts.map +1 -0
- package/dist/__tests__/client-href.test.js +74 -0
- package/dist/__tests__/client-href.test.js.map +1 -0
- package/dist/__tests__/component-utils.test.d.ts +2 -0
- package/dist/__tests__/component-utils.test.d.ts.map +1 -0
- package/dist/__tests__/component-utils.test.js +51 -0
- package/dist/__tests__/component-utils.test.js.map +1 -0
- package/dist/__tests__/event-controller.test.d.ts +2 -0
- package/dist/__tests__/event-controller.test.d.ts.map +1 -0
- package/dist/__tests__/event-controller.test.js +538 -0
- package/dist/__tests__/event-controller.test.js.map +1 -0
- package/dist/__tests__/helpers/route-tree.d.ts +118 -0
- package/dist/__tests__/helpers/route-tree.d.ts.map +1 -0
- package/dist/__tests__/helpers/route-tree.js +374 -0
- package/dist/__tests__/helpers/route-tree.js.map +1 -0
- package/dist/__tests__/match-result.test.d.ts +2 -0
- package/dist/__tests__/match-result.test.d.ts.map +1 -0
- package/dist/__tests__/match-result.test.js +154 -0
- package/dist/__tests__/match-result.test.js.map +1 -0
- package/dist/__tests__/navigation-store.test.d.ts +2 -0
- package/dist/__tests__/navigation-store.test.d.ts.map +1 -0
- package/dist/__tests__/navigation-store.test.js +440 -0
- package/dist/__tests__/navigation-store.test.js.map +1 -0
- package/dist/__tests__/partial-update.test.d.ts +2 -0
- package/dist/__tests__/partial-update.test.d.ts.map +1 -0
- package/dist/__tests__/partial-update.test.js +1009 -0
- package/dist/__tests__/partial-update.test.js.map +1 -0
- package/dist/__tests__/reverse-types.test.d.ts +8 -0
- package/dist/__tests__/reverse-types.test.d.ts.map +1 -0
- package/dist/__tests__/reverse-types.test.js +656 -0
- package/dist/__tests__/reverse-types.test.js.map +1 -0
- package/dist/__tests__/route-definition.test.d.ts +2 -0
- package/dist/__tests__/route-definition.test.d.ts.map +1 -0
- package/dist/__tests__/route-definition.test.js +55 -0
- package/dist/__tests__/route-definition.test.js.map +1 -0
- package/dist/__tests__/router-helpers.test.d.ts +2 -0
- package/dist/__tests__/router-helpers.test.d.ts.map +1 -0
- package/dist/__tests__/router-helpers.test.js +377 -0
- package/dist/__tests__/router-helpers.test.js.map +1 -0
- package/dist/__tests__/router-integration-2.test.d.ts +2 -0
- package/dist/__tests__/router-integration-2.test.d.ts.map +1 -0
- package/dist/__tests__/router-integration-2.test.js +426 -0
- package/dist/__tests__/router-integration-2.test.js.map +1 -0
- package/dist/__tests__/router-integration.test.d.ts +2 -0
- package/dist/__tests__/router-integration.test.d.ts.map +1 -0
- package/dist/__tests__/router-integration.test.js +1051 -0
- package/dist/__tests__/router-integration.test.js.map +1 -0
- package/dist/__tests__/search-params.test.d.ts +5 -0
- package/dist/__tests__/search-params.test.d.ts.map +1 -0
- package/dist/__tests__/search-params.test.js +306 -0
- package/dist/__tests__/search-params.test.js.map +1 -0
- package/dist/__tests__/segment-system.test.d.ts +2 -0
- package/dist/__tests__/segment-system.test.d.ts.map +1 -0
- package/dist/__tests__/segment-system.test.js +627 -0
- package/dist/__tests__/segment-system.test.js.map +1 -0
- package/dist/__tests__/static-handler-types.test.d.ts +8 -0
- package/dist/__tests__/static-handler-types.test.d.ts.map +1 -0
- package/dist/__tests__/static-handler-types.test.js +63 -0
- package/dist/__tests__/static-handler-types.test.js.map +1 -0
- package/dist/__tests__/urls.test.d.ts +2 -0
- package/dist/__tests__/urls.test.d.ts.map +1 -0
- package/dist/__tests__/urls.test.js +421 -0
- package/dist/__tests__/urls.test.js.map +1 -0
- package/dist/__tests__/use-mount.test.d.ts +2 -0
- package/dist/__tests__/use-mount.test.d.ts.map +1 -0
- package/dist/__tests__/use-mount.test.js +35 -0
- package/dist/__tests__/use-mount.test.js.map +1 -0
- package/dist/bin/rango.d.ts +2 -0
- package/dist/bin/rango.d.ts.map +1 -0
- package/dist/bin/rango.js +724 -183
- package/dist/bin/rango.js.map +1 -0
- package/dist/browser/event-controller.d.ts +191 -0
- package/dist/browser/event-controller.d.ts.map +1 -0
- package/dist/browser/event-controller.js +559 -0
- package/dist/browser/event-controller.js.map +1 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +14 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/link-interceptor.d.ts +38 -0
- package/dist/browser/link-interceptor.d.ts.map +1 -0
- package/dist/browser/link-interceptor.js +99 -0
- package/dist/browser/link-interceptor.js.map +1 -0
- package/dist/browser/logging.d.ts +10 -0
- package/dist/browser/logging.d.ts.map +1 -0
- package/dist/browser/logging.js +29 -0
- package/dist/browser/logging.js.map +1 -0
- package/dist/browser/lru-cache.d.ts +17 -0
- package/dist/browser/lru-cache.d.ts.map +1 -0
- package/dist/browser/lru-cache.js +50 -0
- package/dist/browser/lru-cache.js.map +1 -0
- package/dist/browser/merge-segment-loaders.d.ts +39 -0
- package/dist/browser/merge-segment-loaders.d.ts.map +1 -0
- package/dist/browser/merge-segment-loaders.js +102 -0
- package/dist/browser/merge-segment-loaders.js.map +1 -0
- package/dist/browser/navigation-bridge.d.ts +102 -0
- package/dist/browser/navigation-bridge.d.ts.map +1 -0
- package/dist/browser/navigation-bridge.js +708 -0
- package/dist/browser/navigation-bridge.js.map +1 -0
- package/dist/browser/navigation-client.d.ts +25 -0
- package/dist/browser/navigation-client.d.ts.map +1 -0
- package/dist/browser/navigation-client.js +157 -0
- package/dist/browser/navigation-client.js.map +1 -0
- package/dist/browser/navigation-store.d.ts +101 -0
- package/dist/browser/navigation-store.d.ts.map +1 -0
- package/dist/browser/navigation-store.js +625 -0
- package/dist/browser/navigation-store.js.map +1 -0
- package/dist/browser/partial-update.d.ts +75 -0
- package/dist/browser/partial-update.d.ts.map +1 -0
- package/dist/browser/partial-update.js +426 -0
- package/dist/browser/partial-update.js.map +1 -0
- package/dist/browser/react/Link.d.ts +86 -0
- package/dist/browser/react/Link.d.ts.map +1 -0
- package/dist/browser/react/Link.js +128 -0
- package/dist/browser/react/Link.js.map +1 -0
- package/dist/browser/react/NavigationProvider.d.ts +63 -0
- package/dist/browser/react/NavigationProvider.d.ts.map +1 -0
- package/dist/browser/react/NavigationProvider.js +216 -0
- package/dist/browser/react/NavigationProvider.js.map +1 -0
- package/dist/browser/react/ScrollRestoration.d.ts +75 -0
- package/dist/browser/react/ScrollRestoration.d.ts.map +1 -0
- package/dist/browser/react/ScrollRestoration.js +57 -0
- package/dist/browser/react/ScrollRestoration.js.map +1 -0
- package/dist/browser/react/context.d.ts +46 -0
- package/dist/browser/react/context.d.ts.map +1 -0
- package/dist/browser/react/context.js +10 -0
- package/dist/browser/react/context.js.map +1 -0
- package/dist/browser/react/index.d.ts +11 -0
- package/dist/browser/react/index.d.ts.map +1 -0
- package/dist/browser/react/index.js +22 -0
- package/dist/browser/react/index.js.map +1 -0
- package/dist/browser/react/location-state-shared.d.ts +63 -0
- package/dist/browser/react/location-state-shared.d.ts.map +1 -0
- package/dist/browser/react/location-state-shared.js +81 -0
- package/dist/browser/react/location-state-shared.js.map +1 -0
- package/dist/browser/react/location-state.d.ts +23 -0
- package/dist/browser/react/location-state.d.ts.map +1 -0
- package/dist/browser/react/location-state.js +29 -0
- package/dist/browser/react/location-state.js.map +1 -0
- package/dist/browser/react/mount-context.d.ts +24 -0
- package/dist/browser/react/mount-context.d.ts.map +1 -0
- package/dist/browser/react/mount-context.js +24 -0
- package/dist/browser/react/mount-context.js.map +1 -0
- package/dist/browser/react/use-action.d.ts +64 -0
- package/dist/browser/react/use-action.d.ts.map +1 -0
- package/dist/browser/react/use-action.js +134 -0
- package/dist/browser/react/use-action.js.map +1 -0
- package/dist/browser/react/use-client-cache.d.ts +41 -0
- package/dist/browser/react/use-client-cache.d.ts.map +1 -0
- package/{src/browser/react/use-client-cache.ts → dist/browser/react/use-client-cache.js} +9 -28
- package/dist/browser/react/use-client-cache.js.map +1 -0
- package/dist/browser/react/use-handle.d.ts +31 -0
- package/dist/browser/react/use-handle.d.ts.map +1 -0
- package/dist/browser/react/use-handle.js +144 -0
- package/dist/browser/react/use-handle.js.map +1 -0
- package/dist/browser/react/use-href.d.ts +33 -0
- package/dist/browser/react/use-href.d.ts.map +1 -0
- package/dist/browser/react/use-href.js +39 -0
- package/dist/browser/react/use-href.js.map +1 -0
- package/dist/browser/react/use-link-status.d.ts +37 -0
- package/dist/browser/react/use-link-status.d.ts.map +1 -0
- package/dist/browser/react/use-link-status.js +99 -0
- package/dist/browser/react/use-link-status.js.map +1 -0
- package/dist/browser/react/use-mount.d.ts +25 -0
- package/dist/browser/react/use-mount.d.ts.map +1 -0
- package/dist/browser/react/use-mount.js +30 -0
- package/dist/browser/react/use-mount.js.map +1 -0
- package/dist/browser/react/use-navigation.d.ts +27 -0
- package/dist/browser/react/use-navigation.d.ts.map +1 -0
- package/dist/browser/react/use-navigation.js +87 -0
- package/dist/browser/react/use-navigation.js.map +1 -0
- package/dist/browser/react/use-segments.d.ts +38 -0
- package/dist/browser/react/use-segments.d.ts.map +1 -0
- package/dist/browser/react/use-segments.js +130 -0
- package/dist/browser/react/use-segments.js.map +1 -0
- package/dist/browser/request-controller.d.ts +26 -0
- package/dist/browser/request-controller.d.ts.map +1 -0
- package/dist/browser/request-controller.js +147 -0
- package/dist/browser/request-controller.js.map +1 -0
- package/dist/browser/rsc-router.d.ts +129 -0
- package/dist/browser/rsc-router.d.ts.map +1 -0
- package/dist/browser/rsc-router.js +195 -0
- package/dist/browser/rsc-router.js.map +1 -0
- package/dist/browser/scroll-restoration.d.ts +93 -0
- package/dist/browser/scroll-restoration.d.ts.map +1 -0
- package/dist/browser/scroll-restoration.js +321 -0
- package/dist/browser/scroll-restoration.js.map +1 -0
- package/dist/browser/segment-structure-assert.d.ts +17 -0
- package/dist/browser/segment-structure-assert.d.ts.map +1 -0
- package/dist/browser/segment-structure-assert.js +59 -0
- package/dist/browser/segment-structure-assert.js.map +1 -0
- package/dist/browser/server-action-bridge.d.ts +26 -0
- package/dist/browser/server-action-bridge.d.ts.map +1 -0
- package/dist/browser/server-action-bridge.js +668 -0
- package/dist/browser/server-action-bridge.js.map +1 -0
- package/dist/browser/shallow.d.ts +12 -0
- package/dist/browser/shallow.d.ts.map +1 -0
- package/dist/browser/shallow.js +34 -0
- package/dist/browser/shallow.js.map +1 -0
- package/dist/browser/types.d.ts +369 -0
- package/dist/browser/types.d.ts.map +1 -0
- package/dist/browser/types.js +2 -0
- package/dist/browser/types.js.map +1 -0
- package/dist/build/__tests__/generate-cli.test.d.ts +2 -0
- package/dist/build/__tests__/generate-cli.test.d.ts.map +1 -0
- package/dist/build/__tests__/generate-cli.test.js +237 -0
- package/dist/build/__tests__/generate-cli.test.js.map +1 -0
- package/dist/build/__tests__/generate-manifest.test.d.ts +2 -0
- package/dist/build/__tests__/generate-manifest.test.d.ts.map +1 -0
- package/dist/build/__tests__/generate-manifest.test.js +119 -0
- package/dist/build/__tests__/generate-manifest.test.js.map +1 -0
- package/dist/build/__tests__/generate-route-types.test.d.ts +2 -0
- package/dist/build/__tests__/generate-route-types.test.d.ts.map +1 -0
- package/dist/build/__tests__/generate-route-types.test.js +620 -0
- package/dist/build/__tests__/generate-route-types.test.js.map +1 -0
- package/dist/build/__tests__/per-router-manifest.test.d.ts +2 -0
- package/dist/build/__tests__/per-router-manifest.test.d.ts.map +1 -0
- package/dist/build/__tests__/per-router-manifest.test.js +308 -0
- package/dist/build/__tests__/per-router-manifest.test.js.map +1 -0
- package/dist/build/generate-manifest.d.ts +81 -0
- package/dist/build/generate-manifest.d.ts.map +1 -0
- package/dist/build/generate-manifest.js +276 -0
- package/dist/build/generate-manifest.js.map +1 -0
- package/dist/build/generate-route-types.d.ts +115 -0
- package/dist/build/generate-route-types.d.ts.map +1 -0
- package/dist/build/generate-route-types.js +740 -0
- package/dist/build/generate-route-types.js.map +1 -0
- package/dist/build/index.d.ts +21 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +21 -0
- package/dist/build/index.js.map +1 -0
- package/dist/build/route-trie.d.ts +71 -0
- package/dist/build/route-trie.d.ts.map +1 -0
- package/dist/build/route-trie.js +175 -0
- package/dist/build/route-trie.js.map +1 -0
- package/dist/cache/__tests__/cache-scope.test.d.ts +2 -0
- package/dist/cache/__tests__/cache-scope.test.d.ts.map +1 -0
- package/dist/cache/__tests__/cache-scope.test.js +208 -0
- package/dist/cache/__tests__/cache-scope.test.js.map +1 -0
- package/dist/cache/__tests__/document-cache.test.d.ts +2 -0
- package/dist/cache/__tests__/document-cache.test.d.ts.map +1 -0
- package/dist/cache/__tests__/document-cache.test.js +345 -0
- package/dist/cache/__tests__/document-cache.test.js.map +1 -0
- package/dist/cache/__tests__/memory-segment-store.test.d.ts +2 -0
- package/dist/cache/__tests__/memory-segment-store.test.d.ts.map +1 -0
- package/dist/cache/__tests__/memory-segment-store.test.js +425 -0
- package/dist/cache/__tests__/memory-segment-store.test.js.map +1 -0
- package/dist/cache/__tests__/memory-store.test.d.ts +2 -0
- package/dist/cache/__tests__/memory-store.test.d.ts.map +1 -0
- package/dist/cache/__tests__/memory-store.test.js +367 -0
- package/dist/cache/__tests__/memory-store.test.js.map +1 -0
- package/dist/cache/cache-scope.d.ts +102 -0
- package/dist/cache/cache-scope.d.ts.map +1 -0
- package/dist/cache/cache-scope.js +440 -0
- package/dist/cache/cache-scope.js.map +1 -0
- package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts +2 -0
- package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts.map +1 -0
- package/dist/cache/cf/__tests__/cf-cache-store.test.js +330 -0
- package/dist/cache/cf/__tests__/cf-cache-store.test.js.map +1 -0
- package/dist/cache/cf/cf-cache-store.d.ts +165 -0
- package/dist/cache/cf/cf-cache-store.d.ts.map +1 -0
- package/dist/cache/cf/cf-cache-store.js +242 -0
- package/dist/cache/cf/cf-cache-store.js.map +1 -0
- package/dist/cache/cf/index.d.ts +14 -0
- package/dist/cache/cf/index.d.ts.map +1 -0
- package/dist/cache/cf/index.js +17 -0
- package/dist/cache/cf/index.js.map +1 -0
- package/dist/cache/document-cache.d.ts +64 -0
- package/dist/cache/document-cache.d.ts.map +1 -0
- package/dist/cache/document-cache.js +228 -0
- package/dist/cache/document-cache.js.map +1 -0
- package/dist/cache/index.d.ts +19 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +21 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/memory-segment-store.d.ts +110 -0
- package/dist/cache/memory-segment-store.d.ts.map +1 -0
- package/dist/cache/memory-segment-store.js +117 -0
- package/dist/cache/memory-segment-store.js.map +1 -0
- package/dist/cache/memory-store.d.ts +41 -0
- package/dist/cache/memory-store.d.ts.map +1 -0
- package/dist/cache/memory-store.js +191 -0
- package/dist/cache/memory-store.js.map +1 -0
- package/dist/cache/types.d.ts +317 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cache/types.js +12 -0
- package/dist/cache/types.js.map +1 -0
- package/dist/client.d.ts +248 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +367 -0
- package/dist/client.js.map +1 -0
- package/dist/client.rsc.d.ts +26 -0
- package/dist/client.rsc.d.ts.map +1 -0
- package/dist/client.rsc.js +46 -0
- package/dist/client.rsc.js.map +1 -0
- package/dist/component-utils.d.ts +36 -0
- package/dist/component-utils.d.ts.map +1 -0
- package/dist/component-utils.js +61 -0
- package/dist/component-utils.js.map +1 -0
- package/dist/components/DefaultDocument.d.ts +13 -0
- package/dist/components/DefaultDocument.d.ts.map +1 -0
- package/dist/components/DefaultDocument.js +15 -0
- package/dist/components/DefaultDocument.js.map +1 -0
- package/dist/debug.d.ts +58 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +157 -0
- package/dist/debug.js.map +1 -0
- package/dist/default-error-boundary.d.ts +11 -0
- package/dist/default-error-boundary.d.ts.map +1 -0
- package/dist/default-error-boundary.js +45 -0
- package/dist/default-error-boundary.js.map +1 -0
- package/dist/deps/browser.d.ts +2 -0
- package/dist/deps/browser.d.ts.map +1 -0
- package/dist/deps/browser.js +3 -0
- package/dist/deps/browser.js.map +1 -0
- package/dist/deps/html-stream-client.d.ts +2 -0
- package/dist/deps/html-stream-client.d.ts.map +1 -0
- package/dist/deps/html-stream-client.js +3 -0
- package/dist/deps/html-stream-client.js.map +1 -0
- package/dist/deps/html-stream-server.d.ts +2 -0
- package/dist/deps/html-stream-server.d.ts.map +1 -0
- package/dist/deps/html-stream-server.js +3 -0
- package/dist/deps/html-stream-server.js.map +1 -0
- package/dist/deps/rsc.d.ts +2 -0
- package/dist/deps/rsc.d.ts.map +1 -0
- package/dist/deps/rsc.js +4 -0
- package/dist/deps/rsc.js.map +1 -0
- package/dist/deps/ssr.d.ts +2 -0
- package/dist/deps/ssr.d.ts.map +1 -0
- package/dist/deps/ssr.js +3 -0
- package/dist/deps/ssr.js.map +1 -0
- package/dist/errors.d.ts +174 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +241 -0
- package/dist/errors.js.map +1 -0
- package/dist/handle.d.ts +78 -0
- package/dist/handle.d.ts.map +1 -0
- package/dist/handle.js +82 -0
- package/dist/handle.js.map +1 -0
- package/dist/handles/MetaTags.d.ts +14 -0
- package/dist/handles/MetaTags.d.ts.map +1 -0
- package/dist/handles/MetaTags.js +136 -0
- package/dist/handles/MetaTags.js.map +1 -0
- package/{src/handles/index.ts → dist/handles/index.d.ts} +1 -2
- package/dist/handles/index.d.ts.map +1 -0
- package/dist/handles/index.js +6 -0
- package/dist/handles/index.js.map +1 -0
- package/dist/handles/meta.d.ts +39 -0
- package/dist/handles/meta.d.ts.map +1 -0
- package/dist/handles/meta.js +202 -0
- package/dist/handles/meta.js.map +1 -0
- package/dist/host/__tests__/errors.test.d.ts +2 -0
- package/dist/host/__tests__/errors.test.d.ts.map +1 -0
- package/dist/host/__tests__/errors.test.js +76 -0
- package/dist/host/__tests__/errors.test.js.map +1 -0
- package/dist/host/__tests__/pattern-comprehensive.test.d.ts +2 -0
- package/dist/host/__tests__/pattern-comprehensive.test.d.ts.map +1 -0
- package/dist/host/__tests__/pattern-comprehensive.test.js +732 -0
- package/dist/host/__tests__/pattern-comprehensive.test.js.map +1 -0
- package/dist/host/__tests__/pattern-matcher.test.d.ts +2 -0
- package/dist/host/__tests__/pattern-matcher.test.d.ts.map +1 -0
- package/dist/host/__tests__/pattern-matcher.test.js +251 -0
- package/dist/host/__tests__/pattern-matcher.test.js.map +1 -0
- package/dist/host/__tests__/router.test.d.ts +2 -0
- package/dist/host/__tests__/router.test.d.ts.map +1 -0
- package/dist/host/__tests__/router.test.js +241 -0
- package/dist/host/__tests__/router.test.js.map +1 -0
- package/dist/host/__tests__/testing.test.d.ts +2 -0
- package/dist/host/__tests__/testing.test.d.ts.map +1 -0
- package/dist/host/__tests__/testing.test.js +64 -0
- package/dist/host/__tests__/testing.test.js.map +1 -0
- package/dist/host/__tests__/utils.test.d.ts +2 -0
- package/dist/host/__tests__/utils.test.d.ts.map +1 -0
- package/dist/host/__tests__/utils.test.js +29 -0
- package/dist/host/__tests__/utils.test.js.map +1 -0
- package/dist/host/cookie-handler.d.ts +34 -0
- package/dist/host/cookie-handler.d.ts.map +1 -0
- package/dist/host/cookie-handler.js +124 -0
- package/dist/host/cookie-handler.js.map +1 -0
- package/dist/host/errors.d.ts +56 -0
- package/dist/host/errors.d.ts.map +1 -0
- package/dist/host/errors.js +79 -0
- package/dist/host/errors.js.map +1 -0
- package/dist/host/index.d.ts +29 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +32 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/pattern-matcher.d.ts +36 -0
- package/dist/host/pattern-matcher.d.ts.map +1 -0
- package/dist/host/pattern-matcher.js +172 -0
- package/dist/host/pattern-matcher.js.map +1 -0
- package/dist/host/router.d.ts +26 -0
- package/dist/host/router.d.ts.map +1 -0
- package/dist/host/router.js +218 -0
- package/dist/host/router.js.map +1 -0
- package/dist/host/testing.d.ts +36 -0
- package/dist/host/testing.d.ts.map +1 -0
- package/dist/host/testing.js +55 -0
- package/dist/host/testing.js.map +1 -0
- package/dist/host/types.d.ts +115 -0
- package/dist/host/types.d.ts.map +1 -0
- package/dist/host/types.js +7 -0
- package/dist/host/types.js.map +1 -0
- package/dist/host/utils.d.ts +21 -0
- package/dist/host/utils.d.ts.map +1 -0
- package/dist/host/utils.js +23 -0
- package/dist/host/utils.js.map +1 -0
- package/dist/href-client.d.ts +131 -0
- package/dist/href-client.d.ts.map +1 -0
- package/dist/href-client.js +64 -0
- package/dist/href-client.js.map +1 -0
- package/dist/href-context.d.ts +29 -0
- package/dist/href-context.d.ts.map +1 -0
- package/dist/href-context.js +21 -0
- package/dist/href-context.js.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -0
- package/dist/index.rsc.d.ts +32 -0
- package/dist/index.rsc.d.ts.map +1 -0
- package/dist/index.rsc.js +40 -0
- package/dist/index.rsc.js.map +1 -0
- package/dist/internal-debug.d.ts +2 -0
- package/dist/internal-debug.d.ts.map +1 -0
- package/dist/internal-debug.js +5 -0
- package/dist/internal-debug.js.map +1 -0
- package/dist/loader.d.ts +14 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +20 -0
- package/dist/loader.js.map +1 -0
- package/dist/loader.rsc.d.ts +19 -0
- package/dist/loader.rsc.d.ts.map +1 -0
- package/dist/loader.rsc.js +99 -0
- package/dist/loader.rsc.js.map +1 -0
- package/{src/network-error-thrower.tsx → dist/network-error-thrower.d.ts} +4 -10
- package/dist/network-error-thrower.d.ts.map +1 -0
- package/dist/network-error-thrower.js +14 -0
- package/dist/network-error-thrower.js.map +1 -0
- package/dist/outlet-context.d.ts +13 -0
- package/dist/outlet-context.d.ts.map +1 -0
- package/dist/outlet-context.js +3 -0
- package/dist/outlet-context.js.map +1 -0
- package/dist/prerender/__tests__/param-hash.test.d.ts +2 -0
- package/dist/prerender/__tests__/param-hash.test.d.ts.map +1 -0
- package/dist/prerender/__tests__/param-hash.test.js +148 -0
- package/dist/prerender/__tests__/param-hash.test.js.map +1 -0
- package/dist/prerender/param-hash.d.ts +16 -0
- package/dist/prerender/param-hash.d.ts.map +1 -0
- package/dist/prerender/param-hash.js +36 -0
- package/dist/prerender/param-hash.js.map +1 -0
- package/dist/prerender/store.d.ts +38 -0
- package/dist/prerender/store.d.ts.map +1 -0
- package/dist/prerender/store.js +61 -0
- package/dist/prerender/store.js.map +1 -0
- package/dist/prerender.d.ts +66 -0
- package/dist/prerender.d.ts.map +1 -0
- package/dist/prerender.js +57 -0
- package/dist/prerender.js.map +1 -0
- package/dist/reverse.d.ts +196 -0
- package/dist/reverse.d.ts.map +1 -0
- package/dist/reverse.js +78 -0
- package/dist/reverse.js.map +1 -0
- package/dist/root-error-boundary.d.ts +33 -0
- package/dist/root-error-boundary.d.ts.map +1 -0
- package/dist/root-error-boundary.js +165 -0
- package/dist/root-error-boundary.js.map +1 -0
- package/dist/route-content-wrapper.d.ts +46 -0
- package/dist/route-content-wrapper.d.ts.map +1 -0
- package/dist/route-content-wrapper.js +77 -0
- package/dist/route-content-wrapper.js.map +1 -0
- package/dist/route-definition.d.ts +421 -0
- package/dist/route-definition.d.ts.map +1 -0
- package/dist/route-definition.js +868 -0
- package/dist/route-definition.js.map +1 -0
- package/dist/route-map-builder.d.ts +155 -0
- package/dist/route-map-builder.d.ts.map +1 -0
- package/dist/route-map-builder.js +237 -0
- package/dist/route-map-builder.js.map +1 -0
- package/dist/route-types.d.ts +165 -0
- package/dist/route-types.d.ts.map +1 -0
- package/dist/route-types.js +7 -0
- package/dist/route-types.js.map +1 -0
- package/dist/router/__tests__/handler-context.test.d.ts +2 -0
- package/dist/router/__tests__/handler-context.test.d.ts.map +1 -0
- package/dist/router/__tests__/handler-context.test.js +65 -0
- package/dist/router/__tests__/handler-context.test.js.map +1 -0
- package/dist/router/__tests__/loader-cycle-detection.test.d.ts +2 -0
- package/dist/router/__tests__/loader-cycle-detection.test.d.ts.map +1 -0
- package/dist/router/__tests__/loader-cycle-detection.test.js +221 -0
- package/dist/router/__tests__/loader-cycle-detection.test.js.map +1 -0
- package/dist/router/__tests__/match-context.test.d.ts +2 -0
- package/dist/router/__tests__/match-context.test.d.ts.map +1 -0
- package/dist/router/__tests__/match-context.test.js +92 -0
- package/dist/router/__tests__/match-context.test.js.map +1 -0
- package/dist/router/__tests__/match-pipelines.test.d.ts +2 -0
- package/dist/router/__tests__/match-pipelines.test.d.ts.map +1 -0
- package/dist/router/__tests__/match-pipelines.test.js +417 -0
- package/dist/router/__tests__/match-pipelines.test.js.map +1 -0
- package/dist/router/__tests__/match-result.test.d.ts +2 -0
- package/dist/router/__tests__/match-result.test.d.ts.map +1 -0
- package/dist/router/__tests__/match-result.test.js +457 -0
- package/dist/router/__tests__/match-result.test.js.map +1 -0
- package/dist/router/__tests__/on-error.test.d.ts +2 -0
- package/dist/router/__tests__/on-error.test.d.ts.map +1 -0
- package/dist/router/__tests__/on-error.test.js +678 -0
- package/dist/router/__tests__/on-error.test.js.map +1 -0
- package/dist/router/__tests__/pattern-matching.test.d.ts +2 -0
- package/dist/router/__tests__/pattern-matching.test.d.ts.map +1 -0
- package/dist/router/__tests__/pattern-matching.test.js +629 -0
- package/dist/router/__tests__/pattern-matching.test.js.map +1 -0
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts +2 -0
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts.map +1 -0
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.js +155 -0
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.js.map +1 -0
- package/dist/router/error-handling.d.ts +77 -0
- package/dist/router/error-handling.d.ts.map +1 -0
- package/dist/router/error-handling.js +202 -0
- package/dist/router/error-handling.js.map +1 -0
- package/dist/router/handler-context.d.ts +20 -0
- package/dist/router/handler-context.d.ts.map +1 -0
- package/dist/router/handler-context.js +198 -0
- package/dist/router/handler-context.js.map +1 -0
- package/dist/router/intercept-resolution.d.ts +66 -0
- package/dist/router/intercept-resolution.d.ts.map +1 -0
- package/dist/router/intercept-resolution.js +246 -0
- package/dist/router/intercept-resolution.js.map +1 -0
- package/dist/router/loader-resolution.d.ts +64 -0
- package/dist/router/loader-resolution.d.ts.map +1 -0
- package/dist/router/loader-resolution.js +284 -0
- package/dist/router/loader-resolution.js.map +1 -0
- package/dist/router/logging.d.ts +15 -0
- package/dist/router/logging.d.ts.map +1 -0
- package/dist/router/logging.js +99 -0
- package/dist/router/logging.js.map +1 -0
- package/dist/router/manifest.d.ts +22 -0
- package/dist/router/manifest.d.ts.map +1 -0
- package/dist/router/manifest.js +181 -0
- package/dist/router/manifest.js.map +1 -0
- package/dist/router/match-api.d.ts +35 -0
- package/dist/router/match-api.d.ts.map +1 -0
- package/dist/router/match-api.js +406 -0
- package/dist/router/match-api.js.map +1 -0
- package/dist/router/match-context.d.ts +206 -0
- package/dist/router/match-context.d.ts.map +1 -0
- package/dist/router/match-context.js +17 -0
- package/dist/router/match-context.js.map +1 -0
- package/dist/router/match-middleware/background-revalidation.d.ts +127 -0
- package/dist/router/match-middleware/background-revalidation.d.ts.map +1 -0
- package/dist/router/match-middleware/background-revalidation.js +75 -0
- package/dist/router/match-middleware/background-revalidation.js.map +1 -0
- package/dist/router/match-middleware/cache-lookup.d.ts +112 -0
- package/dist/router/match-middleware/cache-lookup.d.ts.map +1 -0
- package/dist/router/match-middleware/cache-lookup.js +257 -0
- package/dist/router/match-middleware/cache-lookup.js.map +1 -0
- package/dist/router/match-middleware/cache-store.d.ts +113 -0
- package/dist/router/match-middleware/cache-store.d.ts.map +1 -0
- package/dist/router/match-middleware/cache-store.js +108 -0
- package/dist/router/match-middleware/cache-store.js.map +1 -0
- package/dist/router/match-middleware/index.d.ts +81 -0
- package/dist/router/match-middleware/index.d.ts.map +1 -0
- package/dist/router/match-middleware/index.js +80 -0
- package/dist/router/match-middleware/index.js.map +1 -0
- package/dist/router/match-middleware/intercept-resolution.d.ts +117 -0
- package/dist/router/match-middleware/intercept-resolution.d.ts.map +1 -0
- package/dist/router/match-middleware/intercept-resolution.js +134 -0
- package/dist/router/match-middleware/intercept-resolution.js.map +1 -0
- package/dist/router/match-middleware/segment-resolution.d.ts +99 -0
- package/dist/router/match-middleware/segment-resolution.d.ts.map +1 -0
- package/dist/router/match-middleware/segment-resolution.js +53 -0
- package/dist/router/match-middleware/segment-resolution.js.map +1 -0
- package/dist/router/match-pipelines.d.ts +147 -0
- package/dist/router/match-pipelines.d.ts.map +1 -0
- package/dist/router/match-pipelines.js +82 -0
- package/dist/router/match-pipelines.js.map +1 -0
- package/dist/router/match-result.d.ts +126 -0
- package/dist/router/match-result.d.ts.map +1 -0
- package/dist/router/match-result.js +93 -0
- package/dist/router/match-result.js.map +1 -0
- package/dist/router/metrics.d.ts +20 -0
- package/dist/router/metrics.d.ts.map +1 -0
- package/dist/router/metrics.js +47 -0
- package/dist/router/metrics.js.map +1 -0
- package/dist/router/middleware.d.ts +249 -0
- package/dist/router/middleware.d.ts.map +1 -0
- package/dist/router/middleware.js +434 -0
- package/dist/router/middleware.js.map +1 -0
- package/dist/router/middleware.test.d.ts +2 -0
- package/dist/router/middleware.test.d.ts.map +1 -0
- package/dist/router/middleware.test.js +816 -0
- package/dist/router/middleware.test.js.map +1 -0
- package/dist/router/pattern-matching.d.ts +149 -0
- package/dist/router/pattern-matching.d.ts.map +1 -0
- package/dist/router/pattern-matching.js +349 -0
- package/dist/router/pattern-matching.js.map +1 -0
- package/dist/router/revalidation.d.ts +44 -0
- package/dist/router/revalidation.d.ts.map +1 -0
- package/dist/router/revalidation.js +147 -0
- package/dist/router/revalidation.js.map +1 -0
- package/dist/router/router-context.d.ts +135 -0
- package/dist/router/router-context.d.ts.map +1 -0
- package/dist/router/router-context.js +36 -0
- package/dist/router/router-context.js.map +1 -0
- package/dist/router/segment-resolution.d.ts +127 -0
- package/dist/router/segment-resolution.d.ts.map +1 -0
- package/dist/router/segment-resolution.js +919 -0
- package/dist/router/segment-resolution.js.map +1 -0
- package/dist/router/trie-matching.d.ts +40 -0
- package/dist/router/trie-matching.d.ts.map +1 -0
- package/dist/router/trie-matching.js +127 -0
- package/dist/router/trie-matching.js.map +1 -0
- package/dist/router/types.d.ts +136 -0
- package/dist/router/types.d.ts.map +1 -0
- package/dist/router/types.js +7 -0
- package/dist/router/types.js.map +1 -0
- package/dist/router.d.ts +753 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.gen.d.ts +6 -0
- package/dist/router.gen.d.ts.map +1 -0
- package/dist/router.gen.js +6 -0
- package/dist/router.gen.js.map +1 -0
- package/dist/router.js +1304 -0
- package/dist/router.js.map +1 -0
- package/dist/rsc/__tests__/helpers.test.d.ts +2 -0
- package/dist/rsc/__tests__/helpers.test.d.ts.map +1 -0
- package/dist/rsc/__tests__/helpers.test.js +140 -0
- package/dist/rsc/__tests__/helpers.test.js.map +1 -0
- package/dist/rsc/handler.d.ts +45 -0
- package/dist/rsc/handler.d.ts.map +1 -0
- package/dist/rsc/handler.js +1172 -0
- package/dist/rsc/handler.js.map +1 -0
- package/dist/rsc/helpers.d.ts +16 -0
- package/dist/rsc/helpers.d.ts.map +1 -0
- package/dist/rsc/helpers.js +55 -0
- package/dist/rsc/helpers.js.map +1 -0
- package/dist/rsc/index.d.ts +22 -0
- package/dist/rsc/index.d.ts.map +1 -0
- package/dist/rsc/index.js +23 -0
- package/dist/rsc/index.js.map +1 -0
- package/dist/rsc/nonce.d.ts +9 -0
- package/dist/rsc/nonce.d.ts.map +1 -0
- package/dist/rsc/nonce.js +18 -0
- package/dist/rsc/nonce.js.map +1 -0
- package/dist/rsc/types.d.ts +206 -0
- package/dist/rsc/types.d.ts.map +1 -0
- package/dist/rsc/types.js +8 -0
- package/dist/rsc/types.js.map +1 -0
- package/dist/search-params.d.ts +103 -0
- package/dist/search-params.d.ts.map +1 -0
- package/dist/search-params.js +74 -0
- package/dist/search-params.js.map +1 -0
- package/dist/segment-system.d.ts +75 -0
- package/dist/segment-system.d.ts.map +1 -0
- package/dist/segment-system.js +336 -0
- package/dist/segment-system.js.map +1 -0
- package/dist/server/context.d.ts +245 -0
- package/dist/server/context.d.ts.map +1 -0
- package/dist/server/context.js +197 -0
- package/dist/server/context.js.map +1 -0
- package/dist/server/fetchable-loader-store.d.ts +18 -0
- package/dist/server/fetchable-loader-store.d.ts.map +1 -0
- package/dist/server/fetchable-loader-store.js +18 -0
- package/dist/server/fetchable-loader-store.js.map +1 -0
- package/dist/server/handle-store.d.ts +85 -0
- package/dist/server/handle-store.d.ts.map +1 -0
- package/dist/server/handle-store.js +142 -0
- package/dist/server/handle-store.js.map +1 -0
- package/dist/server/loader-registry.d.ts +55 -0
- package/dist/server/loader-registry.d.ts.map +1 -0
- package/dist/server/loader-registry.js +132 -0
- package/dist/server/loader-registry.js.map +1 -0
- package/dist/server/request-context.d.ts +226 -0
- package/dist/server/request-context.d.ts.map +1 -0
- package/dist/server/request-context.js +290 -0
- package/dist/server/request-context.js.map +1 -0
- package/dist/server/root-layout.d.ts +4 -0
- package/dist/server/root-layout.d.ts.map +1 -0
- package/dist/server/root-layout.js +5 -0
- package/dist/server/root-layout.js.map +1 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +20 -0
- package/dist/server.js.map +1 -0
- package/dist/ssr/__tests__/ssr-handler.test.d.ts +2 -0
- package/dist/ssr/__tests__/ssr-handler.test.d.ts.map +1 -0
- package/dist/ssr/__tests__/ssr-handler.test.js +132 -0
- package/dist/ssr/__tests__/ssr-handler.test.js.map +1 -0
- package/dist/ssr/index.d.ts +98 -0
- package/dist/ssr/index.d.ts.map +1 -0
- package/dist/ssr/index.js +158 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/static-handler.d.ts +50 -0
- package/dist/static-handler.d.ts.map +1 -0
- package/dist/static-handler.gen.d.ts +5 -0
- package/dist/static-handler.gen.d.ts.map +1 -0
- package/dist/static-handler.gen.js +5 -0
- package/dist/static-handler.gen.js.map +1 -0
- package/dist/static-handler.js +29 -0
- package/dist/static-handler.js.map +1 -0
- package/dist/testing/vitest.js +82 -0
- package/dist/theme/ThemeProvider.d.ts +20 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.js +240 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/ThemeScript.d.ts +48 -0
- package/dist/theme/ThemeScript.d.ts.map +1 -0
- package/dist/theme/ThemeScript.js +13 -0
- package/dist/theme/ThemeScript.js.map +1 -0
- package/dist/theme/__tests__/theme.test.d.ts +2 -0
- package/dist/theme/__tests__/theme.test.d.ts.map +1 -0
- package/dist/theme/__tests__/theme.test.js +103 -0
- package/dist/theme/__tests__/theme.test.js.map +1 -0
- package/dist/theme/constants.d.ts +29 -0
- package/dist/theme/constants.d.ts.map +1 -0
- package/dist/theme/constants.js +48 -0
- package/dist/theme/constants.js.map +1 -0
- package/dist/theme/index.d.ts +31 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +36 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/theme-context.d.ts +40 -0
- package/dist/theme/theme-context.d.ts.map +1 -0
- package/dist/theme/theme-context.js +60 -0
- package/dist/theme/theme-context.js.map +1 -0
- package/dist/theme/theme-script.d.ts +27 -0
- package/dist/theme/theme-script.d.ts.map +1 -0
- package/dist/theme/theme-script.js +147 -0
- package/dist/theme/theme-script.js.map +1 -0
- package/dist/theme/types.d.ts +163 -0
- package/dist/theme/types.d.ts.map +1 -0
- package/dist/theme/types.js +11 -0
- package/dist/theme/types.js.map +1 -0
- package/dist/theme/use-theme.d.ts +12 -0
- package/dist/theme/use-theme.d.ts.map +1 -0
- package/dist/theme/use-theme.js +40 -0
- package/dist/theme/use-theme.js.map +1 -0
- package/dist/types.d.ts +1479 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/dist/urls.d.ts +441 -0
- package/dist/urls.d.ts.map +1 -0
- package/dist/urls.gen.d.ts +8 -0
- package/dist/urls.gen.d.ts.map +1 -0
- package/dist/urls.gen.js +8 -0
- package/dist/urls.gen.js.map +1 -0
- package/dist/urls.js +443 -0
- package/dist/urls.js.map +1 -0
- package/dist/use-loader.d.ts +127 -0
- package/dist/use-loader.d.ts.map +1 -0
- package/dist/use-loader.js +237 -0
- package/dist/use-loader.js.map +1 -0
- package/dist/vite/__tests__/ast-handler-extract.test.d.ts +2 -0
- package/dist/vite/__tests__/ast-handler-extract.test.d.ts.map +1 -0
- package/dist/vite/__tests__/ast-handler-extract.test.js +294 -0
- package/dist/vite/__tests__/ast-handler-extract.test.js.map +1 -0
- package/dist/vite/__tests__/expose-id-utils.test.d.ts +2 -0
- package/dist/vite/__tests__/expose-id-utils.test.d.ts.map +1 -0
- package/dist/vite/__tests__/expose-id-utils.test.js +224 -0
- package/dist/vite/__tests__/expose-id-utils.test.js.map +1 -0
- package/dist/vite/__tests__/expose-internal-ids.test.d.ts +2 -0
- package/dist/vite/__tests__/expose-internal-ids.test.d.ts.map +1 -0
- package/dist/vite/__tests__/expose-internal-ids.test.js +647 -0
- package/dist/vite/__tests__/expose-internal-ids.test.js.map +1 -0
- package/dist/vite/__tests__/expose-router-id.test.d.ts +2 -0
- package/dist/vite/__tests__/expose-router-id.test.d.ts.map +1 -0
- package/dist/vite/__tests__/expose-router-id.test.js +39 -0
- package/dist/vite/__tests__/expose-router-id.test.js.map +1 -0
- package/dist/vite/ast-handler-extract.d.ts +49 -0
- package/dist/vite/ast-handler-extract.d.ts.map +1 -0
- package/dist/vite/ast-handler-extract.js +249 -0
- package/dist/vite/ast-handler-extract.js.map +1 -0
- package/dist/vite/expose-action-id.d.ts +19 -0
- package/dist/vite/expose-action-id.d.ts.map +1 -0
- package/dist/vite/expose-action-id.js +250 -0
- package/dist/vite/expose-action-id.js.map +1 -0
- package/dist/vite/expose-id-utils.d.ts +69 -0
- package/dist/vite/expose-id-utils.d.ts.map +1 -0
- package/dist/vite/expose-id-utils.js +289 -0
- package/dist/vite/expose-id-utils.js.map +1 -0
- package/dist/vite/expose-internal-ids.d.ts +22 -0
- package/dist/vite/expose-internal-ids.d.ts.map +1 -0
- package/dist/vite/expose-internal-ids.js +886 -0
- package/dist/vite/expose-internal-ids.js.map +1 -0
- package/dist/vite/index.d.ts +149 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +4279 -1209
- package/dist/vite/index.js.bak +5448 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/vite/index.named-routes.gen.ts +103 -0
- package/dist/vite/package-resolution.d.ts +43 -0
- package/dist/vite/package-resolution.d.ts.map +1 -0
- package/dist/vite/package-resolution.js +112 -0
- package/dist/vite/package-resolution.js.map +1 -0
- package/dist/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
- package/dist/vite/virtual-entries.d.ts +25 -0
- package/dist/vite/virtual-entries.d.ts.map +1 -0
- package/dist/vite/virtual-entries.js +110 -0
- package/dist/vite/virtual-entries.js.map +1 -0
- package/package.json +86 -15
- package/skills/api-client/SKILL.md +211 -0
- package/skills/breadcrumbs/SKILL.md +85 -6
- package/skills/bundle-analysis/SKILL.md +159 -0
- package/skills/cache-guide/SKILL.md +251 -24
- package/skills/caching/SKILL.md +338 -13
- package/skills/catalog.json +271 -0
- package/skills/comparison/SKILL.md +50 -0
- package/skills/comparison/agents/openai.yaml +4 -0
- package/skills/comparison/references/framework-comparison.md +837 -0
- package/skills/composability/SKILL.md +110 -4
- package/skills/css/SKILL.md +76 -0
- package/skills/debug-manifest/SKILL.md +5 -3
- package/skills/defer-hydration/SKILL.md +235 -0
- package/skills/document-cache/SKILL.md +87 -56
- package/skills/fonts/SKILL.md +1 -1
- package/skills/handler-use/SKILL.md +364 -0
- package/skills/hooks/SKILL.md +73 -691
- 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 +41 -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 +94 -18
- package/skills/layout/SKILL.md +62 -19
- package/skills/links/SKILL.md +249 -17
- package/skills/loader/SKILL.md +302 -54
- package/skills/middleware/SKILL.md +59 -16
- package/skills/migrate-nextjs/SKILL.md +745 -0
- package/skills/migrate-react-router/SKILL.md +153 -0
- package/skills/migrate-react-router/cloudflare-workers.md +129 -0
- 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 +29 -2
- package/skills/observability/SKILL.md +202 -0
- package/skills/parallel/SKILL.md +225 -10
- package/skills/ppr/SKILL.md +622 -0
- package/skills/prerender/SKILL.md +178 -124
- package/skills/rango/SKILL.md +318 -24
- package/skills/react-compiler/SKILL.md +168 -0
- package/skills/response-routes/SKILL.md +138 -49
- package/skills/route/SKILL.md +172 -9
- package/skills/router-setup/SKILL.md +131 -11
- 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 +283 -0
- package/skills/tailwind/SKILL.md +28 -4
- package/skills/testing/SKILL.md +130 -0
- package/skills/testing/bindings.md +103 -0
- package/skills/testing/cache-prerender.md +127 -0
- package/skills/testing/client-components.md +124 -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 -616
- package/skills/typesafety/env-and-bindings.md +254 -0
- package/skills/typesafety/generated-files-and-cli.md +335 -0
- package/skills/typesafety/params-and-search.md +153 -0
- package/skills/typesafety/route-types.md +209 -0
- package/skills/use-cache/SKILL.md +74 -15
- package/skills/vercel/SKILL.md +128 -0
- package/skills/view-transitions/SKILL.md +337 -0
- package/src/__augment-tests__/augment.ts +81 -0
- package/src/__augment-tests__/augmented.check.ts +116 -0
- package/src/__internal.ts +1 -66
- package/src/browser/action-coordinator.ts +53 -36
- package/src/browser/action-fence.ts +47 -0
- package/src/browser/app-shell.ts +39 -0
- package/src/browser/app-version.ts +14 -0
- package/src/browser/connection-warmup.ts +134 -0
- package/src/browser/cookie-name.ts +140 -0
- package/src/browser/event-controller.ts +257 -158
- 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/logging.ts +28 -0
- package/src/browser/merge-segment-loaders.ts +6 -4
- package/src/browser/navigation-bridge.ts +131 -30
- package/src/browser/navigation-client.ts +202 -105
- package/src/browser/navigation-store-handle.ts +38 -0
- package/src/browser/navigation-store.ts +203 -80
- package/src/browser/navigation-transaction.ts +9 -59
- package/src/browser/network-error-handler.ts +34 -7
- package/src/browser/partial-update.ts +205 -121
- package/src/browser/prefetch/cache.ts +247 -72
- package/src/browser/prefetch/fetch.ts +359 -42
- package/src/browser/prefetch/queue.ts +113 -32
- package/src/browser/prefetch/resource-ready.ts +77 -0
- package/src/browser/rango-state.ts +158 -76
- package/src/browser/react/Link.tsx +112 -15
- package/src/browser/react/NavigationProvider.tsx +213 -122
- package/src/browser/react/ScrollRestoration.tsx +10 -6
- package/src/browser/react/context.ts +7 -2
- 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 +23 -69
- 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 +32 -7
- package/src/browser/react/use-params.ts +20 -10
- package/src/browser/react/use-reverse.ts +106 -0
- package/src/browser/react/use-router.ts +46 -11
- 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 +186 -27
- package/src/browser/scroll-restoration.ts +44 -27
- package/src/browser/segment-reconciler.ts +44 -7
- package/src/browser/segment-structure-assert.ts +2 -2
- package/src/browser/server-action-bridge.ts +244 -71
- package/src/browser/types.ts +127 -12
- package/src/browser/validate-redirect-origin.ts +43 -16
- package/src/build/collect-fallback-refs.ts +107 -0
- package/src/build/generate-manifest.ts +207 -158
- package/src/build/generate-route-types.ts +6 -1
- package/src/build/index.ts +11 -3
- package/src/build/prefix-tree-utils.ts +123 -0
- package/src/build/route-trie.ts +198 -41
- 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 +464 -63
- package/src/build/route-types/param-extraction.ts +6 -3
- package/src/build/route-types/per-module-writer.ts +22 -6
- package/src/build/route-types/router-processing.ts +333 -117
- package/src/build/route-types/scan-filter.ts +9 -2
- package/src/build/route-types/source-scan.ts +216 -0
- package/src/build/runtime-discovery.ts +13 -21
- package/src/cache/cache-error.ts +104 -0
- package/src/cache/cache-key-utils.ts +58 -13
- package/src/cache/cache-policy.ts +108 -34
- package/src/cache/cache-runtime.ts +454 -97
- package/src/cache/cache-scope.ts +233 -101
- 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 +127 -0
- package/src/cache/cf/cf-cache-store.ts +2206 -372
- package/src/cache/cf/cf-cache-types.ts +349 -0
- package/src/cache/cf/cf-kv-utils.ts +46 -0
- package/src/cache/cf/cf-tag-marker-memo.ts +105 -0
- package/src/cache/cf/index.ts +6 -16
- package/src/cache/document-cache.ts +144 -49
- package/src/cache/handle-snapshot.ts +70 -0
- package/src/cache/index.ts +23 -20
- package/src/cache/memory-segment-store.ts +243 -37
- package/src/cache/profile-registry.ts +46 -31
- package/src/cache/read-through-swr.ts +56 -12
- package/src/cache/segment-codec.ts +13 -21
- package/src/cache/shell-snapshot.ts +417 -0
- package/src/cache/tag-invalidation.ts +230 -0
- package/src/cache/taint.ts +55 -0
- package/src/cache/types.ts +194 -99
- package/src/cache/vercel/index.ts +11 -0
- package/src/cache/vercel/vercel-cache-store.ts +1132 -0
- package/src/client.rsc.tsx +41 -21
- package/src/client.tsx +116 -290
- package/src/cloudflare/index.ts +11 -0
- package/src/cloudflare/tracing.ts +108 -0
- package/src/component-utils.ts +19 -0
- package/src/components/DefaultDocument.tsx +8 -2
- package/src/context-var.ts +84 -2
- package/src/debug.ts +2 -2
- package/src/decode-loader-results.ts +52 -0
- package/src/defer.ts +185 -0
- package/src/deps/ssr.ts +0 -1
- package/src/encode-kv.ts +49 -0
- package/src/errors.ts +30 -4
- package/src/escape-script.ts +52 -0
- package/src/handle.ts +104 -34
- 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 +127 -0
- package/src/handles/is-thenable.ts +18 -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 +100 -13
- package/src/index.ts +143 -19
- package/src/internal-debug.ts +11 -10
- 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 +1 -1
- package/src/outlet-provider.tsx +1 -5
- package/src/prerender/param-hash.ts +16 -16
- package/src/prerender/store.ts +37 -41
- package/src/prerender.ts +215 -86
- package/src/redirect-origin.ts +114 -0
- package/src/regex-escape.ts +8 -0
- package/src/render-error-thrower.tsx +20 -0
- package/src/response-utils.ts +62 -0
- package/src/reverse.ts +65 -15
- package/src/root-error-boundary.tsx +1 -19
- package/src/route-content-wrapper.tsx +19 -77
- package/src/route-definition/dsl-helpers.ts +485 -303
- package/src/route-definition/helper-factories.ts +28 -140
- package/src/route-definition/helpers-types.ts +153 -77
- package/src/route-definition/index.ts +4 -2
- package/src/route-definition/redirect.ts +51 -10
- package/src/route-definition/resolve-handler-use.ts +160 -0
- package/src/route-definition/use-item-types.ts +29 -0
- package/src/route-map-builder.ts +41 -20
- package/src/route-types.ts +37 -46
- package/src/router/basename.ts +14 -0
- package/src/router/content-negotiation.ts +164 -17
- package/src/router/error-handling.ts +45 -18
- package/src/router/find-match.ts +129 -30
- package/src/router/handler-context.ts +83 -39
- package/src/router/instrument.ts +355 -0
- package/src/router/intercept-resolution.ts +48 -24
- package/src/router/lazy-includes.ts +87 -63
- package/src/router/loader-resolution.ts +286 -56
- package/src/router/logging.ts +1 -7
- package/src/router/manifest.ts +102 -55
- package/src/router/match-api.ts +178 -218
- package/src/router/match-context.ts +0 -22
- package/src/router/match-handlers.ts +211 -165
- package/src/router/match-middleware/background-revalidation.ts +66 -22
- package/src/router/match-middleware/cache-lookup.ts +214 -263
- package/src/router/match-middleware/cache-store.ts +105 -50
- package/src/router/match-middleware/intercept-resolution.ts +8 -28
- package/src/router/match-middleware/segment-resolution.ts +51 -18
- package/src/router/match-pipelines.ts +1 -42
- package/src/router/match-result.ts +128 -44
- package/src/router/metrics.ts +5 -34
- package/src/router/middleware-types.ts +13 -142
- package/src/router/middleware.ts +300 -177
- package/src/router/navigation-snapshot.ts +133 -0
- package/src/router/params-util.ts +23 -0
- package/src/router/parse-pattern.ts +115 -0
- package/src/router/pattern-matching.ts +181 -150
- package/src/router/prefetch-cache-ttl.ts +51 -0
- package/src/router/prefetch-limits.ts +37 -0
- package/src/router/prerender-match.ts +203 -58
- package/src/router/preview-match.ts +35 -103
- package/src/router/request-classification.ts +291 -0
- package/src/router/revalidation.ts +123 -73
- package/src/router/route-snapshot.ts +256 -0
- package/src/router/router-context.ts +6 -28
- package/src/router/router-interfaces.ts +146 -35
- package/src/router/router-options.ts +202 -15
- package/src/router/router-registry.ts +2 -5
- package/src/router/segment-resolution/fresh.ts +301 -78
- package/src/router/segment-resolution/helpers.ts +115 -30
- package/src/router/segment-resolution/loader-cache.ts +156 -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 +83 -0
- package/src/router/segment-resolution/revalidation.ts +473 -384
- package/src/router/segment-resolution/static-store.ts +19 -5
- package/src/router/segment-resolution/streamed-handler-telemetry.ts +52 -0
- package/src/router/segment-resolution/view-transition-default.ts +56 -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 +160 -200
- package/src/router/telemetry.ts +105 -20
- package/src/router/timeout.ts +0 -20
- package/src/router/tracing.ts +215 -0
- package/src/router/trie-matching.ts +171 -59
- package/src/router/types.ts +10 -63
- package/src/router/url-params.ts +57 -0
- package/src/router.ts +206 -71
- package/src/rsc/full-payload.ts +70 -0
- package/src/rsc/handler-context.ts +3 -2
- package/src/rsc/handler.ts +682 -508
- package/src/rsc/helpers.ts +168 -46
- package/src/rsc/index.ts +2 -5
- package/src/rsc/json-route-result.ts +38 -0
- package/src/rsc/loader-fetch.ts +127 -31
- package/src/rsc/manifest-init.ts +33 -42
- package/src/rsc/nonce.ts +10 -1
- package/src/rsc/origin-guard.ts +39 -25
- package/src/rsc/progressive-enhancement.ts +138 -15
- package/src/rsc/redirect-guard.ts +100 -0
- package/src/rsc/response-cache-serve.ts +238 -0
- package/src/rsc/response-error.ts +79 -12
- package/src/rsc/response-route-handler.ts +99 -189
- package/src/rsc/rsc-rendering.ts +498 -73
- package/src/rsc/runtime-warnings.ts +23 -10
- package/src/rsc/server-action.ts +287 -113
- package/src/rsc/shell-capture.ts +1190 -0
- package/src/rsc/shell-serve.ts +181 -0
- package/src/rsc/ssr-setup.ts +18 -2
- package/src/rsc/transition-gate.ts +89 -0
- package/src/rsc/types.ts +62 -6
- package/src/runtime-env.ts +18 -0
- package/src/search-params.ts +35 -30
- package/src/segment-content-promise.ts +67 -0
- package/src/segment-loader-promise.ts +167 -0
- package/src/segment-system.tsx +418 -131
- package/src/serialize.ts +243 -0
- package/src/server/context.ts +367 -61
- package/src/server/cookie-parse.ts +32 -0
- package/src/server/cookie-store.ts +152 -5
- package/src/server/handle-store.ts +40 -38
- package/src/server/loader-registry.ts +38 -46
- package/src/server/request-context.ts +550 -171
- package/src/ssr/index.tsx +467 -174
- package/src/ssr/inject-rsc-eager.ts +167 -0
- package/src/ssr/ssr-root.tsx +228 -0
- package/src/static-handler.ts +27 -18
- package/src/testing/cache-status.ts +162 -0
- package/src/testing/collect-handle.ts +46 -0
- package/src/testing/dispatch.ts +813 -0
- package/src/testing/dom.entry.ts +22 -0
- package/src/testing/e2e/fixture.ts +188 -0
- package/src/testing/e2e/index.ts +128 -0
- package/src/testing/e2e/matchers.ts +35 -0
- package/src/testing/e2e/page-helpers.ts +272 -0
- package/src/testing/e2e/parity.ts +387 -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 +105 -0
- package/src/testing/internal/context.ts +371 -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 +357 -0
- package/src/testing/render-route.tsx +584 -0
- package/src/testing/run-loader.ts +385 -0
- package/src/testing/run-middleware.ts +205 -0
- package/src/testing/run-transition-when.ts +164 -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 +0 -35
- package/src/types/cache-types.ts +17 -8
- package/src/types/error-types.ts +30 -90
- package/src/types/global-namespace.ts +54 -41
- package/src/types/handler-context.ts +234 -82
- package/src/types/index.ts +3 -10
- package/src/types/loader-types.ts +44 -15
- package/src/types/request-scope.ts +112 -0
- package/src/types/route-config.ts +20 -52
- package/src/types/route-entry.ts +12 -7
- package/src/types/segments.ts +137 -14
- package/src/urls/include-helper.ts +40 -75
- package/src/urls/include-provider.ts +71 -0
- package/src/urls/index.ts +2 -11
- package/src/urls/path-helper-types.ts +102 -23
- package/src/urls/path-helper.ts +62 -111
- package/src/urls/pattern-types.ts +84 -19
- package/src/urls/response-types.ts +25 -22
- package/src/urls/type-extraction.ts +98 -154
- package/src/urls/urls-function.ts +1 -19
- package/src/use-loader.tsx +346 -89
- package/src/vercel/index.ts +11 -0
- package/src/vercel/tracing.ts +88 -0
- package/src/vite/debug.ts +185 -0
- package/src/vite/discovery/bundle-postprocess.ts +36 -38
- package/src/vite/discovery/dev-prerender-cache.ts +117 -0
- package/src/vite/discovery/discover-routers.ts +130 -85
- 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 +214 -132
- package/src/vite/discovery/route-types-writer.ts +40 -84
- package/src/vite/discovery/self-gen-tracking.ts +27 -1
- package/src/vite/discovery/state.ts +57 -4
- package/src/vite/discovery/virtual-module-codegen.ts +14 -34
- package/src/vite/index.ts +15 -0
- package/src/vite/inject-client-debug.ts +88 -0
- package/src/vite/plugin-types.ts +261 -6
- 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-loader-hook.d.mts +23 -0
- package/src/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
- package/src/vite/plugins/cloudflare-protocol-stub.ts +194 -0
- package/src/vite/plugins/expose-action-id.ts +48 -95
- package/src/vite/plugins/expose-id-utils.ts +96 -51
- package/src/vite/plugins/expose-ids/export-analysis.ts +101 -34
- package/src/vite/plugins/expose-ids/handler-transform.ts +15 -64
- 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 +553 -317
- package/src/vite/plugins/performance-tracks.ts +89 -0
- package/src/vite/plugins/refresh-cmd.ts +89 -27
- 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 +40 -29
- package/src/vite/plugins/version-plugin.ts +37 -40
- package/src/vite/plugins/virtual-entries.ts +138 -27
- package/src/vite/rango.ts +247 -132
- package/src/vite/router-discovery.ts +1091 -159
- package/src/vite/utils/ast-handler-extract.ts +26 -35
- package/src/vite/utils/banner.ts +4 -4
- 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 +4 -59
- package/src/vite/utils/package-resolution.ts +20 -52
- package/src/vite/utils/prerender-utils.ts +98 -38
- package/src/vite/utils/shared-utils.ts +144 -44
- package/src/browser/action-response-classifier.ts +0 -99
- package/src/browser/shallow.ts +0 -40
- package/src/router/middleware-cookies.ts +0 -55
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Params and Search Types
|
|
2
|
+
|
|
3
|
+
## Typed Search Params
|
|
4
|
+
|
|
5
|
+
Add a `search` schema to `path()` options for type-safe query parameters:
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// Route definition with search schema
|
|
9
|
+
path("/search", SearchPage, {
|
|
10
|
+
name: "search",
|
|
11
|
+
search: { q: "string", page: "number?", sort: "string?" },
|
|
12
|
+
});
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Handler with typed search params
|
|
16
|
+
|
|
17
|
+
`Handler<"name">` automatically resolves route params and search params from the
|
|
18
|
+
global `GeneratedRouteMap` (the gen file). No explicit route map import needed:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// pages/search.tsx
|
|
22
|
+
import type { Handler } from "@rangojs/router";
|
|
23
|
+
|
|
24
|
+
export const SearchPage: Handler<"search"> = (ctx) => {
|
|
25
|
+
// ctx.search is typed: { q: string; page?: number; sort?: string }
|
|
26
|
+
const { q, page, sort } = ctx.search;
|
|
27
|
+
return <SearchResults q={q} page={page} sort={sort} />;
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This avoids circular references because `Handler` defaults to `GeneratedRouteMap`
|
|
32
|
+
(from `router.named-routes.gen.ts`) instead of `RegisteredRoutes` (which depends on `router.tsx`).
|
|
33
|
+
|
|
34
|
+
You can also pass an explicit route map for per-module isolation (opt-in,
|
|
35
|
+
after running `npx rango generate`). With a local map, the route name is
|
|
36
|
+
**dot-prefixed** so params and search resolve from `routes`, not the global map:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import type { Handler } from "@rangojs/router";
|
|
40
|
+
import type { routes } from "./urls.gen.js";
|
|
41
|
+
|
|
42
|
+
export const SearchPage: Handler<".search", routes> = (ctx) => { ... };
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Note the difference: `Handler<"search">` (no dot) resolves against the global
|
|
46
|
+
`GeneratedRouteMap`; `Handler<".search", routes>` resolves against the local
|
|
47
|
+
`routes` map. Mixing them — `Handler<"search", routes>` — silently ignores
|
|
48
|
+
`routes` for param/search inference and only uses it for local `ctx.reverse(".x")`.
|
|
49
|
+
|
|
50
|
+
Supported types: `"string"`, `"number"`, `"boolean"`, with `?` suffix for optional.
|
|
51
|
+
Values are automatically coerced from query string (e.g., `"2"` becomes `2` for numbers).
|
|
52
|
+
Routes without a `search` schema keep the standard `URLSearchParams` behavior.
|
|
53
|
+
|
|
54
|
+
### RouteSearchParams and RouteParams utility types
|
|
55
|
+
|
|
56
|
+
Extract typed params by route name for use in component props, return types, or anywhere:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import type { RouteSearchParams, RouteParams } from "@rangojs/router";
|
|
60
|
+
|
|
61
|
+
// RouteSearchParams<"name"> resolves the search schema to a typed object
|
|
62
|
+
type SP = RouteSearchParams<"search">;
|
|
63
|
+
// { q: string | undefined; page?: number; sort?: string }
|
|
64
|
+
|
|
65
|
+
// RouteParams<"name"> resolves URL params from the route pattern
|
|
66
|
+
type P = RouteParams<"blogPost">;
|
|
67
|
+
// { slug: string }
|
|
68
|
+
|
|
69
|
+
// Optional URL params (`:slug?`) resolve to `string | undefined`
|
|
70
|
+
// because absent segments are omitted from `ctx.params` at runtime.
|
|
71
|
+
type C = RouteParams<"checkout">;
|
|
72
|
+
// { step?: string }
|
|
73
|
+
// → ctx.params.step is `string | undefined`; use `?? "default"` to coalesce.
|
|
74
|
+
|
|
75
|
+
// Use in component props
|
|
76
|
+
interface SearchResultsProps {
|
|
77
|
+
params: RouteSearchParams<"search">;
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Both default to the global route map (`RegisteredRoutes` or `GeneratedRouteMap`).
|
|
82
|
+
Pass an explicit route map as the second type argument when needed:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import type { routes } from "./urls.gen.js";
|
|
86
|
+
|
|
87
|
+
type SP = RouteSearchParams<"search", routes>;
|
|
88
|
+
type P = RouteParams<"blogPost", routes>;
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Generated route types
|
|
92
|
+
|
|
93
|
+
In the generated `router.named-routes.gen.ts`, routes with search schemas
|
|
94
|
+
use `{ path, search }` objects:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// router.named-routes.gen.ts (auto-generated)
|
|
98
|
+
export const NamedRoutes = {
|
|
99
|
+
"search.index": {
|
|
100
|
+
path: "/search",
|
|
101
|
+
search: { q: "string", page: "number?", sort: "string?" },
|
|
102
|
+
},
|
|
103
|
+
"home.index": "/", // No search schema -> plain string
|
|
104
|
+
} as const;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
You never open a `.gen.ts` by hand. Treat the generated types as call-site
|
|
108
|
+
honesty checks, not modules to read:
|
|
109
|
+
|
|
110
|
+
- **Do not import `router.named-routes.gen.ts` directly**, and don't reach for
|
|
111
|
+
`Rango.GeneratedRouteMap`. It is the whole-app manifest, auto-wired
|
|
112
|
+
globally — `Handler<"name">` and `ctx.reverse("name")` already see it.
|
|
113
|
+
- **Per-module `*.gen.ts` imports are fine** — they are the opt-in local-route
|
|
114
|
+
pattern for `useReverse(routes)` and explicit local handler typing
|
|
115
|
+
(`Handler<".name", routes>`). See `/links`.
|
|
116
|
+
|
|
117
|
+
If a type error points at a generated map instead of your call site, that's a
|
|
118
|
+
smell — fix the call site (or regenerate), never edit the generated file.
|
|
119
|
+
|
|
120
|
+
## Loader Type Safety
|
|
121
|
+
|
|
122
|
+
Loaders have typed return values:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
// loaders/product.ts
|
|
126
|
+
export const ProductLoader = createLoader(async (ctx) => {
|
|
127
|
+
return {
|
|
128
|
+
id: ctx.params.slug,
|
|
129
|
+
name: "Widget",
|
|
130
|
+
price: 99,
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// In server component - type is inferred
|
|
135
|
+
import { useLoader } from "@rangojs/router/client";
|
|
136
|
+
|
|
137
|
+
async function ProductPage() {
|
|
138
|
+
const product = await useLoader(ProductLoader);
|
|
139
|
+
// product: { id: string; name: string; price: number }
|
|
140
|
+
return <h1>{product.name}</h1>;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// In client component - same type
|
|
144
|
+
"use client";
|
|
145
|
+
import { useLoader } from "@rangojs/router/client";
|
|
146
|
+
|
|
147
|
+
function ProductPrice() {
|
|
148
|
+
const { data } = useLoader(ProductLoader);
|
|
149
|
+
// data: { id: string; name: string; price: number }
|
|
150
|
+
const product = data;
|
|
151
|
+
return <span>${product.price}</span>;
|
|
152
|
+
}
|
|
153
|
+
```
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Route Types
|
|
2
|
+
|
|
3
|
+
## Route Definition with Type-Safe Names
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
// urls.tsx
|
|
7
|
+
import { urls } from "@rangojs/router";
|
|
8
|
+
|
|
9
|
+
export const urlpatterns = urls(({ path, layout }) => [
|
|
10
|
+
path("/", HomePage, { name: "home" }),
|
|
11
|
+
path("/products", ProductsPage, { name: "products" }),
|
|
12
|
+
path("/product/:slug", ProductPage, { name: "product" }),
|
|
13
|
+
path("/cart", CartPage, { name: "cart" }),
|
|
14
|
+
path("/checkout/:step?", CheckoutPage, { name: "checkout" }),
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
// Route names are inferred from the { name } option
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Type-Safe href()
|
|
21
|
+
|
|
22
|
+
### Server: ctx.reverse with route names
|
|
23
|
+
|
|
24
|
+
In route handlers, `ctx.reverse()` uses two namespaces:
|
|
25
|
+
|
|
26
|
+
- **`.name`** — local route, resolved within the current `include()` scope
|
|
27
|
+
- **`name`** — global route, from the named-routes definition
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import type { Handler } from "@rangojs/router";
|
|
31
|
+
|
|
32
|
+
export const ProductHandler: Handler<"shop.product"> = (ctx) => {
|
|
33
|
+
ctx.reverse(".cart"); // Local: /shop/cart
|
|
34
|
+
ctx.reverse(".product", { slug: "widget" }); // Local: /shop/product/widget
|
|
35
|
+
ctx.reverse("blog.post", { slug: "1" }); // Global: /blog/1
|
|
36
|
+
};
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For type-safe local names, generate a route types file with `npx rango generate urls/shop.tsx`
|
|
40
|
+
and pass it as the second generic to `Handler` or `Prerender`:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import type { Handler } from "@rangojs/router";
|
|
44
|
+
import type { routes } from "./shop.gen.js";
|
|
45
|
+
|
|
46
|
+
export const ProductHandler: Handler<"shop.product", routes> = (ctx) => {
|
|
47
|
+
ctx.reverse(".cart"); // Type-safe local name
|
|
48
|
+
ctx.reverse(".product", { slug: "widget" }); // Type-safe local with params
|
|
49
|
+
ctx.reverse("blog.post", { slug: "hi" }); // Type-safe global name
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Client: href + useHref
|
|
54
|
+
|
|
55
|
+
On the client, `href()` validates paths against registered route patterns at compile time:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
"use client";
|
|
59
|
+
import { href, useHref, Link } from "@rangojs/router/client";
|
|
60
|
+
|
|
61
|
+
// href() validates absolute paths via PatternToPath types
|
|
62
|
+
href("/about"); // Valid path
|
|
63
|
+
href("/blog/hello"); // Matches /blog/:slug
|
|
64
|
+
|
|
65
|
+
// useHref() auto-prefixes with include() mount
|
|
66
|
+
function ShopNav() {
|
|
67
|
+
const href = useHref();
|
|
68
|
+
return <Link to={href("/cart")}>Cart</Link>; // "/shop/cart"
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`href()` and the `Rango.Path` type read from `RegisteredRoutes` when you augment
|
|
73
|
+
it, otherwise from the auto-generated `GeneratedRouteMap` — so `rango generate`
|
|
74
|
+
alone type-checks `href()` paths with no manual augmentation. The augmentation
|
|
75
|
+
below is only needed for **`Rango.PathResponse`** (response-payload inference), which
|
|
76
|
+
`GeneratedRouteMap` cannot provide:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
declare global {
|
|
80
|
+
namespace Rango {
|
|
81
|
+
interface RegisteredRoutes extends typeof router.routeMap {}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For wrapper helpers, type the path parameter as `Rango.Path`. It is ambient (no
|
|
87
|
+
import) and shares `href()`'s compile-time path checking, so a wrapper stays in
|
|
88
|
+
sync with your routes automatically:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { href } from "@rangojs/router/client";
|
|
92
|
+
|
|
93
|
+
export const appHref = (path: Rango.Path): string => href(path);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
For response-route payloads, `Rango.PathResponse<T>` is the ambient lookup. It
|
|
97
|
+
accepts a route _pattern_ **or** a concrete path, so it also serves as the return
|
|
98
|
+
type of a typed `fetch` wrapper. It only resolves once `RegisteredRoutes` carries
|
|
99
|
+
response metadata:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { href } from "@rangojs/router/client";
|
|
103
|
+
|
|
104
|
+
type Product = Rango.PathResponse<"/api/products/:id">; // by pattern
|
|
105
|
+
type Same = Rango.PathResponse<"/api/products/42">; // by concrete path
|
|
106
|
+
|
|
107
|
+
// Response inferred from the concrete path passed in:
|
|
108
|
+
async function get<T extends Rango.Path>(
|
|
109
|
+
path: T,
|
|
110
|
+
): Promise<Rango.PathResponse<T>> {
|
|
111
|
+
return fetch(href(path)).then((r) => r.json());
|
|
112
|
+
}
|
|
113
|
+
const product = await get("/api/products/42"); // Product (bare value)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Pattern keys (`/:id`) match exactly; a concrete path under a _nested_ dynamic
|
|
117
|
+
route can match several patterns and union their responses.
|
|
118
|
+
|
|
119
|
+
`Rango.PathResponse` describes the JSON **wire** shape, not the handler's raw
|
|
120
|
+
return. A `path.json()` handler returning `{ createdAt: Date }` resolves here to
|
|
121
|
+
`{ createdAt: string }` (bare value), matching what `r.json()` yields. This
|
|
122
|
+
is applied via the ambient `Rango.JsonSerialize<T>` transform (`Date -> string`,
|
|
123
|
+
honors `toJSON()`, drops functions/`undefined`, `bigint -> never`). A separate
|
|
124
|
+
`Rango.FlightSerialize<T>` models the higher-fidelity RSC Flight boundary
|
|
125
|
+
(loaders / RSC props, where `Date` is preserved) — do **not** use it for
|
|
126
|
+
`path.json()`.
|
|
127
|
+
|
|
128
|
+
### Overriding serialization globally
|
|
129
|
+
|
|
130
|
+
For your own types, the zero-config way to control the JSON wire shape is a
|
|
131
|
+
`toJSON()` method — `Rango.JsonSerialize` honors it, and it matches the runtime
|
|
132
|
+
exactly (`JSON.stringify` calls `toJSON()`):
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
class Money {
|
|
136
|
+
constructor(private cents: number) {}
|
|
137
|
+
toJSON(): number {
|
|
138
|
+
return this.cents;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// Rango.JsonSerialize<Money> is number; Rango.PathResponse reflects it.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
To override a transform for types you **don't** own (or for the Flight boundary,
|
|
145
|
+
which has no `toJSON()`), augment its override slot. Because `Rango.JsonSerialize`
|
|
146
|
+
/ `Rango.FlightSerialize` are type _aliases_ (TS can't merge those), you provide a
|
|
147
|
+
single member that is your **complete** transform, delegating to the built-in for
|
|
148
|
+
the cases you don't change:
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
declare global {
|
|
152
|
+
namespace Rango {
|
|
153
|
+
interface JsonSerializeOverride<T> {
|
|
154
|
+
app: T extends Decimal ? string : Rango.JsonSerializeBuiltin<T>;
|
|
155
|
+
}
|
|
156
|
+
interface FlightSerializeOverride<T> {
|
|
157
|
+
app: T extends Money ? number : Rango.FlightSerializeBuiltin<T>;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// Rango.JsonSerialize<Decimal> -> string; Rango.FlightSerialize<Money> -> number;
|
|
162
|
+
// everything else stays on the built-in, recursively (nested fields too).
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Rules: provide **exactly one** member (the slot is read as
|
|
166
|
+
`Override<T>[keyof Override<T>]`, so multiple members union and conflict).
|
|
167
|
+
Overrides win over `toJSON()` and apply at every nesting level. Caveat for JSON:
|
|
168
|
+
the `path.json()` runtime is plain `JSON.stringify`, which only honors `toJSON()`,
|
|
169
|
+
so a `JsonSerializeOverride` that disagrees with what the runtime emits will lie —
|
|
170
|
+
prefer `toJSON()` for your own types and use the slot only for types you can't
|
|
171
|
+
modify.
|
|
172
|
+
|
|
173
|
+
See `/links` for full URL generation guide.
|
|
174
|
+
|
|
175
|
+
## Stable identity: `path#export`
|
|
176
|
+
|
|
177
|
+
Loaders, handles, cached functions (`functionId`), and server actions
|
|
178
|
+
(`actionId`) all share one identity scheme: `{modulePath}#{exportName}`,
|
|
179
|
+
injected at build by the `exposeInternalIds` and `exposeActionId` Vite plugins.
|
|
180
|
+
This is also the identity React server actions carry across the Flight boundary,
|
|
181
|
+
which is why a `revalidate()` predicate sees an action as a `path#export` string:
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
revalidate(
|
|
185
|
+
({ actionId }) => actionId === "src/actions/cart.ts#addToCart" || undefined,
|
|
186
|
+
);
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
`actionId` is the only stable reference React exposes across the Flight boundary,
|
|
190
|
+
so it stays as the floor and escape hatch. The hand-written-string surface
|
|
191
|
+
(`actionId?.includes("cart.ts#")`) is brittle: a renamed action or moved file
|
|
192
|
+
silently stops matching with no compile error. Prefer **`ctx.isAction()`** in a
|
|
193
|
+
revalidate predicate — it resolves the action's id from an imported reference, so
|
|
194
|
+
a rename is a type error in one place instead of silent drift:
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import { addToCart, removeFromCart } from "./actions/cart";
|
|
198
|
+
import * as CartActions from "./actions/cart";
|
|
199
|
+
|
|
200
|
+
revalidate((ctx) => ctx.isAction(addToCart) || undefined); // one action
|
|
201
|
+
revalidate((ctx) => ctx.isAction(addToCart, removeFromCart) || undefined); // several
|
|
202
|
+
revalidate((ctx) => ctx.isAction(CartActions) || undefined); // any action in the module
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`ctx.isAction()` (only available on the revalidate predicate's context) returns a
|
|
206
|
+
raw boolean — combine with `|| undefined` for the "revalidate on match, else
|
|
207
|
+
defer" intent. It resolves the reference the same way the router derives
|
|
208
|
+
`actionId` (`$id` in production, `$$id` in dev), so matching
|
|
209
|
+
works in both modes. `actionId` stays available for advanced cases.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: use-cache
|
|
3
|
-
description: Function-level caching with "use cache" directive for RSC data functions and components
|
|
3
|
+
description: Function-level caching with the "use cache" directive for RSC data functions and components in @rangojs/router. Use when a single function or component should memoize its own output, not a whole route/segment subtree or HTTP response.
|
|
4
4
|
argument-hint: [profile-name]
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -10,6 +10,12 @@ Function-level caching for async server functions and RSC components. Caches
|
|
|
10
10
|
return values with TTL + stale-while-revalidate. Complementary to the route-level
|
|
11
11
|
`cache()` DSL and build-time `Static()`/`Prerender()`.
|
|
12
12
|
|
|
13
|
+
## Not this skill if…
|
|
14
|
+
|
|
15
|
+
- You want to cache a whole route or a rendered subtree of segments — that is
|
|
16
|
+
the segment-level `cache()` DSL: see `/caching`.
|
|
17
|
+
- You are unsure which cache layer you need — start at `/cache-guide`.
|
|
18
|
+
|
|
13
19
|
## Basic Usage
|
|
14
20
|
|
|
15
21
|
### File-level (all exports cached with default profile)
|
|
@@ -52,8 +58,9 @@ export async function ProductCard({ id }: { id: string }) {
|
|
|
52
58
|
|
|
53
59
|
## Named Cache Profiles
|
|
54
60
|
|
|
55
|
-
Define profiles in createRouter. Profile names map to `"use cache: <name>"`
|
|
56
|
-
`cache(
|
|
61
|
+
Define profiles in createRouter. Profile names map to `"use cache: <name>"` in
|
|
62
|
+
the directive. The DSL `cache()` does not accept a string profile name; use an
|
|
63
|
+
options object (`cache({ ttl: 60 })`) or the `"use cache: <name>"` directive.
|
|
57
64
|
|
|
58
65
|
```typescript
|
|
59
66
|
createRouter({
|
|
@@ -62,13 +69,27 @@ createRouter({
|
|
|
62
69
|
short: { ttl: 60, swr: 120 },
|
|
63
70
|
long: { ttl: 3600, swr: 7200 },
|
|
64
71
|
products: { ttl: 300, swr: 600, tags: ["products"] },
|
|
72
|
+
// Opt-in: a stale entry re-executes in the foreground during a server
|
|
73
|
+
// action's revalidation render (fresh action response), instead of SWR.
|
|
74
|
+
cms: { ttl: 300, swr: 600, foregroundOnAction: true },
|
|
65
75
|
},
|
|
66
76
|
});
|
|
67
77
|
```
|
|
68
78
|
|
|
69
79
|
- `"use cache"` (no name) resolves to `default`.
|
|
70
80
|
- `"use cache: short"` resolves to the `short` profile.
|
|
71
|
-
-
|
|
81
|
+
- `foregroundOnAction: true` (default false): a stale entry serves stale +
|
|
82
|
+
revalidates in the background on a plain navigation (SWR), but re-executes in
|
|
83
|
+
the FOREGROUND during a server action's revalidation render so the action
|
|
84
|
+
response reflects a fresh value (only the store write is deferred). Use it for
|
|
85
|
+
mutation-related cached data; incidental TTL staleness on an ordinary action
|
|
86
|
+
stays SWR so the action is not turned into a synchronous cache-refresh barrier.
|
|
87
|
+
For strong read-your-own-writes after a mutation, prefer `updateTag()` (a hard
|
|
88
|
+
purge, so the action's own re-render is a fresh foreground miss).
|
|
89
|
+
- Unknown profile names throw at runtime, on the first invocation of the cached
|
|
90
|
+
function (the Vite transform does not validate names at build/boot). The error
|
|
91
|
+
is actionable -- it names the missing profile and shows the `createRouter({
|
|
92
|
+
cacheProfiles: { ... } })` entry to add.
|
|
72
93
|
|
|
73
94
|
## Cache Key
|
|
74
95
|
|
|
@@ -77,18 +98,33 @@ use-cache:{functionId}:{serializedArgs}
|
|
|
77
98
|
```
|
|
78
99
|
|
|
79
100
|
- `functionId` -- stable ID from Vite transform (module path + export name).
|
|
80
|
-
- `serializedArgs` --
|
|
101
|
+
- `serializedArgs` -- key-generating arguments serialized via RSC `encodeReply()`.
|
|
102
|
+
|
|
103
|
+
When there are no key-generating arguments, the key has no trailing colon -- it is
|
|
104
|
+
just `use-cache:{functionId}`.
|
|
81
105
|
|
|
82
106
|
Different functions always produce different cache keys, even for the same route.
|
|
83
107
|
This is important for intercepted routes -- the path handler and intercept handler
|
|
84
108
|
each have their own `functionId` and therefore their own cache entries.
|
|
85
109
|
|
|
110
|
+
### Route context is folded into the key
|
|
111
|
+
|
|
112
|
+
The tainted `ctx` object is excluded from arg serialization (see below), but
|
|
113
|
+
route-identifying fields read off it are extracted into `serializedArgs`:
|
|
114
|
+
`url.host`, route name (`_routeName`), `pathname`, `params`, response type
|
|
115
|
+
(`_responseType`), and the user-facing sorted search params (internal `_rsc*`/`__`
|
|
116
|
+
params excluded). The same cached function called with `ctx` on different routes,
|
|
117
|
+
param combinations, hosts, response types, or query variants therefore produces
|
|
118
|
+
distinct cache entries -- not one shared entry.
|
|
119
|
+
|
|
86
120
|
## Tainted Arguments (ctx, env, req)
|
|
87
121
|
|
|
88
122
|
Request-scoped objects are branded with `Symbol.for('rango:nocache')` at creation.
|
|
89
123
|
When detected:
|
|
90
124
|
|
|
91
125
|
1. **Excluded from cache key** -- request-scoped, not meaningful for keying.
|
|
126
|
+
(The route-identifying fields read off `ctx` are still folded in -- see
|
|
127
|
+
"Route context is folded into the key" above.)
|
|
92
128
|
2. **Handle data captured on miss** -- side effects via `ctx.use(Handle)` are recorded.
|
|
93
129
|
3. **Handle data replayed on hit** -- restored into the current request's HandleStore.
|
|
94
130
|
|
|
@@ -117,17 +153,28 @@ const locale = cookies().get("locale")?.value ?? "en";
|
|
|
117
153
|
const data = await getCachedData(locale); // locale is now in the cache key
|
|
118
154
|
```
|
|
119
155
|
|
|
156
|
+
The guard does not reach into LOADER bodies consumed inside the cached
|
|
157
|
+
function (`await ctx.use(loader)`): loaders always run fresh, so their reads
|
|
158
|
+
are exempt — but the CONSUMED VALUE is captured into the shared cache entry
|
|
159
|
+
like any other computed data. Same rule across `cache()` and the PPR shell:
|
|
160
|
+
handler/cached-scope consumption = baked copy, client-side `useLoader` = live
|
|
161
|
+
(the consumption-lane rule, `/rango` → Invariants).
|
|
162
|
+
|
|
120
163
|
### Side-Effect Guards
|
|
121
164
|
|
|
122
165
|
These ctx methods **throw** inside a `"use cache"` function because their effects
|
|
123
166
|
are lost on cache hit (the function body is skipped):
|
|
124
167
|
|
|
125
|
-
- `ctx.set()`
|
|
168
|
+
- `ctx.set()` for passing values to children
|
|
126
169
|
- `ctx.header()`
|
|
127
170
|
- `ctx.setTheme()`
|
|
128
171
|
- `ctx.setLocationState()`
|
|
129
172
|
- `ctx.onResponse()`
|
|
130
173
|
|
|
174
|
+
`ctx.get()` is **not** exec-guarded inside `"use cache"` -- it is a read, so it is
|
|
175
|
+
safe. (It only throws when reading a non-cacheable variable inside the separate
|
|
176
|
+
route-level `cache()` DSL boundary.)
|
|
177
|
+
|
|
131
178
|
The error message recommends two alternatives:
|
|
132
179
|
|
|
133
180
|
1. Extract the data fetch into a separate cached function and call ctx methods outside it.
|
|
@@ -304,18 +351,30 @@ export async function getProducts() {
|
|
|
304
351
|
## Backing Store
|
|
305
352
|
|
|
306
353
|
Writes to the same `SegmentCacheStore` as `cache()` DSL, `Static()`, and `Prerender()`.
|
|
307
|
-
One store, one configuration
|
|
308
|
-
|
|
354
|
+
One store, one configuration.
|
|
355
|
+
|
|
356
|
+
Cache entries (and `cacheProfiles`) can be tagged via `cache({ tags })` or runtime
|
|
357
|
+
`cacheTag(...tags)`. `cacheTag` has two forms: inside a `"use cache"` function it
|
|
358
|
+
tags that entry; called during a request render outside `"use cache"` it tags the
|
|
359
|
+
request's document/shell artifact (rides `_requestTags`) instead of throwing. The
|
|
360
|
+
built-in
|
|
361
|
+
`MemorySegmentCacheStore` and `CFCacheStore` index by tag. Invalidate on demand
|
|
362
|
+
with `updateTag(...tags)` (awaitable, read-your-own-writes; for server actions) or
|
|
363
|
+
`revalidateTag(...tags)` (background, non-blocking; for route handlers/webhooks).
|
|
364
|
+
Both hard-purge; the difference is awaitability, not stale-serving. For
|
|
365
|
+
`CFCacheStore`, distributed invalidation needs a `kv` namespace (markers live in
|
|
366
|
+
that same namespace). The separate `revalidate()` export is the client-update axis
|
|
367
|
+
(which segments re-render on a navigation or action), not a cache bust.
|
|
309
368
|
|
|
310
369
|
## Interaction with Other Caching
|
|
311
370
|
|
|
312
|
-
| Mechanism
|
|
313
|
-
|
|
|
314
|
-
| `"use cache"`
|
|
315
|
-
| `cache()` DSL
|
|
316
|
-
| `cache(
|
|
317
|
-
| `Static()`
|
|
318
|
-
| `Prerender()`
|
|
371
|
+
| Mechanism | Granularity | When | Use case |
|
|
372
|
+
| -------------------- | ------------------ | ---------- | ----------------------------------------------- |
|
|
373
|
+
| `"use cache"` | Function/component | Runtime | Cache individual data fetches or components |
|
|
374
|
+
| `cache()` DSL | Route segment | Runtime | Cache entire route subtrees with children |
|
|
375
|
+
| `cache({ ttl })` DSL | Route segment | Runtime | Cache a route subtree with explicit options |
|
|
376
|
+
| `Static()` | Route segment | Build-time | Render once, never re-render |
|
|
377
|
+
| `Prerender()` | Route segment | Build-time | Pre-render known params, optional live fallback |
|
|
319
378
|
|
|
320
379
|
## Dev Mode
|
|
321
380
|
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vercel
|
|
3
|
+
description: Deploy a Rango app to Vercel Functions (Build Output API v3). Use when deploying a Rango app to Vercel, or asking how the router works with Vercel Functions and the Build Output API.
|
|
4
|
+
argument-hint:
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Vercel deployment
|
|
8
|
+
|
|
9
|
+
The `vercel` preset builds like the `node` preset (Vercel runs Node Functions, not Workers): rango owns the RSC entry, folds `process.env.NODE_ENV` for the SSR/RSC build, and after `vite build` assembles a `.vercel/output` directory (Build Output API v3) from `dist/` — a single streaming Node Function plus the static client assets.
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @vercel/functions
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
// vite.config.ts
|
|
19
|
+
import { defineConfig } from "vite";
|
|
20
|
+
import react from "@vitejs/plugin-react";
|
|
21
|
+
import { rango } from "@rangojs/router/vite";
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
plugins: [react(), rango({ preset: "vercel" })],
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`@vercel/functions` is required: it backs the generated function launcher (`waitUntil`) and `VercelCacheStore`. The build fails with a clear error if it is missing.
|
|
29
|
+
|
|
30
|
+
`vite build` produces `.vercel/output`; deploy with the Vercel CLI (`vercel deploy --prebuilt`) or via Git integration.
|
|
31
|
+
|
|
32
|
+
## Function configuration
|
|
33
|
+
|
|
34
|
+
Per-function knobs go under `vercel` and are written into `.vc-config.json`:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
rango({
|
|
38
|
+
preset: "vercel",
|
|
39
|
+
vercel: {
|
|
40
|
+
runtime: "nodejs22.x", // default
|
|
41
|
+
maxDuration: 30, // seconds, default
|
|
42
|
+
memory: 1024, // MB (platform default when omitted)
|
|
43
|
+
regions: ["fra1"], // pin regions (platform default when omitted)
|
|
44
|
+
functionName: "index", // the <name>.func dir + config.json route
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Runtime Cache
|
|
50
|
+
|
|
51
|
+
`VercelCacheStore` wraps the Vercel Runtime Cache. Locally (no `process.env.VERCEL`) fall back to an in-memory store so dev/preview work without the platform:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import {
|
|
55
|
+
MemorySegmentCacheStore,
|
|
56
|
+
VercelCacheStore,
|
|
57
|
+
} from "@rangojs/router/cache";
|
|
58
|
+
import { getCache, waitUntil } from "@vercel/functions";
|
|
59
|
+
|
|
60
|
+
const defaults = { ttl: 60, swr: 300 };
|
|
61
|
+
const memoryStore = new MemorySegmentCacheStore({ defaults });
|
|
62
|
+
|
|
63
|
+
function resolveCache() {
|
|
64
|
+
if (process.env.VERCEL) {
|
|
65
|
+
return {
|
|
66
|
+
store: new VercelCacheStore({
|
|
67
|
+
cache: getCache({ namespace: process.env.VERCEL_DEPLOYMENT_ID }),
|
|
68
|
+
waitUntil,
|
|
69
|
+
defaults,
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return { store: memoryStore };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const router = createRouter({ cache: resolveCache }).routes(/* ... */);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The cache factory receives `(env, ctx)`; on Vercel `env` is `process.env` and `ctx` is `{ waitUntil }`.
|
|
80
|
+
|
|
81
|
+
## Host routers (multi-app)
|
|
82
|
+
|
|
83
|
+
A multi-app host router deploys as a **single function** running `hostRouter.match()` for every request (mirrors the Cloudflare single-worker model). Two requirements:
|
|
84
|
+
|
|
85
|
+
1. The host module exports the `HostRouter` **instance** (default export, or a named `hostRouter`/`router` export) — not a Cloudflare-style `{ fetch }` object, because rango owns the entry and calls `match()` for you.
|
|
86
|
+
2. Point at the host entry (a host app has several `createRouter()` sub-apps, so auto-discovery can't pick one). rango auto-detects a lone `createHostRouter()` file; set `hostRouter` to be explicit:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
rango({ preset: "vercel", hostRouter: "./src/worker.rsc.tsx" });
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// src/worker.rsc.tsx
|
|
94
|
+
import { createHostRouter } from "@rangojs/router/host";
|
|
95
|
+
|
|
96
|
+
export const hostRouter = createHostRouter();
|
|
97
|
+
hostRouter.host(["admin.*"]).lazy(() => import("./apps/admin/handler.js"));
|
|
98
|
+
hostRouter.host(["."]).lazy(() => import("./apps/site/handler.js"));
|
|
99
|
+
|
|
100
|
+
export default hostRouter; // the instance
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`{ env, ctx }` is threaded unchanged from the function to each matched sub-app's handler and its `cache(env, ctx)` factory. See the `host-router` skill for sub-app structure and routing patterns.
|
|
104
|
+
|
|
105
|
+
## Tracing (custom spans)
|
|
106
|
+
|
|
107
|
+
Vercel exposes tracing through OpenTelemetry. `createVercelTracing()` (from `@rangojs/router/vercel`) emits the router's `rango.*` phase spans onto the global OTel tracer that `@vercel/otel`'s `registerOTel()` installs:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
// instrumentation.ts — install the provider, then export the tracing config so
|
|
111
|
+
// importing this module is what runs registerOTel(). A Rango/Vite app does NOT
|
|
112
|
+
// auto-load `instrumentation.ts` like Next.js does, so a standalone
|
|
113
|
+
// registerOTel() that nothing imports is a silent no-op.
|
|
114
|
+
import { registerOTel } from "@vercel/otel";
|
|
115
|
+
import { createVercelTracing } from "@rangojs/router/vercel";
|
|
116
|
+
registerOTel({ serviceName: "my-app" });
|
|
117
|
+
export const tracing = createVercelTracing();
|
|
118
|
+
|
|
119
|
+
// router.tsx — importing `tracing` runs instrumentation.ts (and registerOTel)
|
|
120
|
+
import { tracing } from "./instrumentation.js";
|
|
121
|
+
export const router = createRouter({ tracing }).routes(/* ... */);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`createVercelTracing(opts?)` takes `{ enabled, spans, tracerName, tracer }` — same phase set as `createCloudflareTracing` (`rango.request/middleware/action/loader/render/ssr`). Caveats: Node-runtime only (Vercel custom spans are unsupported on Edge); `registerOTel()` must run before the first request; `@vercel/otel` is what unlocks Vercel Session Tracing + Trace Drains. The deploy bundles `@vercel/otel` and its `@opentelemetry/*` peers into the function (no `node_modules` at runtime), so they must be installed. See `examples/vercel-basic` for a worked hybrid setup and the `observability` skill for the cross-platform tracing model.
|
|
125
|
+
|
|
126
|
+
## Local validation without deploying
|
|
127
|
+
|
|
128
|
+
`vite preview` serves the static client assets only. To preview the RSC **function**, serve the assembled `.vercel/output` behind filesystem-then-function routing — `examples/vercel-basic/scripts/preview.mjs` does this (and `pnpm preview:vercel` runs it). For a faithful deploy test (isolated filesystem, ESM, self-contained bundle), `examples/vercel-basic/scripts/smoke.mjs` serves it from a temp dir outside the repo. Both share `scripts/serve-vercel-output.mjs`.
|