@rangojs/router 0.5.1 → 0.6.0
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/README.md +5 -1
- package/dist/bin/rango.js +343 -125
- package/dist/types/browser/event-controller.d.ts +6 -0
- package/dist/types/browser/react/use-router.d.ts +10 -3
- package/dist/types/browser/react/use-search-params.d.ts +57 -10
- package/dist/types/browser/types.d.ts +22 -0
- package/dist/types/build/merge-full-manifests.d.ts +3 -0
- package/dist/types/build/route-trie.d.ts +4 -73
- package/dist/types/build/route-types/per-module-writer.d.ts +6 -4
- package/dist/types/build/route-types/router-processing.d.ts +2 -3
- package/dist/types/cache/cache-exec-scope.d.ts +31 -0
- package/dist/types/cache/cf/cf-cache-constants.d.ts +8 -1
- package/dist/types/cache/cf/cf-cache-store.d.ts +15 -1
- package/dist/types/cache/cf/cf-cache-types.d.ts +1 -1
- package/dist/types/cache/cf/cf-kv-utils.d.ts +21 -0
- package/dist/types/cache/taint.d.ts +12 -6
- package/dist/types/client-urls/client-root.d.ts +38 -0
- package/dist/types/client-urls/client-urls.d.ts +5 -0
- package/dist/types/client-urls/navigation.d.ts +38 -0
- package/dist/types/client-urls/revalidation-protocol.d.ts +25 -0
- package/dist/types/client-urls/server-projection.d.ts +62 -0
- package/dist/types/client-urls/types.d.ts +144 -0
- package/dist/types/client.d.ts +12 -4
- package/dist/types/client.rsc.d.ts +4 -1
- package/dist/types/decode-loader-results.d.ts +37 -0
- package/dist/types/errors.d.ts +1 -0
- package/dist/types/handles/is-thenable.d.ts +2 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/loader-redirect.d.ts +27 -0
- package/dist/types/outlet-context.d.ts +12 -0
- package/dist/types/outlet-provider.d.ts +3 -1
- package/dist/types/redirect-origin.d.ts +4 -0
- package/dist/types/route-content-wrapper.d.ts +42 -1
- package/dist/types/route-definition/helpers-types.d.ts +13 -2
- package/dist/types/router/error-handling.d.ts +35 -1
- package/dist/types/router/intercept-resolution.d.ts +12 -0
- package/dist/types/router/loader-resolution.d.ts +24 -2
- package/dist/types/router/revalidation.d.ts +7 -0
- package/dist/{types.backup/build/route-trie.d.ts → types/router/route-trie-builder.d.ts} +4 -16
- package/dist/types/router/router-interfaces.d.ts +20 -0
- package/dist/types/router/segment-resolution/helpers.d.ts +1 -1
- package/dist/types/router/trie-matching.d.ts +1 -1
- package/dist/types/rsc/helpers.d.ts +3 -0
- package/dist/types/rsc/manifest-init.d.ts +5 -5
- package/dist/types/rsc/render-pipeline.d.ts +9 -0
- package/dist/types/rsc/routine-plan.d.ts +124 -0
- package/dist/types/rsc/shell-capture-constants.d.ts +17 -0
- package/dist/types/rsc/shell-capture.d.ts +9 -0
- package/dist/types/rsc/shell-serve.d.ts +11 -0
- package/dist/types/rsc/types.d.ts +30 -0
- package/dist/types/segment-system.d.ts +2 -0
- package/dist/types/server/context.d.ts +10 -0
- package/dist/types/server/handle-store.d.ts +34 -3
- package/dist/types/server/request-context.d.ts +14 -1
- package/dist/types/server.d.ts +1 -0
- package/dist/types/ssr/index.d.ts +22 -0
- package/dist/types/ssr/ssr-root.d.ts +10 -0
- package/dist/types/testing/dom.entry.d.ts +1 -1
- package/dist/types/testing/render-route.d.ts +16 -6
- package/dist/types/testing/run-loader.d.ts +9 -0
- package/dist/types/types/boundaries.d.ts +22 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/loader-types.d.ts +57 -5
- package/dist/types/types/segments.d.ts +7 -0
- package/dist/types/urls/path-helper-types.d.ts +10 -4
- package/dist/types/vite/discovery/client-urls-projection.d.ts +53 -0
- package/dist/types/vite/discovery/discover-routers.d.ts +1 -1
- package/dist/types/vite/discovery/state.d.ts +8 -1
- package/dist/types/vite/encryption-key.d.ts +2 -0
- package/dist/types/vite/plugins/expose-internal-ids.d.ts +10 -0
- package/dist/types/vite/plugins/server-ref-hashing.d.ts +24 -0
- package/dist/types/vite/plugins/server-reference-pattern.d.ts +1 -0
- package/dist/types/vite/utils/shared-utils.d.ts +12 -0
- package/dist/vite/index.js +5101 -2056
- package/package.json +3 -3
- package/skills/breadcrumbs/SKILL.md +39 -9
- package/skills/caching/SKILL.md +1 -1
- package/skills/catalog.json +7 -1
- package/skills/client-urls/SKILL.md +338 -0
- package/skills/comparison/references/framework-comparison.md +23 -9
- package/skills/hooks/SKILL.md +2 -2
- package/skills/hooks/data.md +11 -2
- package/skills/hooks/handle-and-actions.md +7 -0
- package/skills/hooks/outlets.md +26 -5
- package/skills/hooks/urls.md +40 -3
- package/skills/loader/SKILL.md +132 -20
- package/skills/migrate-nextjs/SKILL.md +70 -10
- package/skills/migrate-react-router/SKILL.md +49 -13
- package/skills/migrate-react-router/component-migration.md +18 -13
- package/skills/migrate-react-router/data-and-actions.md +14 -3
- package/skills/migrate-react-router/route-mapping.md +15 -2
- package/skills/mime-routes/SKILL.md +3 -1
- package/skills/parallel/SKILL.md +32 -1
- package/skills/ppr/SKILL.md +16 -6
- package/skills/prerender/SKILL.md +8 -4
- package/skills/rango/SKILL.md +21 -17
- package/skills/react-compiler/SKILL.md +3 -3
- package/skills/response-routes/SKILL.md +4 -2
- package/skills/route/SKILL.md +5 -2
- package/skills/router-setup/SKILL.md +16 -2
- package/skills/scripts/SKILL.md +16 -6
- package/skills/shell-manifest/SKILL.md +16 -7
- package/skills/testing/SKILL.md +2 -2
- package/skills/testing/client-components.md +6 -0
- package/skills/testing/handles.md +30 -8
- package/skills/testing/loader.md +51 -49
- package/skills/testing/middleware.md +1 -1
- package/skills/theme/SKILL.md +8 -5
- package/skills/typesafety/generated-files-and-cli.md +16 -9
- package/skills/typesafety/route-types.md +5 -1
- package/skills/use-cache/SKILL.md +47 -0
- package/src/bin/rango.ts +7 -3
- package/src/browser/event-controller.ts +40 -15
- package/src/browser/navigation-bridge.ts +6 -0
- package/src/browser/navigation-client.ts +5 -0
- package/src/browser/partial-update.ts +77 -10
- package/src/browser/react/NavigationProvider.tsx +7 -0
- package/src/browser/react/use-router.ts +40 -11
- package/src/browser/react/use-search-params.ts +140 -17
- package/src/browser/rsc-router.tsx +59 -0
- package/src/browser/server-action-bridge.ts +26 -0
- package/src/browser/types.ts +22 -0
- package/src/build/merge-full-manifests.ts +161 -0
- package/src/build/route-trie.ts +9 -332
- package/src/build/route-types/include-resolution.ts +66 -11
- package/src/build/route-types/per-module-writer.ts +11 -6
- package/src/build/route-types/router-processing.ts +184 -153
- package/src/build/runtime-discovery.ts +23 -12
- package/src/cache/cache-exec-scope.ts +47 -0
- package/src/cache/cache-runtime.ts +113 -40
- package/src/cache/cf/cf-cache-constants.ts +8 -1
- package/src/cache/cf/cf-cache-store.ts +41 -64
- package/src/cache/cf/cf-cache-types.ts +1 -1
- package/src/cache/cf/cf-kv-utils.ts +38 -0
- package/src/cache/segment-codec.ts +21 -5
- package/src/cache/taint.ts +28 -9
- package/src/client-urls/client-root.tsx +168 -0
- package/src/client-urls/client-urls.ts +698 -0
- package/src/client-urls/navigation.ts +237 -0
- package/src/client-urls/revalidation-protocol.ts +56 -0
- package/src/client-urls/server-projection.ts +579 -0
- package/src/client-urls/types.ts +195 -0
- package/src/client.rsc.tsx +12 -0
- package/src/client.tsx +49 -6
- package/src/decode-loader-results.ts +113 -0
- package/src/errors.ts +14 -0
- package/src/handles/deferred-resolution.ts +14 -7
- package/src/handles/is-thenable.ts +2 -4
- package/src/index.ts +1 -0
- package/src/loader-redirect.tsx +64 -0
- package/src/outlet-context.ts +12 -0
- package/src/outlet-provider.tsx +15 -1
- package/src/redirect-origin.ts +29 -0
- package/src/route-content-wrapper.tsx +96 -3
- package/src/route-definition/dsl-helpers.ts +28 -3
- package/src/route-definition/helpers-types.ts +13 -0
- package/src/route-definition/redirect.ts +17 -18
- package/src/router/error-handling.ts +65 -11
- package/src/router/intercept-resolution.ts +29 -0
- package/src/router/loader-resolution.ts +261 -28
- package/src/router/match-middleware/cache-lookup.ts +24 -15
- package/src/router/match-result.ts +7 -0
- package/src/router/revalidation.ts +24 -11
- package/src/router/route-trie-builder.ts +334 -0
- package/src/router/router-interfaces.ts +38 -0
- package/src/router/segment-resolution/fresh.ts +47 -0
- package/src/router/segment-resolution/helpers.ts +9 -11
- package/src/router/segment-resolution/loader-cache.ts +14 -24
- package/src/router/segment-resolution/revalidation.ts +20 -1
- package/src/router/trie-matching.ts +3 -3
- package/src/router.ts +46 -1
- package/src/rsc/full-payload.ts +6 -0
- package/src/rsc/handler.ts +36 -12
- package/src/rsc/helpers.ts +13 -0
- package/src/rsc/loader-fetch.ts +2 -2
- package/src/rsc/manifest-init.ts +28 -9
- package/src/rsc/progressive-enhancement.ts +247 -70
- package/src/rsc/render-pipeline.ts +68 -24
- package/src/rsc/routine-plan.ts +359 -0
- package/src/rsc/rsc-rendering.ts +569 -302
- package/src/rsc/server-action.ts +180 -71
- package/src/rsc/shell-capture-constants.ts +18 -0
- package/src/rsc/shell-capture.ts +104 -21
- package/src/rsc/shell-serve.ts +15 -2
- package/src/rsc/ssr-setup.ts +10 -1
- package/src/rsc/types.ts +31 -2
- package/src/segment-system.tsx +83 -26
- package/src/server/context.ts +10 -0
- package/src/server/cookie-store.ts +19 -19
- package/src/server/handle-store.ts +185 -48
- package/src/server/request-context.ts +36 -6
- package/src/server.ts +7 -0
- package/src/ssr/index.tsx +37 -2
- package/src/ssr/ssr-root.tsx +30 -2
- package/src/testing/dom.entry.ts +1 -1
- package/src/testing/render-route.tsx +22 -8
- package/src/testing/run-loader.ts +51 -13
- package/src/types/boundaries.ts +19 -0
- package/src/types/index.ts +1 -0
- package/src/types/loader-types.ts +60 -5
- package/src/types/segments.ts +7 -0
- package/src/urls/include-helper.ts +22 -4
- package/src/urls/path-helper-types.ts +14 -1
- package/src/use-loader.tsx +67 -6
- package/src/vite/discovery/client-urls-projection.ts +322 -0
- package/src/vite/discovery/discover-routers.ts +43 -17
- package/src/vite/discovery/state.ts +11 -1
- package/src/vite/discovery/virtual-module-codegen.ts +20 -0
- package/src/vite/encryption-key.ts +29 -0
- package/src/vite/plugins/expose-action-id.ts +2 -2
- package/src/vite/plugins/expose-internal-ids.ts +46 -0
- package/src/vite/plugins/server-ref-hashing.ts +74 -0
- package/src/vite/plugins/server-reference-pattern.ts +10 -0
- package/src/vite/plugins/virtual-entries.ts +12 -3
- package/src/vite/rango.ts +9 -0
- package/src/vite/router-discovery.ts +184 -14
- package/src/vite/utils/shared-utils.ts +12 -7
- package/dist/types.backup/__internal.d.ts +0 -127
- package/dist/types.backup/bin/rango.d.ts +0 -1
- package/dist/types.backup/browser/action-coordinator.d.ts +0 -57
- package/dist/types.backup/browser/action-fence.d.ts +0 -33
- package/dist/types.backup/browser/app-shell.d.ts +0 -34
- package/dist/types.backup/browser/app-version.d.ts +0 -6
- package/dist/types.backup/browser/connection-warmup.d.ts +0 -31
- package/dist/types.backup/browser/cookie-name.d.ts +0 -66
- package/dist/types.backup/browser/event-controller.d.ts +0 -221
- package/dist/types.backup/browser/history-state.d.ts +0 -26
- package/dist/types.backup/browser/index.d.ts +0 -1
- package/dist/types.backup/browser/intercept-utils.d.ts +0 -30
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +0 -17
- package/dist/types.backup/browser/link-interceptor.d.ts +0 -43
- package/dist/types.backup/browser/logging.d.ts +0 -33
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +0 -38
- package/dist/types.backup/browser/navigation-bridge.d.ts +0 -27
- package/dist/types.backup/browser/navigation-client.d.ts +0 -17
- package/dist/types.backup/browser/navigation-store-handle.d.ts +0 -25
- package/dist/types.backup/browser/navigation-store.d.ts +0 -95
- package/dist/types.backup/browser/navigation-transaction.d.ts +0 -75
- package/dist/types.backup/browser/network-error-handler.d.ts +0 -35
- package/dist/types.backup/browser/partial-update.d.ts +0 -61
- package/dist/types.backup/browser/prefetch/cache.d.ts +0 -183
- package/dist/types.backup/browser/prefetch/fetch.d.ts +0 -52
- package/dist/types.backup/browser/prefetch/observer.d.ts +0 -27
- package/dist/types.backup/browser/prefetch/policy.d.ts +0 -13
- package/dist/types.backup/browser/prefetch/queue.d.ts +0 -48
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +0 -28
- package/dist/types.backup/browser/rango-state.d.ts +0 -52
- package/dist/types.backup/browser/react/Link.d.ts +0 -140
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +0 -88
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +0 -78
- package/dist/types.backup/browser/react/context.d.ts +0 -54
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +0 -35
- package/dist/types.backup/browser/react/index.d.ts +0 -1
- package/dist/types.backup/browser/react/location-state-shared.d.ts +0 -162
- package/dist/types.backup/browser/react/location-state.d.ts +0 -29
- package/dist/types.backup/browser/react/mount-context.d.ts +0 -23
- package/dist/types.backup/browser/react/nonce-context.d.ts +0 -14
- package/dist/types.backup/browser/react/shallow-equal.d.ts +0 -5
- package/dist/types.backup/browser/react/use-action.d.ts +0 -61
- package/dist/types.backup/browser/react/use-handle.d.ts +0 -21
- package/dist/types.backup/browser/react/use-href.d.ts +0 -32
- package/dist/types.backup/browser/react/use-link-status.d.ts +0 -36
- package/dist/types.backup/browser/react/use-mount.d.ts +0 -24
- package/dist/types.backup/browser/react/use-navigation.d.ts +0 -15
- package/dist/types.backup/browser/react/use-params.d.ts +0 -21
- package/dist/types.backup/browser/react/use-pathname.d.ts +0 -13
- package/dist/types.backup/browser/react/use-reverse.d.ts +0 -40
- package/dist/types.backup/browser/react/use-router.d.ts +0 -23
- package/dist/types.backup/browser/react/use-search-params.d.ts +0 -19
- package/dist/types.backup/browser/react/use-segments.d.ts +0 -29
- package/dist/types.backup/browser/response-adapter.d.ts +0 -58
- package/dist/types.backup/browser/rsc-router.d.ts +0 -141
- package/dist/types.backup/browser/scroll-restoration.d.ts +0 -103
- package/dist/types.backup/browser/segment-reconciler.d.ts +0 -74
- package/dist/types.backup/browser/segment-structure-assert.d.ts +0 -16
- package/dist/types.backup/browser/server-action-bridge.d.ts +0 -29
- package/dist/types.backup/browser/types.d.ts +0 -530
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +0 -28
- package/dist/types.backup/build/collect-fallback-refs.d.ts +0 -5
- package/dist/types.backup/build/generate-manifest.d.ts +0 -100
- package/dist/types.backup/build/generate-route-types.d.ts +0 -8
- package/dist/types.backup/build/index.d.ts +0 -21
- package/dist/types.backup/build/prefix-tree-utils.d.ts +0 -56
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +0 -3
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/codegen.d.ts +0 -16
- package/dist/types.backup/build/route-types/include-resolution.d.ts +0 -74
- package/dist/types.backup/build/route-types/param-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +0 -18
- package/dist/types.backup/build/route-types/router-processing.d.ts +0 -82
- package/dist/types.backup/build/route-types/scan-filter.d.ts +0 -17
- package/dist/types.backup/build/route-types/source-scan.d.ts +0 -13
- package/dist/types.backup/build/runtime-discovery.d.ts +0 -24
- package/dist/types.backup/cache/background-task.d.ts +0 -21
- package/dist/types.backup/cache/cache-error.d.ts +0 -71
- package/dist/types.backup/cache/cache-key-utils.d.ts +0 -35
- package/dist/types.backup/cache/cache-policy.d.ts +0 -59
- package/dist/types.backup/cache/cache-runtime.d.ts +0 -51
- package/dist/types.backup/cache/cache-scope.d.ts +0 -134
- package/dist/types.backup/cache/cache-tag.d.ts +0 -79
- package/dist/types.backup/cache/cf/cf-base64.d.ts +0 -4
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +0 -105
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +0 -481
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +0 -300
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +0 -22
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +0 -15
- package/dist/types.backup/cache/cf/index.d.ts +0 -3
- package/dist/types.backup/cache/document-cache.d.ts +0 -69
- package/dist/types.backup/cache/handle-capture.d.ts +0 -23
- package/dist/types.backup/cache/handle-snapshot.d.ts +0 -39
- package/dist/types.backup/cache/index.d.ts +0 -7
- package/dist/types.backup/cache/memory-segment-store.d.ts +0 -163
- package/dist/types.backup/cache/profile-registry.d.ts +0 -40
- package/dist/types.backup/cache/read-through-swr.d.ts +0 -60
- package/dist/types.backup/cache/segment-codec.d.ts +0 -78
- package/dist/types.backup/cache/shell-snapshot.d.ts +0 -162
- package/dist/types.backup/cache/tag-invalidation.d.ts +0 -74
- package/dist/types.backup/cache/taint.d.ts +0 -71
- package/dist/types.backup/cache/types.d.ts +0 -407
- package/dist/types.backup/cache/vercel/index.d.ts +0 -1
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +0 -267
- package/dist/types.backup/client.d.ts +0 -184
- package/dist/types.backup/client.rsc.d.ts +0 -39
- package/dist/types.backup/cloudflare/index.d.ts +0 -7
- package/dist/types.backup/cloudflare/tracing.d.ts +0 -53
- package/dist/types.backup/component-utils.d.ts +0 -46
- package/dist/types.backup/components/DefaultDocument.d.ts +0 -13
- package/dist/types.backup/context-var.d.ts +0 -84
- package/dist/types.backup/debug.d.ts +0 -57
- package/dist/types.backup/decode-loader-results.d.ts +0 -5
- package/dist/types.backup/default-error-boundary.d.ts +0 -10
- package/dist/types.backup/defer.d.ts +0 -89
- package/dist/types.backup/deps/browser.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-client.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-server.d.ts +0 -1
- package/dist/types.backup/deps/rsc.d.ts +0 -1
- package/dist/types.backup/deps/ssr.d.ts +0 -1
- package/dist/types.backup/encode-kv.d.ts +0 -35
- package/dist/types.backup/errors.d.ts +0 -226
- package/dist/types.backup/escape-script.d.ts +0 -44
- package/dist/types.backup/handle.d.ts +0 -93
- package/dist/types.backup/handles/MetaTags.d.ts +0 -17
- package/dist/types.backup/handles/Scripts.d.ts +0 -38
- package/dist/types.backup/handles/breadcrumbs.d.ts +0 -43
- package/dist/types.backup/handles/deferred-resolution.d.ts +0 -53
- package/dist/types.backup/handles/is-thenable.d.ts +0 -12
- package/dist/types.backup/handles/meta.d.ts +0 -43
- package/dist/types.backup/handles/script.d.ts +0 -139
- package/dist/types.backup/host/cookie-handler.d.ts +0 -8
- package/dist/types.backup/host/errors.d.ts +0 -40
- package/dist/types.backup/host/index.d.ts +0 -33
- package/dist/types.backup/host/pattern-matcher.d.ts +0 -30
- package/dist/types.backup/host/router.d.ts +0 -12
- package/dist/types.backup/host/testing.d.ts +0 -41
- package/dist/types.backup/host/types.d.ts +0 -148
- package/dist/types.backup/host/utils.d.ts +0 -20
- package/dist/types.backup/href-client.d.ts +0 -214
- package/dist/types.backup/index.d.ts +0 -112
- package/dist/types.backup/index.rsc.d.ts +0 -51
- package/dist/types.backup/internal-debug.d.ts +0 -1
- package/dist/types.backup/loader-store.d.ts +0 -193
- package/dist/types.backup/loader.d.ts +0 -18
- package/dist/types.backup/loader.rsc.d.ts +0 -18
- package/dist/types.backup/missing-id-error.d.ts +0 -1
- package/dist/types.backup/outlet-context.d.ts +0 -12
- package/dist/types.backup/outlet-provider.d.ts +0 -12
- package/dist/types.backup/prerender/build-shell-capture.d.ts +0 -104
- package/dist/types.backup/prerender/param-hash.d.ts +0 -6
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +0 -18
- package/dist/types.backup/prerender/store.d.ts +0 -62
- package/dist/types.backup/prerender.d.ts +0 -292
- package/dist/types.backup/redirect-origin.d.ts +0 -55
- package/dist/types.backup/regex-escape.d.ts +0 -6
- package/dist/types.backup/render-error-thrower.d.ts +0 -13
- package/dist/types.backup/response-utils.d.ts +0 -35
- package/dist/types.backup/reverse.d.ts +0 -206
- package/dist/types.backup/root-error-boundary.d.ts +0 -32
- package/dist/types.backup/route-content-wrapper.d.ts +0 -40
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +0 -130
- package/dist/types.backup/route-definition/helper-factories.d.ts +0 -22
- package/dist/types.backup/route-definition/helpers-types.d.ts +0 -392
- package/dist/types.backup/route-definition/index.d.ts +0 -7
- package/dist/types.backup/route-definition/redirect.d.ts +0 -48
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +0 -19
- package/dist/types.backup/route-definition/use-item-types.d.ts +0 -1
- package/dist/types.backup/route-definition.d.ts +0 -1
- package/dist/types.backup/route-map-builder.d.ts +0 -127
- package/dist/types.backup/route-name.d.ts +0 -27
- package/dist/types.backup/route-types.d.ts +0 -172
- package/dist/types.backup/router/basename.d.ts +0 -10
- package/dist/types.backup/router/content-negotiation.d.ts +0 -91
- package/dist/types.backup/router/debug-manifest.d.ts +0 -7
- package/dist/types.backup/router/error-handling.d.ts +0 -76
- package/dist/types.backup/router/find-match.d.ts +0 -19
- package/dist/types.backup/router/handler-context.d.ts +0 -41
- package/dist/types.backup/router/instrument.d.ts +0 -161
- package/dist/types.backup/router/intercept-resolution.d.ts +0 -79
- package/dist/types.backup/router/lazy-includes.d.ts +0 -26
- package/dist/types.backup/router/loader-resolution.d.ts +0 -63
- package/dist/types.backup/router/logging.d.ts +0 -41
- package/dist/types.backup/router/manifest.d.ts +0 -8
- package/dist/types.backup/router/match-api.d.ts +0 -19
- package/dist/types.backup/router/match-context.d.ts +0 -184
- package/dist/types.backup/router/match-handlers.d.ts +0 -49
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +0 -112
- package/dist/types.backup/router/match-middleware/index.d.ts +0 -80
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +0 -116
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +0 -94
- package/dist/types.backup/router/match-pipelines.d.ts +0 -103
- package/dist/types.backup/router/match-result.d.ts +0 -114
- package/dist/types.backup/router/metrics.d.ts +0 -6
- package/dist/types.backup/router/middleware-types.d.ts +0 -74
- package/dist/types.backup/router/middleware.d.ts +0 -116
- package/dist/types.backup/router/navigation-snapshot.d.ts +0 -22
- package/dist/types.backup/router/params-util.d.ts +0 -8
- package/dist/types.backup/router/parse-pattern.d.ts +0 -38
- package/dist/types.backup/router/pattern-matching.d.ts +0 -169
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +0 -27
- package/dist/types.backup/router/prefetch-limits.d.ts +0 -20
- package/dist/types.backup/router/prerender-match.d.ts +0 -50
- package/dist/types.backup/router/preview-match.d.ts +0 -22
- package/dist/types.backup/router/request-classification.d.ts +0 -104
- package/dist/types.backup/router/revalidation.d.ts +0 -57
- package/dist/types.backup/router/route-snapshot.d.ts +0 -112
- package/dist/types.backup/router/router-context.d.ts +0 -137
- package/dist/types.backup/router/router-interfaces.d.ts +0 -432
- package/dist/types.backup/router/router-options.d.ts +0 -738
- package/dist/types.backup/router/router-registry.d.ts +0 -15
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +0 -55
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +0 -93
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +0 -33
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +0 -44
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +0 -90
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +0 -53
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +0 -85
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +0 -17
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +0 -16
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +0 -28
- package/dist/types.backup/router/segment-resolution.d.ts +0 -3
- package/dist/types.backup/router/segment-wrappers.d.ts +0 -53
- package/dist/types.backup/router/state-cookie-name.d.ts +0 -1
- package/dist/types.backup/router/substitute-pattern-params.d.ts +0 -23
- package/dist/types.backup/router/telemetry-otel.d.ts +0 -113
- package/dist/types.backup/router/telemetry.d.ts +0 -215
- package/dist/types.backup/router/timeout.d.ts +0 -68
- package/dist/types.backup/router/tracing.d.ts +0 -125
- package/dist/types.backup/router/trie-matching.d.ts +0 -32
- package/dist/types.backup/router/types.d.ts +0 -98
- package/dist/types.backup/router/url-params.d.ts +0 -26
- package/dist/types.backup/router.d.ts +0 -7
- package/dist/types.backup/rsc/capture-queue.d.ts +0 -6
- package/dist/types.backup/rsc/full-payload.d.ts +0 -22
- package/dist/types.backup/rsc/handler-context.d.ts +0 -31
- package/dist/types.backup/rsc/handler.d.ts +0 -9
- package/dist/types.backup/rsc/helpers.d.ts +0 -213
- package/dist/types.backup/rsc/index.d.ts +0 -17
- package/dist/types.backup/rsc/json-route-result.d.ts +0 -20
- package/dist/types.backup/rsc/loader-fetch.d.ts +0 -14
- package/dist/types.backup/rsc/manifest-init.d.ts +0 -18
- package/dist/types.backup/rsc/nonce.d.ts +0 -28
- package/dist/types.backup/rsc/origin-guard.d.ts +0 -50
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +0 -19
- package/dist/types.backup/rsc/redirect-guard.d.ts +0 -35
- package/dist/types.backup/rsc/response-cache-serve.d.ts +0 -46
- package/dist/types.backup/rsc/response-error.d.ts +0 -19
- package/dist/types.backup/rsc/response-route-handler.d.ts +0 -29
- package/dist/types.backup/rsc/rsc-rendering.d.ts +0 -23
- package/dist/types.backup/rsc/runtime-warnings.d.ts +0 -22
- package/dist/types.backup/rsc/server-action.d.ts +0 -68
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +0 -84
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +0 -27
- package/dist/types.backup/rsc/shell-capture.d.ts +0 -374
- package/dist/types.backup/rsc/shell-serve.d.ts +0 -136
- package/dist/types.backup/rsc/ssr-setup.d.ts +0 -48
- package/dist/types.backup/rsc/transition-gate.d.ts +0 -27
- package/dist/types.backup/rsc/types.d.ts +0 -290
- package/dist/types.backup/runtime-env.d.ts +0 -1
- package/dist/types.backup/search-params.d.ts +0 -125
- package/dist/types.backup/segment-content-promise.d.ts +0 -13
- package/dist/types.backup/segment-fragments.d.ts +0 -56
- package/dist/types.backup/segment-loader-promise.d.ts +0 -22
- package/dist/types.backup/segment-system.d.ts +0 -84
- package/dist/types.backup/serialize.d.ts +0 -164
- package/dist/types.backup/server/context.d.ts +0 -494
- package/dist/types.backup/server/cookie-parse.d.ts +0 -10
- package/dist/types.backup/server/cookie-store.d.ts +0 -107
- package/dist/types.backup/server/fetchable-loader-store.d.ts +0 -20
- package/dist/types.backup/server/handle-store.d.ts +0 -100
- package/dist/types.backup/server/loader-registry.d.ts +0 -32
- package/dist/types.backup/server/request-context.d.ts +0 -596
- package/dist/types.backup/server/root-layout.d.ts +0 -3
- package/dist/types.backup/server.d.ts +0 -15
- package/dist/types.backup/ssr/index.d.ts +0 -233
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +0 -3
- package/dist/types.backup/ssr/preinit-client-references.d.ts +0 -71
- package/dist/types.backup/ssr/ssr-root.d.ts +0 -69
- package/dist/types.backup/static-handler.d.ts +0 -57
- package/dist/types.backup/testing/cache-status.d.ts +0 -63
- package/dist/types.backup/testing/collect-handle.d.ts +0 -20
- package/dist/types.backup/testing/dispatch.d.ts +0 -123
- package/dist/types.backup/testing/dom.entry.d.ts +0 -15
- package/dist/types.backup/testing/e2e/fixture.d.ts +0 -37
- package/dist/types.backup/testing/e2e/index.d.ts +0 -30
- package/dist/types.backup/testing/e2e/matchers.d.ts +0 -17
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +0 -62
- package/dist/types.backup/testing/e2e/parity.d.ts +0 -111
- package/dist/types.backup/testing/e2e/server.d.ts +0 -35
- package/dist/types.backup/testing/flight-matchers.d.ts +0 -55
- package/dist/types.backup/testing/flight-normalize.d.ts +0 -1
- package/dist/types.backup/testing/flight-tree.d.ts +0 -192
- package/dist/types.backup/testing/flight.d.ts +0 -115
- package/dist/types.backup/testing/flight.entry.d.ts +0 -27
- package/dist/types.backup/testing/generated-routes.d.ts +0 -66
- package/dist/types.backup/testing/index.d.ts +0 -52
- package/dist/types.backup/testing/internal/context.d.ts +0 -225
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +0 -1
- package/dist/types.backup/testing/internal/seed-vars.d.ts +0 -30
- package/dist/types.backup/testing/render-handler.d.ts +0 -160
- package/dist/types.backup/testing/render-route.d.ts +0 -246
- package/dist/types.backup/testing/run-loader.d.ts +0 -186
- package/dist/types.backup/testing/run-middleware.d.ts +0 -132
- package/dist/types.backup/testing/run-transition-when.d.ts +0 -77
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +0 -6
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +0 -13
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +0 -7
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +0 -1
- package/dist/types.backup/testing/vitest.d.ts +0 -205
- package/dist/types.backup/theme/ThemeProvider.d.ts +0 -13
- package/dist/types.backup/theme/ThemeScript.d.ts +0 -45
- package/dist/types.backup/theme/constants.d.ts +0 -39
- package/dist/types.backup/theme/index.d.ts +0 -29
- package/dist/types.backup/theme/theme-context.d.ts +0 -21
- package/dist/types.backup/theme/theme-script.d.ts +0 -26
- package/dist/types.backup/theme/types.d.ts +0 -162
- package/dist/types.backup/theme/use-theme.d.ts +0 -8
- package/dist/types.backup/types/boundaries.d.ts +0 -93
- package/dist/types.backup/types/cache-types.d.ts +0 -191
- package/dist/types.backup/types/error-types.d.ts +0 -114
- package/dist/types.backup/types/global-namespace.d.ts +0 -90
- package/dist/types.backup/types/handler-context.d.ts +0 -658
- package/dist/types.backup/types/index.d.ts +0 -11
- package/dist/types.backup/types/loader-types.d.ts +0 -182
- package/dist/types.backup/types/request-scope.d.ts +0 -93
- package/dist/types.backup/types/route-config.d.ts +0 -105
- package/dist/types.backup/types/route-entry.d.ts +0 -95
- package/dist/types.backup/types/segments.d.ts +0 -234
- package/dist/types.backup/types.d.ts +0 -1
- package/dist/types.backup/urls/include-helper.d.ts +0 -17
- package/dist/types.backup/urls/include-provider.d.ts +0 -27
- package/dist/types.backup/urls/index.d.ts +0 -6
- package/dist/types.backup/urls/path-helper-types.d.ts +0 -197
- package/dist/types.backup/urls/path-helper.d.ts +0 -12
- package/dist/types.backup/urls/pattern-types.d.ts +0 -166
- package/dist/types.backup/urls/response-types.d.ts +0 -67
- package/dist/types.backup/urls/type-extraction.d.ts +0 -157
- package/dist/types.backup/urls/urls-function.d.ts +0 -24
- package/dist/types.backup/urls.d.ts +0 -1
- package/dist/types.backup/use-loader.d.ts +0 -150
- package/dist/types.backup/vercel/index.d.ts +0 -10
- package/dist/types.backup/vercel/tracing.d.ts +0 -70
- package/dist/types.backup/vite/debug.d.ts +0 -80
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +0 -12
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +0 -65
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +0 -17
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +0 -113
- package/dist/types.backup/vite/discovery/gate-state.d.ts +0 -79
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +0 -24
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +0 -32
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +0 -22
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +0 -40
- package/dist/types.backup/vite/discovery/state.d.ts +0 -162
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +0 -15
- package/dist/types.backup/vite/index.d.ts +0 -11
- package/dist/types.backup/vite/inject-client-debug.d.ts +0 -56
- package/dist/types.backup/vite/plugin-types.d.ts +0 -298
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +0 -6
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +0 -40
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +0 -35
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +0 -64
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +0 -18
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +0 -37
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +0 -19
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +0 -10
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +0 -8
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +0 -13
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +0 -29
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +0 -6
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +0 -25
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +0 -20
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +0 -20
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +0 -85
- package/dist/types.backup/vite/plugins/version-injector.d.ts +0 -21
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +0 -19
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +0 -36
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +0 -7
- package/dist/types.backup/vite/rango.d.ts +0 -29
- package/dist/types.backup/vite/router-discovery.d.ts +0 -23
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +0 -64
- package/dist/types.backup/vite/utils/banner.d.ts +0 -2
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +0 -28
- package/dist/types.backup/vite/utils/client-chunks.d.ts +0 -55
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +0 -16
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +0 -37
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +0 -7
- package/dist/types.backup/vite/utils/package-resolution.d.ts +0 -6
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +0 -32
- package/dist/types.backup/vite/utils/shared-utils.d.ts +0 -55
|
@@ -1,19 +1,66 @@
|
|
|
1
1
|
import type { ReadonlyURLSearchParams } from "../types.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Accepted shapes for the setter: a full replacement for the search string.
|
|
4
|
+
* Record values are stringified; array values append one entry per element;
|
|
5
|
+
* null/undefined values are skipped (ergonomic conditional spreads).
|
|
6
|
+
*/
|
|
7
|
+
export type SearchParamsInit = string | URLSearchParams | ReadonlyURLSearchParams | Record<string, string | number | boolean | readonly (string | number | boolean)[] | null | undefined>;
|
|
8
|
+
export interface SetSearchParamsOptions {
|
|
9
|
+
/** Replace the current history entry instead of pushing (default false). */
|
|
10
|
+
replace?: boolean;
|
|
11
|
+
/** Scroll behavior for the navigation (default: router default, scroll). */
|
|
12
|
+
scroll?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Set false to skip the server fetch and only update the URL (default
|
|
15
|
+
* true). Purely client-derived search state (open accordions, view modes)
|
|
16
|
+
* needs no loader re-run; all location-aware hooks still update. Same
|
|
17
|
+
* contract as NavigateOptions.revalidate — it only applies because the
|
|
18
|
+
* setter never changes the pathname.
|
|
19
|
+
*/
|
|
20
|
+
revalidate?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export type SetSearchParams = (init: SearchParamsInit | ((prev: URLSearchParams) => SearchParamsInit), options?: SetSearchParamsOptions) => Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Hook to read and write the current URL search params
|
|
25
|
+
* (React Router-style tuple).
|
|
4
26
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
27
|
+
* The first element is a read-only URLSearchParams from the COMMITTED
|
|
28
|
+
* location — it updates when navigation completes, not during a pending
|
|
29
|
+
* navigation. During document SSR it carries the LIVE request's search (the
|
|
30
|
+
* SSR store is seeded from SSRRenderOptions.search), and the browser's
|
|
31
|
+
* first render seeds from its own store location (window.location) — the
|
|
32
|
+
* same URL, so hydration matches. Ppr capture/resume renders seed the SHELL
|
|
33
|
+
* KEY's search (sorted, cache.searchParams filter applied — search is part
|
|
34
|
+
* of shell identity like every other ppr key), so static-part reads bake
|
|
35
|
+
* markup consistent with the shell's own key. Two edges: a param EXCLUDED
|
|
36
|
+
* by cache.searchParams is absent in shell renders but present in the
|
|
37
|
+
* browser (exclusion declares "does not affect markup" — reading one
|
|
38
|
+
* anyway hydration-mismatches), and toString() renders sorted order while
|
|
39
|
+
* the browser holds the raw URL order.
|
|
7
40
|
*
|
|
8
|
-
*
|
|
9
|
-
* the pathname
|
|
10
|
-
*
|
|
41
|
+
* The setter REPLACES the whole search string (React Router semantics) and
|
|
42
|
+
* navigates to the current pathname with the new params — a same-route
|
|
43
|
+
* navigation, so route loaders re-evaluate per their revalidate() contract
|
|
44
|
+
* and the commit holds previous content (the same-structure transition
|
|
45
|
+
* lane). Pass a function to merge with the current params: it receives a
|
|
46
|
+
* MUTABLE copy read at call time. The hash is dropped, like React Router.
|
|
11
47
|
*
|
|
12
48
|
* @example
|
|
13
49
|
* ```tsx
|
|
14
|
-
* const searchParams = useSearchParams();
|
|
15
|
-
* const
|
|
16
|
-
*
|
|
50
|
+
* const [searchParams, setSearchParams] = useSearchParams();
|
|
51
|
+
* const category = searchParams.get("category");
|
|
52
|
+
*
|
|
53
|
+
* // Replace the whole search string
|
|
54
|
+
* setSearchParams({ category: "electronics" });
|
|
55
|
+
*
|
|
56
|
+
* // Merge with what's there now
|
|
57
|
+
* setSearchParams((prev) => {
|
|
58
|
+
* prev.set("page", "2");
|
|
59
|
+
* return prev;
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* // Filter UIs usually want replace + preserved scroll
|
|
63
|
+
* setSearchParams({ category: "home" }, { replace: true, scroll: false });
|
|
17
64
|
* ```
|
|
18
65
|
*/
|
|
19
|
-
export declare function useSearchParams(): ReadonlyURLSearchParams;
|
|
66
|
+
export declare function useSearchParams(): [ReadonlyURLSearchParams, SetSearchParams];
|
|
@@ -47,12 +47,27 @@ export interface RscMetadata {
|
|
|
47
47
|
* Slots are used for intercepting routes during soft navigation
|
|
48
48
|
*/
|
|
49
49
|
slots?: Record<string, SlotState>;
|
|
50
|
+
/**
|
|
51
|
+
* Intercept TARGET route names reachable from this location as a
|
|
52
|
+
* navigation origin. The browser-local clientUrls matcher declines its
|
|
53
|
+
* optimistic presentation for these targets (the canonical response would
|
|
54
|
+
* commit the intercept over the ORIGIN page, so destination loading would
|
|
55
|
+
* flash and revert). Missing/empty means no targets.
|
|
56
|
+
*/
|
|
57
|
+
interceptTargets?: string[];
|
|
50
58
|
/** Root layout component for browser-side re-renders */
|
|
51
59
|
rootLayout?: ComponentType<{
|
|
52
60
|
children: ReactNode;
|
|
53
61
|
}>;
|
|
54
62
|
/** Handle data accumulated across route segments (async generator that yields on each push) */
|
|
55
63
|
handles?: AsyncGenerator<HandleData, void, unknown>;
|
|
64
|
+
/**
|
|
65
|
+
* Document-lane late handle channel: pushes landing after the handler
|
|
66
|
+
* barrier (streaming loader ctx.use(Handle) writes). Consumed non-blocking
|
|
67
|
+
* post-hydration (rsc-router.tsx); `handles` above is drained in blocking
|
|
68
|
+
* positions and must complete at the handler barrier.
|
|
69
|
+
*/
|
|
70
|
+
handlesLate?: AsyncGenerator<HandleData, void, unknown>;
|
|
56
71
|
/** Cached handle data (for back/forward navigation from cache) */
|
|
57
72
|
cachedHandleData?: HandleData;
|
|
58
73
|
/**
|
|
@@ -438,6 +453,13 @@ export interface FetchPartialOptions {
|
|
|
438
453
|
signal?: AbortSignal;
|
|
439
454
|
/** If true, this is a stale cache revalidation request - server should force revalidators */
|
|
440
455
|
staleRevalidation?: boolean;
|
|
456
|
+
/**
|
|
457
|
+
* Encoded client-run per-loader revalidation decisions
|
|
458
|
+
* (clientUrls revalidate() predicates executed in the browser); sent as
|
|
459
|
+
* X-Rango-Client-Reval and honored only by materialized client-urls loader
|
|
460
|
+
* stubs. Null/absent = locked server defaults.
|
|
461
|
+
*/
|
|
462
|
+
clientRevalidation?: string | null;
|
|
441
463
|
interceptSourceUrl?: string;
|
|
442
464
|
/** RSC version for cache invalidation detection */
|
|
443
465
|
version?: string;
|
|
@@ -1,81 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Build-time Route Trie Construction
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* route matching at runtime.
|
|
4
|
+
* Adapts generated manifests to the runtime-owned route trie builder.
|
|
6
5
|
*/
|
|
6
|
+
import { buildRouteTrie, type TrieNode } from "../router/route-trie-builder.js";
|
|
7
7
|
import type { FullManifest } from "./generate-manifest.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* the variant's own positional param-name array, carried so the runtime can
|
|
11
|
-
* re-key the matched params under the variant's names when it wins negotiation
|
|
12
|
-
* (the trie match extracts params under the PRIMARY leaf's pa). Omitted when the
|
|
13
|
-
* variant has no params; absent/identical pa means no re-key is needed.
|
|
14
|
-
*/
|
|
15
|
-
export interface NegotiateVariant {
|
|
16
|
-
routeKey: string;
|
|
17
|
-
responseType: string;
|
|
18
|
-
pa?: string[];
|
|
19
|
-
}
|
|
20
|
-
export interface TrieLeaf {
|
|
21
|
-
/** Route name (e.g., "site.l1_500") */
|
|
22
|
-
n: string;
|
|
23
|
-
/** Static prefix of the entry (e.g., "/site") */
|
|
24
|
-
sp: string;
|
|
25
|
-
/** Constraint validation: paramName -> allowed values */
|
|
26
|
-
cv?: Record<string, string[]>;
|
|
27
|
-
/** Ordered param names for this route (positional) */
|
|
28
|
-
pa?: string[];
|
|
29
|
-
/** Trailing slash mode */
|
|
30
|
-
ts?: string;
|
|
31
|
-
/** Route has pre-rendered data available */
|
|
32
|
-
pr?: true;
|
|
33
|
-
/** Passthrough: handler kept in bundle for live fallback on unknown params */
|
|
34
|
-
pt?: true;
|
|
35
|
-
/** Response type for non-RSC routes (json, text, image, any) */
|
|
36
|
-
rt?: string;
|
|
37
|
-
/** Negotiate variants: response-type routes sharing this path */
|
|
38
|
-
nv?: NegotiateVariant[];
|
|
39
|
-
/** RSC-first: RSC route was defined before response-type variants */
|
|
40
|
-
rf?: true;
|
|
41
|
-
}
|
|
42
|
-
export interface TrieNode {
|
|
43
|
-
/** Route terminal at this node */
|
|
44
|
-
r?: TrieLeaf;
|
|
45
|
-
/** Static segment children */
|
|
46
|
-
s?: Record<string, TrieNode>;
|
|
47
|
-
/** Param child: { n: paramName, c: child node } */
|
|
48
|
-
p?: {
|
|
49
|
-
n: string;
|
|
50
|
-
c: TrieNode;
|
|
51
|
-
};
|
|
52
|
-
/** Suffix-param children keyed by suffix (e.g., ".html" → { n: "productId", c: ... }) */
|
|
53
|
-
xp?: Record<string, {
|
|
54
|
-
n: string;
|
|
55
|
-
c: TrieNode;
|
|
56
|
-
}>;
|
|
57
|
-
/**
|
|
58
|
-
* Wildcard terminal: leaf + paramName (`pn`). `pn` is "*" for the bare `/*`
|
|
59
|
-
* form and the param name for a named catch-all (`:name+`/`:name*`). `w1`
|
|
60
|
-
* marks a one-or-more catch-all (`:name+`): the runtime walker then rejects
|
|
61
|
-
* the zero-segment/empty-remainder case. Absent `w1` is zero-or-more.
|
|
62
|
-
*/
|
|
63
|
-
w?: TrieLeaf & {
|
|
64
|
-
pn: string;
|
|
65
|
-
w1?: true;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Build a route trie from build-time manifest data.
|
|
70
|
-
*
|
|
71
|
-
* @param routeManifest - Map of route name to full URL pattern
|
|
72
|
-
* @param routeToStaticPrefix - Map of route name to its entry's staticPrefix
|
|
73
|
-
* @param routeTrailingSlash - Optional map of route name to trailing slash mode
|
|
74
|
-
* @param prerenderRouteNames - Optional set of prerendered route names (sets leaf.pr)
|
|
75
|
-
* @param passthroughRouteNames - Optional set of passthrough route names (sets leaf.pt)
|
|
76
|
-
* @param responseTypeRoutes - Optional map of route name to response type (sets leaf.rt)
|
|
77
|
-
*/
|
|
78
|
-
export declare function buildRouteTrie(routeManifest: Record<string, string>, routeToStaticPrefix: Record<string, string>, routeTrailingSlash?: Record<string, string>, prerenderRouteNames?: Set<string>, passthroughRouteNames?: Set<string>, responseTypeRoutes?: Record<string, string>): TrieNode;
|
|
8
|
+
export { buildRouteTrie };
|
|
9
|
+
export type { NegotiateVariant, TrieLeaf, TrieNode, } from "../router/route-trie-builder.js";
|
|
79
10
|
/**
|
|
80
11
|
* Build a per-router trie from a generated manifest. This is the single
|
|
81
12
|
* construction path shared by build/discovery (discover-routers.ts, serialized
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import type { ScanFilter } from "./scan-filter.js";
|
|
2
2
|
/**
|
|
3
3
|
* Generate per-module route type files by statically parsing url module source.
|
|
4
|
-
* Scans for files containing `urls(` and writes a sibling
|
|
5
|
-
* extracted route name/pattern pairs. Only writes when
|
|
4
|
+
* Scans for files containing `urls(` or `clientUrls(` and writes a sibling
|
|
5
|
+
* `.gen.ts` with the extracted route name/pattern pairs. Only writes when
|
|
6
|
+
* content has changed.
|
|
6
7
|
*/
|
|
7
8
|
export declare function writePerModuleRouteTypes(root: string, filter?: ScanFilter): void;
|
|
8
9
|
/**
|
|
9
|
-
* Find all variable names assigned to urls() calls in source
|
|
10
|
+
* Find all variable names assigned to urls() or clientUrls() calls in source.
|
|
10
11
|
* e.g. `export const patterns = urls(...)` -> ["patterns"]
|
|
11
12
|
*/
|
|
12
13
|
export declare function findUrlsVariableNames(code: string): string[];
|
|
13
14
|
/**
|
|
14
15
|
* Generate per-module route types for a single url module file.
|
|
15
16
|
* Follows include() calls recursively to produce the full route tree.
|
|
16
|
-
* No-ops if the file doesn't contain `urls(` or has no named
|
|
17
|
+
* No-ops if the file doesn't contain `urls(`/`clientUrls(` or has no named
|
|
18
|
+
* routes.
|
|
17
19
|
*/
|
|
18
20
|
export declare function writePerModuleRouteTypesForFile(filePath: string): void;
|
|
@@ -38,9 +38,8 @@ export declare function extractBasenameFromRouter(code: string): string | undefi
|
|
|
38
38
|
export declare function genFileTsPath(sourceFile: string): string;
|
|
39
39
|
export declare function resolveSearchSchemas(publicRouteNames: string[], runtimeSchemas: Record<string, Record<string, string>> | undefined, sourceFile: string): Record<string, Record<string, string>> | undefined;
|
|
40
40
|
/**
|
|
41
|
-
* Resolve routes and search schemas from
|
|
42
|
-
*
|
|
43
|
-
* or by parsing an inline builder function directly.
|
|
41
|
+
* Resolve routes and search schemas from every direct mount in a createRouter
|
|
42
|
+
* chain. Registrations are merged in runtime order, with later mounts winning.
|
|
44
43
|
*/
|
|
45
44
|
export declare function buildCombinedRouteMapForRouterFile(routerFilePath: string): {
|
|
46
45
|
routes: Record<string, string>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution-chain scope for "use cache" function bodies.
|
|
3
|
+
*
|
|
4
|
+
* The ambient guards (cookies(), headers(), ctx.set() reached via
|
|
5
|
+
* getRequestContext()) must fire for code running INSIDE a cached body and
|
|
6
|
+
* stay silent for everything else on the request. A property stamped on the
|
|
7
|
+
* shared RequestContext cannot express that: while a slow "use cache" body is
|
|
8
|
+
* in flight, every parallel read on the same request sees the stamp. Scar: a
|
|
9
|
+
* 2s cached product fetch running beside a sibling loader made the loader's
|
|
10
|
+
* cookies() read throw `cannot be called inside a "use cache" function` —
|
|
11
|
+
* same shared-object hazard as issue #684 plan 010, which fixed only the
|
|
12
|
+
* background-revalidation path. AsyncLocalStorage follows the cached body's
|
|
13
|
+
* own async chain, so parallel work is invisible to the guard while genuine
|
|
14
|
+
* in-body reads still throw.
|
|
15
|
+
*
|
|
16
|
+
* Deliberately NOT entered on the store-less bypass paths in cache-runtime.ts:
|
|
17
|
+
* there the body executes for real on every call, side effects take effect,
|
|
18
|
+
* and request-scoped reads are safe (see the bypass comments there).
|
|
19
|
+
*
|
|
20
|
+
* Kept separate from taint.ts so `node:async_hooks` stays out of that module —
|
|
21
|
+
* taint.ts is reachable from browser-bundled DSL helpers. The probe
|
|
22
|
+
* registration below wires assertNotInsideCacheExec to this scope without
|
|
23
|
+
* taint.ts importing it.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Run fn with the "use cache" execution scope active. Continuations spawned
|
|
27
|
+
* from fn's synchronous kickoff inherit the scope; parallel chains do not.
|
|
28
|
+
*/
|
|
29
|
+
export declare function runWithCacheExecScope<T>(fn: () => T): T;
|
|
30
|
+
/** True when the calling async chain is inside a "use cache" body. */
|
|
31
|
+
export declare function isInsideCacheExecScope(): boolean;
|
|
@@ -65,8 +65,15 @@ export declare const MAX_REVALIDATION_INTERVAL = 30;
|
|
|
65
65
|
*
|
|
66
66
|
* This is the default; override per store via
|
|
67
67
|
* `CFCacheStoreOptions.edgeLookupTimeoutMs` (<= 0 disables the budget).
|
|
68
|
+
*
|
|
69
|
+
* 25ms, raised from 10: production Workers logs (autobarn pilot) showed the
|
|
70
|
+
* 10ms budget firing frequently on cold colos where the first Cache API touch
|
|
71
|
+
* is slow but healthy — each false positive downgrades a warm L1 HIT to an
|
|
72
|
+
* L2/render round trip that costs far more than the 15ms of extra patience.
|
|
73
|
+
* A genuinely degraded colo still gets cut off; tune per store for
|
|
74
|
+
* shell-critical routes.
|
|
68
75
|
*/
|
|
69
|
-
export declare const EDGE_LOOKUP_TIMEOUT_MS =
|
|
76
|
+
export declare const EDGE_LOOKUP_TIMEOUT_MS = 25;
|
|
70
77
|
/**
|
|
71
78
|
* Maximum time (ms) to wait for the BODY of a matched L1 entry to be read
|
|
72
79
|
* (response.json()) before treating the read as a miss.
|
|
@@ -302,6 +302,19 @@ export declare class CFCacheStore<TEnv = unknown> implements SegmentCacheStore<T
|
|
|
302
302
|
/**
|
|
303
303
|
* Convert string key to KV key string.
|
|
304
304
|
* Uses same version prefix as Cache API for consistent invalidation.
|
|
305
|
+
*
|
|
306
|
+
* Single chokepoint for EVERY KV family (segments, items, shells, documents
|
|
307
|
+
* via toDocKVKey, tag markers via tagMarkerKey): a composed key over
|
|
308
|
+
* Cloudflare KV's 512-byte limit is normalized to a preserved readable
|
|
309
|
+
* prefix plus a SHA-256-derived 128-bit digest of the FULL key. Without
|
|
310
|
+
* this, kv.put/get reject with `414 ... exceeds key length limit of 512`
|
|
311
|
+
* and the entry silently never reaches L2 (observed in production for
|
|
312
|
+
* "use cache" items whose serialized args — e.g. a CMS query object — blow
|
|
313
|
+
* the cap; autobarn pilot). Keys are opaque storage identifiers, so
|
|
314
|
+
* normalization is semantics-preserving as long as distinct logical keys
|
|
315
|
+
* stay distinct: colliding requires an identical 400-byte prefix AND a
|
|
316
|
+
* 128-bit SHA-256 collision. Deterministic, so every family's read, write,
|
|
317
|
+
* and delete paths agree on the stored key.
|
|
305
318
|
* @internal
|
|
306
319
|
*/
|
|
307
320
|
private toKVKey;
|
|
@@ -546,7 +559,8 @@ export declare class CFCacheStore<TEnv = unknown> implements SegmentCacheStore<T
|
|
|
546
559
|
*
|
|
547
560
|
* Durable-write integrity: the in-memory write-through (memo + L1) for a tag
|
|
548
561
|
* runs ONLY after that tag's KV marker write is confirmed. If any KV write
|
|
549
|
-
* fails (transient error
|
|
562
|
+
* fails (transient error; over-limit keys are normalized by toKVKey rather
|
|
563
|
+
* than rejected), this rejects with the
|
|
550
564
|
* failed tags so an awaiting updateTag() surfaces the failure instead of
|
|
551
565
|
* silently reporting success while other requests/colos serve stale data. The
|
|
552
566
|
* eager purge still fires for the whole batch first (it is additive).
|
|
@@ -288,7 +288,7 @@ export interface CFCacheStoreOptions<TEnv = unknown> {
|
|
|
288
288
|
* cannot stall the request; the read then falls through to its normal miss
|
|
289
289
|
* path (L2/KV or render).
|
|
290
290
|
*
|
|
291
|
-
* Defaults to {@link EDGE_LOOKUP_TIMEOUT_MS} (
|
|
291
|
+
* Defaults to {@link EDGE_LOOKUP_TIMEOUT_MS} (25). Set to 0 (or any value
|
|
292
292
|
* <= 0) to disable the budget and always await `match`.
|
|
293
293
|
*/
|
|
294
294
|
edgeLookupTimeoutMs?: number;
|
|
@@ -9,6 +9,27 @@ export declare const KV_MAX_KEY_BYTES = 512;
|
|
|
9
9
|
export declare const KV_MIN_EXPIRATION_TTL = 60;
|
|
10
10
|
/** UTF-8 byte length of a KV key (multibyte tags can exceed the char count). */
|
|
11
11
|
export declare function kvKeyByteLength(key: string): number;
|
|
12
|
+
/**
|
|
13
|
+
* Bytes of a composed key preserved verbatim when an over-limit key is
|
|
14
|
+
* normalized (toKVKey). 400 leaves room for the `~` separator and the 32-hex
|
|
15
|
+
* digest inside KV_MAX_KEY_BYTES while keeping the version prefix and most of
|
|
16
|
+
* the logical key readable (and prefix-listable) in the KV dashboard.
|
|
17
|
+
*/
|
|
18
|
+
export declare const KV_KEY_PRESERVED_PREFIX_BYTES = 400;
|
|
19
|
+
/**
|
|
20
|
+
* Truncate to at most `maxBytes` of UTF-8. A multibyte sequence split at the
|
|
21
|
+
* boundary decodes to U+FFFD, which is stripped — the result is deterministic
|
|
22
|
+
* for a given input, which is all key normalization needs.
|
|
23
|
+
*/
|
|
24
|
+
export declare function truncateToBytes(value: string, maxBytes: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* 128-bit hex digest (SHA-256 truncated) of a composed KV key. WebCrypto is
|
|
27
|
+
* available on workerd and Node alike; SHA-256 (not a fast non-crypto hash)
|
|
28
|
+
* because cache keys embed user-influenced serialized args — an engineered
|
|
29
|
+
* collision between two normalized keys would serve one entry's payload for
|
|
30
|
+
* the other's.
|
|
31
|
+
*/
|
|
32
|
+
export declare function kvKeyDigest(value: string): Promise<string>;
|
|
12
33
|
/**
|
|
13
34
|
* Compute the Cache-Control directive for a stale-path REVALIDATING re-put from
|
|
14
35
|
* the entry's stored hard-expiry deadline (CACHE_EXPIRES_AT_HEADER). Returns the
|
|
@@ -11,14 +11,19 @@ export declare const NOCACHE_SYMBOL: unique symbol;
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function isTainted(value: unknown): boolean;
|
|
13
13
|
/**
|
|
14
|
-
* Symbol stamped on tainted ctx
|
|
15
|
-
*
|
|
16
|
-
* throw if present —
|
|
17
|
-
*
|
|
14
|
+
* Symbol stamped on tainted ctx objects PASSED AS ARGUMENTS to a "use cache"
|
|
15
|
+
* function during its execution. ctx.set(), ctx.header(), etc. check this
|
|
16
|
+
* flag and throw if present — those side effects are lost on cache hit.
|
|
17
|
+
*
|
|
18
|
+
* Argument objects only. Ambient access (cookies()/headers() and ctx methods
|
|
19
|
+
* reached via getRequestContext()) is guarded by the AsyncLocalStorage scope
|
|
20
|
+
* in cache-exec-scope.ts instead: stamping the SHARED RequestContext made
|
|
21
|
+
* every parallel read on the request throw for the cached body's whole
|
|
22
|
+
* execution window (a 2s cached fetch poisoned a sibling loader's cookies()).
|
|
18
23
|
*
|
|
19
24
|
* The value is a numeric reference count, not a boolean. Multiple concurrent
|
|
20
|
-
* cached functions sharing the same ctx
|
|
21
|
-
*
|
|
25
|
+
* cached functions sharing the same ctx each increment on entry and decrement
|
|
26
|
+
* on exit. Guards fire when count > 0.
|
|
22
27
|
*/
|
|
23
28
|
export declare const INSIDE_CACHE_EXEC: unique symbol;
|
|
24
29
|
/**
|
|
@@ -31,6 +36,7 @@ export declare function stampCacheExec(obj: object): void;
|
|
|
31
36
|
* used by guards no longer fires.
|
|
32
37
|
*/
|
|
33
38
|
export declare function unstampCacheExec(obj: object): void;
|
|
39
|
+
export declare function _setCacheExecScopeProbe(probe: () => boolean): void;
|
|
34
40
|
/**
|
|
35
41
|
* Throw if ctx is inside a "use cache" execution.
|
|
36
42
|
* Call from side-effecting ctx methods (set, header, etc.) and cookie mutations.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ClientUrlPatterns } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Server-materialized wrapper layout for a clientUrls() group that declares
|
|
5
|
+
* intercepts. Attachment scar: intercepts emitted at the TOP LEVEL of a lazily
|
|
6
|
+
* included module attach to the isolated parent clone
|
|
7
|
+
* (getIsolatedLazyParent in server/context.ts) and are silently discarded —
|
|
8
|
+
* only intercepts attached to a layout entry created WITHIN the expansion
|
|
9
|
+
* survive in origin chains. Materialization therefore wraps the group's routes
|
|
10
|
+
* and intercept entries in this layout; it renders the child outlet plus one
|
|
11
|
+
* named outlet per declared slot, so the modal presents inside the group's own
|
|
12
|
+
* subtree (module-local declaration, module-local presentation).
|
|
13
|
+
*/
|
|
14
|
+
export declare function ClientUrlsGroupLayout({ slotNames, }: {
|
|
15
|
+
slotNames: readonly `@${string}`[];
|
|
16
|
+
}): ReactNode;
|
|
17
|
+
/** Slot content for a client-declared intercept: renders the definition's
|
|
18
|
+
* modal component; its useLoader() calls read the slot segment's loader data
|
|
19
|
+
* from the surrounding outlet context. */
|
|
20
|
+
export declare function ClientUrlsInterceptSlot({ definition, interceptIndex, }: {
|
|
21
|
+
definition: ClientUrlPatterns;
|
|
22
|
+
interceptIndex: number;
|
|
23
|
+
}): ReactNode;
|
|
24
|
+
export declare function ClientUrlsInterceptLoading({ definition, interceptIndex, }: {
|
|
25
|
+
definition: ClientUrlPatterns;
|
|
26
|
+
interceptIndex: number;
|
|
27
|
+
}): ReactNode;
|
|
28
|
+
export declare function ClientUrlsRoot({ definition, routeId, namePrefix, }: {
|
|
29
|
+
definition: ClientUrlPatterns;
|
|
30
|
+
routeId: string;
|
|
31
|
+
/** include() route-name prefix, injected at materialization for canonical
|
|
32
|
+
* name composition (intercept-target coordination). */
|
|
33
|
+
namePrefix?: string;
|
|
34
|
+
}): ReactNode;
|
|
35
|
+
export declare function ClientUrlsLoading({ definition, routeId, }: {
|
|
36
|
+
definition: ClientUrlPatterns;
|
|
37
|
+
routeId: string;
|
|
38
|
+
}): ReactNode;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ClientUrlBuilder, ClientUrlPatterns } from "./types.js";
|
|
2
|
+
import type { ExtractRoutes } from "../urls/type-extraction.js";
|
|
3
|
+
import type { ClientUrlItems } from "./types.js";
|
|
4
|
+
export declare function clientUrls<const TItems extends ClientUrlItems>(builder: ClientUrlBuilder<TItems>): ClientUrlPatterns<ExtractRoutes<TItems>>;
|
|
5
|
+
export type { ClientRevalidateArgs, ClientRevalidateFn, ClientTransitionConfig, ClientUrlBuilder, ClientUrlHelpers, ClientUrlInterceptRecord, ClientUrlItem, ClientUrlItemInput, ClientUrlItems, ClientLayoutFn, ClientPathOptions, ClientUrlLoaderRecord, ClientPathFn, ClientUrlPatterns, ClientUrlRouteRecord, ClientUrlUse, } from "./types.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ClientUrlPatterns } from "./types.js";
|
|
2
|
+
export interface ClientUrlNavigationIntent {
|
|
3
|
+
readonly routeId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function setActiveInterceptTargets(targets: readonly string[] | undefined): void;
|
|
6
|
+
export interface ClientUrlNavigationPresentation {
|
|
7
|
+
readonly routeId: string;
|
|
8
|
+
clear(): void;
|
|
9
|
+
}
|
|
10
|
+
export declare function registerClientUrlGroup(definition: ClientUrlPatterns, mount: string, namePrefix: string, setIntent: (intent: ClientUrlNavigationIntent | null) => void): () => void;
|
|
11
|
+
export declare function beginClientUrlNavigation(targetUrl: URL, signal: AbortSignal): ClientUrlNavigationPresentation | null;
|
|
12
|
+
/**
|
|
13
|
+
* Run the held clientUrls route's per-loader revalidate() predicates and
|
|
14
|
+
* encode their decisions for the request header. Predicates are CLIENT code
|
|
15
|
+
* (declared in the "use client" definition module); only decisions cross the
|
|
16
|
+
* wire — the synthesized per-loader revalidate() on every materialized stub
|
|
17
|
+
* (server-projection.ts) reads them back by loader $$id.
|
|
18
|
+
*
|
|
19
|
+
* Decisions exist only for the loaders the client currently HOLDS: the local
|
|
20
|
+
* match of currentUrl. They matter when the server would re-evaluate those
|
|
21
|
+
* held loader segments — same-route param/search navs, actions, and stale
|
|
22
|
+
* restores. Cross-route targets render new segments unconditionally, so a
|
|
23
|
+
* decision would be ignored; we still compute against the current route since
|
|
24
|
+
* only its held segments are addressable.
|
|
25
|
+
*
|
|
26
|
+
* Returns null when no group is active, the current location is not a client
|
|
27
|
+
* route, or no predicate produced a decision that differs from the locked
|
|
28
|
+
* default — the server then applies defaults, which is also the behavior for
|
|
29
|
+
* requests that cannot carry decisions (no-JS, PE, prefetch, document loads).
|
|
30
|
+
*/
|
|
31
|
+
export declare function collectClientRevalidationDecisions(options: {
|
|
32
|
+
currentUrl: URL;
|
|
33
|
+
nextUrl: URL;
|
|
34
|
+
isAction: boolean;
|
|
35
|
+
actionId?: string;
|
|
36
|
+
stale: boolean;
|
|
37
|
+
}): string | null;
|
|
38
|
+
export declare function clearClientUrlNavigationRegistry(): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire protocol for CLIENT-RUN per-loader revalidation decisions.
|
|
3
|
+
*
|
|
4
|
+
* clientUrls() revalidate() predicates are declared in a "use client" module,
|
|
5
|
+
* so they cannot cross the projection boundary as functions — instead they
|
|
6
|
+
* EXECUTE in the browser and only their DECISIONS cross: the browser attaches
|
|
7
|
+
* this header to partial-navigation and action requests, and the synthesized
|
|
8
|
+
* per-loader revalidate() on every materialized loader stub reads it back
|
|
9
|
+
* (see materializeRouteItems in server-projection.ts).
|
|
10
|
+
*
|
|
11
|
+
* Trust model: same class as `_rsc_segments` — a decision can only make the
|
|
12
|
+
* CLIENT's own view staler (skip) or fresher (force), and the synthesized
|
|
13
|
+
* predicates exist only on client-urls loader stubs, so the header can never
|
|
14
|
+
* influence server-tree loaders. Requests without the header (no-JS, PE,
|
|
15
|
+
* prefetch, document loads) fall back to the locked server defaults.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CLIENT_REVALIDATION_HEADER = "X-Rango-Client-Reval";
|
|
18
|
+
export interface ClientRevalidationDecisions {
|
|
19
|
+
/** Loader $$ids whose client predicate said false (keep held data). */
|
|
20
|
+
readonly skip: readonly string[];
|
|
21
|
+
/** Loader $$ids whose client predicate said true against a false default. */
|
|
22
|
+
readonly force: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
export declare function encodeClientRevalidationDecisions(decisions: ClientRevalidationDecisions): string | null;
|
|
25
|
+
export declare function decodeClientRevalidationDecisions(headerValue: string | null): ClientRevalidationDecisions | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { SearchSchemaValue } from "../search-params.js";
|
|
2
|
+
import type { TrailingSlashMode } from "../types.js";
|
|
3
|
+
import type { UrlPatterns } from "../urls/pattern-types.js";
|
|
4
|
+
import type { ClientTransitionConfig, ClientUrlPatterns } from "./types.js";
|
|
5
|
+
export interface ClientUrlReference {
|
|
6
|
+
readonly $$typeof: symbol;
|
|
7
|
+
readonly $$id: string;
|
|
8
|
+
}
|
|
9
|
+
export type ClientUrlDefinitionSource = ClientUrlReference | ClientUrlPatterns;
|
|
10
|
+
export interface ClientUrlProjectionOptions {
|
|
11
|
+
readonly search?: Readonly<Record<string, SearchSchemaValue>>;
|
|
12
|
+
readonly trailingSlash?: TrailingSlashMode;
|
|
13
|
+
}
|
|
14
|
+
export interface ClientUrlProjectionRoute {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly pattern: string;
|
|
17
|
+
readonly name: string | null;
|
|
18
|
+
readonly options: ClientUrlProjectionOptions;
|
|
19
|
+
readonly loaderIds: readonly string[];
|
|
20
|
+
readonly hasLoading: boolean;
|
|
21
|
+
/** Indices into loaderIds of loaders declared loader(Def, { stream:
|
|
22
|
+
* "navigation" }); materialization passes the option through to the server
|
|
23
|
+
* loader() so document renders await them before first flush. Absent (=
|
|
24
|
+
* none) in projections serialized before stream support. */
|
|
25
|
+
readonly awaitedLoaderIndices?: readonly number[];
|
|
26
|
+
/** Data-only transition config (no `when` — server-tree only); absent in
|
|
27
|
+
* projections serialized before transition support. */
|
|
28
|
+
readonly transition?: Readonly<ClientTransitionConfig>;
|
|
29
|
+
}
|
|
30
|
+
export interface ClientUrlProjectionIntercept {
|
|
31
|
+
readonly slotName: `@${string}`;
|
|
32
|
+
/** Bare local target name; materialization re-dots it so the server
|
|
33
|
+
* intercept() helper composes it against the include's name prefix. */
|
|
34
|
+
readonly targetName: string;
|
|
35
|
+
readonly loaderIds: readonly string[];
|
|
36
|
+
readonly hasLoading: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface ClientUrlProjection {
|
|
39
|
+
readonly version: 1;
|
|
40
|
+
readonly routes: readonly ClientUrlProjectionRoute[];
|
|
41
|
+
/** Absent in projections serialized before intercept support; consumers
|
|
42
|
+
* must treat missing as empty. */
|
|
43
|
+
readonly intercepts?: readonly ClientUrlProjectionIntercept[];
|
|
44
|
+
}
|
|
45
|
+
export declare function serializeClientUrlPatterns(patterns: ClientUrlPatterns): ClientUrlProjection;
|
|
46
|
+
export declare function isClientUrlPatterns(value: unknown): value is ClientUrlPatterns;
|
|
47
|
+
export declare function isClientUrlReference(value: unknown): value is ClientUrlReference;
|
|
48
|
+
export declare function setClientUrlProjection(reference: string | ClientUrlReference, projection: ClientUrlProjection): void;
|
|
49
|
+
export declare function getClientUrlProjection(reference: string | ClientUrlReference): ClientUrlProjection | undefined;
|
|
50
|
+
export declare function clearClientUrlProjections(): void;
|
|
51
|
+
export declare function materializeClientUrlPatterns(reference: ClientUrlDefinitionSource, projection: ClientUrlProjection): UrlPatterns;
|
|
52
|
+
/**
|
|
53
|
+
* Adapt a clientUrls() source for `include()` mounting inside the canonical
|
|
54
|
+
* urls() tree. Materialization is DEFERRED into the returned handler: it
|
|
55
|
+
* resolves the discovery-installed projection at evaluation time (lazy include
|
|
56
|
+
* expansion, build manifest generation, dev per-request trie rebuild) — by
|
|
57
|
+
* then the routes-manifest bootstrap has installed projections, so registration
|
|
58
|
+
* order never matters. The include machinery applies the URL and route-name
|
|
59
|
+
* prefixes exactly as it does for any urls() module; surrounding RSC layouts,
|
|
60
|
+
* middleware scoping, and boundaries derive from the canonical server tree.
|
|
61
|
+
*/
|
|
62
|
+
export declare function clientUrlIncludePatterns(source: ClientUrlDefinitionSource): UrlPatterns;
|