@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
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from "react";
|
|
2
|
+
import type { LoaderDefinition, LoaderOptions, TransitionConfig } from "../types.js";
|
|
3
|
+
import type { TrieMatchResult } from "../router/trie-matching.js";
|
|
4
|
+
import type { PathOptions } from "../urls/pattern-types.js";
|
|
5
|
+
import type { SearchSchema } from "../search-params.js";
|
|
6
|
+
import type { TypedLayoutItem, TypedRouteItem } from "../route-types.js";
|
|
7
|
+
import type { ExtractRoutes } from "../urls/type-extraction.js";
|
|
8
|
+
import type { UnnamedRoute } from "../urls/pattern-types.js";
|
|
9
|
+
declare const CLIENT_URL_ITEM_BRAND: unique symbol;
|
|
10
|
+
declare const CLIENT_URL_PATTERNS_BRAND: unique symbol;
|
|
11
|
+
/** Opaque value returned by a clientUrls() helper. */
|
|
12
|
+
export interface ClientUrlItem {
|
|
13
|
+
readonly [CLIENT_URL_ITEM_BRAND]: void;
|
|
14
|
+
}
|
|
15
|
+
export type ClientUrlItemInput = ClientUrlItem | readonly ClientUrlItemInput[];
|
|
16
|
+
export type ClientUrlItems = readonly ClientUrlItemInput[];
|
|
17
|
+
export type ClientUrlUse = () => ClientUrlItems;
|
|
18
|
+
export type ClientPathOptions<TName extends string = string, TSearch extends SearchSchema = SearchSchema> = Pick<PathOptions<TName, TSearch>, "name" | "search" | "trailingSlash">;
|
|
19
|
+
export type ClientPathFn = <const TPattern extends string, const TName extends string = UnnamedRoute, const TSearch extends SearchSchema = {}>(pattern: TPattern, component: ComponentType, optionsOrUse?: ClientPathOptions<TName, TSearch> | ClientUrlUse, use?: ClientUrlUse) => ClientUrlItem & TypedRouteItem<TName, TPattern, unknown, TSearch>;
|
|
20
|
+
export type ClientLayoutFn = <const TItems extends ClientUrlItems>(component: ComponentType, children: () => TItems) => ClientUrlItem & TypedLayoutItem<ExtractRoutes<TItems>>;
|
|
21
|
+
/**
|
|
22
|
+
* Arguments a clientUrls() revalidate() predicate receives. A client-computable
|
|
23
|
+
* subset of the server ShouldRevalidateFn args — the predicate RUNS IN THE
|
|
24
|
+
* BROWSER (it is declared in a "use client" module and never crosses the
|
|
25
|
+
* projection boundary); only its decision is sent to the server. There is no
|
|
26
|
+
* `context` — no server handler context exists where this executes.
|
|
27
|
+
*/
|
|
28
|
+
export interface ClientRevalidateArgs {
|
|
29
|
+
/** Full URL of the page being navigated away from (current location). */
|
|
30
|
+
readonly currentUrl: URL;
|
|
31
|
+
/** Full URL of the navigation target (equals currentUrl for actions). */
|
|
32
|
+
readonly nextUrl: URL;
|
|
33
|
+
/** Route params of the held client route (definition-local match). */
|
|
34
|
+
readonly currentParams: Record<string, string>;
|
|
35
|
+
/** Route params for the navigation target (definition-local match). */
|
|
36
|
+
readonly nextParams: Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* The locked default decision for this loader, computed client-side with
|
|
39
|
+
* the same rules the server would apply: `true` on actions and when
|
|
40
|
+
* params/search changed, `false` otherwise. Return it for default behavior
|
|
41
|
+
* plus your own conditions.
|
|
42
|
+
*/
|
|
43
|
+
readonly defaultShouldRevalidate: boolean;
|
|
44
|
+
/** True when this is a stale history-entry background revalidation. */
|
|
45
|
+
readonly stale: boolean;
|
|
46
|
+
/** True when revalidation is triggered by a server action. */
|
|
47
|
+
readonly isAction: boolean;
|
|
48
|
+
/** The triggering server action's id, when isAction. */
|
|
49
|
+
readonly actionId?: string;
|
|
50
|
+
}
|
|
51
|
+
export type ClientRevalidateFn = (args: ClientRevalidateArgs) => boolean;
|
|
52
|
+
export interface ClientUrlLoaderRecord {
|
|
53
|
+
readonly loader: LoaderDefinition<any, any>;
|
|
54
|
+
/** Client-run per-loader revalidation predicates; empty = locked defaults. */
|
|
55
|
+
readonly revalidate: readonly ClientRevalidateFn[];
|
|
56
|
+
/**
|
|
57
|
+
* loader(Def, { stream: "navigation" }): document renders await this loader
|
|
58
|
+
* before first flush (see {@link LoaderOptions}). Projected into the server
|
|
59
|
+
* tree, where the per-isSSR entry stamping applies — client navigations
|
|
60
|
+
* stream regardless.
|
|
61
|
+
*/
|
|
62
|
+
readonly stream?: "navigation";
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The data-only subset of TransitionConfig a clientUrls() route may declare:
|
|
66
|
+
* ViewTransition classes/name plus the boundary opt-out. The `when` gate is a
|
|
67
|
+
* server-executed predicate and stays in the server tree — it cannot cross the
|
|
68
|
+
* "use client" projection boundary.
|
|
69
|
+
*/
|
|
70
|
+
export type ClientTransitionConfig = Pick<TransitionConfig, "enter" | "exit" | "update" | "share" | "default" | "name" | "viewTransition">;
|
|
71
|
+
export interface ClientUrlRouteRecord {
|
|
72
|
+
readonly id: string;
|
|
73
|
+
readonly pattern: string;
|
|
74
|
+
readonly name: string | undefined;
|
|
75
|
+
readonly options: Readonly<ClientPathOptions> | undefined;
|
|
76
|
+
readonly component: ComponentType;
|
|
77
|
+
readonly layouts: readonly ComponentType[];
|
|
78
|
+
readonly loaders: readonly ClientUrlLoaderRecord[];
|
|
79
|
+
readonly loading: ReactNode | undefined;
|
|
80
|
+
readonly transition: Readonly<ClientTransitionConfig> | undefined;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A restricted intercept declared inside clientUrls(). Compared to the server
|
|
84
|
+
* intercept() there is no `when` selector, no middleware, and the target must
|
|
85
|
+
* be a dot-local NAMED route in the same definition — every field is
|
|
86
|
+
* JSON-projectable, which is what makes the declaration legal in a
|
|
87
|
+
* "use client" module. `targetName` is stored bare (no leading dot).
|
|
88
|
+
*/
|
|
89
|
+
export interface ClientUrlInterceptRecord {
|
|
90
|
+
readonly slotName: `@${string}`;
|
|
91
|
+
readonly targetName: string;
|
|
92
|
+
readonly component: ComponentType;
|
|
93
|
+
readonly loaders: readonly ClientUrlLoaderRecord[];
|
|
94
|
+
readonly loading: ReactNode | undefined;
|
|
95
|
+
}
|
|
96
|
+
export interface ClientUrlHelpers {
|
|
97
|
+
readonly path: ClientPathFn;
|
|
98
|
+
readonly layout: ClientLayoutFn;
|
|
99
|
+
/**
|
|
100
|
+
* Attach a projected loader. The optional use callback may contain
|
|
101
|
+
* revalidate() only — a CLIENT-RUN per-loader predicate; its decision (not
|
|
102
|
+
* the function) is sent with the revalidation request.
|
|
103
|
+
*
|
|
104
|
+
* Pass `{ stream: "navigation" }` to await this loader before first flush
|
|
105
|
+
* on DOCUMENT requests (see {@link LoaderOptions}) — the opt-in for loaders
|
|
106
|
+
* whose data, handle pushes, or thrown notFound()/redirect() must be in the
|
|
107
|
+
* SSR'd HTML. Per-loader: a dynamic sibling keeps streaming.
|
|
108
|
+
*/
|
|
109
|
+
readonly loader: <TData>(definition: LoaderDefinition<TData>, optionsOrUse?: LoaderOptions | ClientUrlUse, use?: ClientUrlUse) => ClientUrlItem;
|
|
110
|
+
readonly loading: (component: ReactNode) => ClientUrlItem;
|
|
111
|
+
/**
|
|
112
|
+
* Per-loader revalidation predicate, valid inside a loader() use callback
|
|
113
|
+
* only. Runs IN THE BROWSER with client-computable args; return true to
|
|
114
|
+
* re-run the loader, false to keep held data. Absent predicates (and
|
|
115
|
+
* requests that carry no decisions: no-JS, PE, prefetch, document loads)
|
|
116
|
+
* follow the locked server defaults.
|
|
117
|
+
*/
|
|
118
|
+
readonly revalidate: (fn: ClientRevalidateFn) => ClientUrlItem;
|
|
119
|
+
/**
|
|
120
|
+
* Declare an intercept for a named route in THIS definition. The target is
|
|
121
|
+
* dot-local (`.detail`); scoping is module-local — only navigations whose
|
|
122
|
+
* origin is inside this clientUrls() group render the intercept. `use` may
|
|
123
|
+
* contain loader() and loading() only.
|
|
124
|
+
*/
|
|
125
|
+
readonly intercept: (slotName: `@${string}`, targetName: `.${string}`, component: ComponentType, use?: ClientUrlUse) => ClientUrlItem;
|
|
126
|
+
/**
|
|
127
|
+
* Opt THIS route into transition-driven navigation: the canonical commit
|
|
128
|
+
* holds previous content instead of re-streaming the loading() fallback,
|
|
129
|
+
* and on experimental React the config's ViewTransition classes apply.
|
|
130
|
+
* Data-only — no `when` gate (server-executed; declare it in the server
|
|
131
|
+
* tree). Valid inside a path() use callback only.
|
|
132
|
+
*/
|
|
133
|
+
readonly transition: (config: ClientTransitionConfig) => ClientUrlItem;
|
|
134
|
+
}
|
|
135
|
+
export type ClientUrlBuilder<TItems extends ClientUrlItems = ClientUrlItems> = (helpers: ClientUrlHelpers) => TItems;
|
|
136
|
+
export interface ClientUrlPatterns<TRoutes extends Record<string, any> = Record<string, any>> {
|
|
137
|
+
readonly __brand: "client-urls";
|
|
138
|
+
readonly routes: readonly ClientUrlRouteRecord[];
|
|
139
|
+
readonly intercepts: readonly ClientUrlInterceptRecord[];
|
|
140
|
+
readonly [CLIENT_URL_PATTERNS_BRAND]: void;
|
|
141
|
+
readonly _routes?: TRoutes;
|
|
142
|
+
match(pathname: string): TrieMatchResult | null;
|
|
143
|
+
}
|
|
144
|
+
export {};
|
package/dist/types/client.d.ts
CHANGED
|
@@ -42,8 +42,9 @@ import { type ClientErrorBoundaryFallbackProps } from "./types";
|
|
|
42
42
|
* }
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
export declare function Outlet({ name }?: {
|
|
45
|
+
export declare function Outlet({ name, fallback, }?: {
|
|
46
46
|
name?: `@${string}`;
|
|
47
|
+
fallback?: ReactNode;
|
|
47
48
|
}): ReactNode;
|
|
48
49
|
/**
|
|
49
50
|
* ParallelOutlet component - renders content for a named parallel slot
|
|
@@ -74,7 +75,7 @@ export declare function ParallelOutlet({ name }: {
|
|
|
74
75
|
name: `@${string}`;
|
|
75
76
|
}): ReactNode;
|
|
76
77
|
/**
|
|
77
|
-
* Hook to access outlet content programmatically
|
|
78
|
+
* Hook to access outlet content and descendant pending state programmatically.
|
|
78
79
|
*
|
|
79
80
|
* Alternative to using <Outlet /> component. Useful when you need
|
|
80
81
|
* direct access to the outlet content in your logic.
|
|
@@ -83,12 +84,18 @@ export declare function ParallelOutlet({ name }: {
|
|
|
83
84
|
* ```tsx
|
|
84
85
|
* function BlogLayout() {
|
|
85
86
|
* const outlet = useOutlet();
|
|
86
|
-
* return <div><h1>Blog</h1>{outlet}</div>;
|
|
87
|
+
* return <div aria-busy={outlet.pending}><h1>Blog</h1>{outlet.content}</div>;
|
|
87
88
|
* }
|
|
88
89
|
* ```
|
|
89
90
|
*/
|
|
90
|
-
export
|
|
91
|
+
export interface OutletState {
|
|
92
|
+
readonly content: ReactNode;
|
|
93
|
+
readonly pending: boolean;
|
|
94
|
+
}
|
|
95
|
+
export declare function useOutlet(): OutletState;
|
|
91
96
|
export { useLoader, useFetchLoader, useRefreshLoaders, type LoadFunction, type UseLoaderResult, type UseFetchLoaderResult, type UseLoaderOptions, } from "./use-loader.js";
|
|
97
|
+
export { clientUrls } from "./client-urls/client-urls.js";
|
|
98
|
+
export type { ClientUrlPatterns, ClientUrlRouteRecord, } from "./client-urls/client-urls.js";
|
|
92
99
|
/**
|
|
93
100
|
* Props for the ErrorBoundary component
|
|
94
101
|
*/
|
|
@@ -156,6 +163,7 @@ export { useNavigation } from "./browser/react/use-navigation.js";
|
|
|
156
163
|
export { useRouter } from "./browser/react/use-router.js";
|
|
157
164
|
export { usePathname } from "./browser/react/use-pathname.js";
|
|
158
165
|
export { useSearchParams } from "./browser/react/use-search-params.js";
|
|
166
|
+
export type { SearchParamsInit, SetSearchParams, SetSearchParamsOptions, } from "./browser/react/use-search-params.js";
|
|
159
167
|
export { useParams } from "./browser/react/use-params.js";
|
|
160
168
|
export { useNonce } from "./browser/react/nonce-context.js";
|
|
161
169
|
export type { RouterInstance, RouterNavigateOptions, ReadonlyURLSearchParams, ActionState, ActionLifecycleState, } from "./browser/types.js";
|
|
@@ -8,12 +8,15 @@
|
|
|
8
8
|
* The bundler uses the "react-server" export condition to select this file
|
|
9
9
|
* in RSC context, while the regular client.tsx is used in client components.
|
|
10
10
|
*/
|
|
11
|
-
export { Outlet, ParallelOutlet, useOutlet, useLoader, ErrorBoundary, type ErrorBoundaryProps, } from "./client.js";
|
|
11
|
+
export { Outlet, ParallelOutlet, useOutlet, type OutletState, useLoader, ErrorBoundary, type ErrorBoundaryProps, } from "./client.js";
|
|
12
12
|
export { useFetchLoader, useRefreshLoaders, type LoadFunction, type UseLoaderResult, type UseFetchLoaderResult, type UseLoaderOptions, } from "./use-loader.js";
|
|
13
13
|
export { createLoader } from "./route-definition.js";
|
|
14
|
+
export { clientUrls } from "./client-urls/client-urls.js";
|
|
15
|
+
export type { ClientUrlPatterns, ClientUrlRouteRecord, } from "./client-urls/client-urls.js";
|
|
14
16
|
export { useRouter } from "./browser/react/use-router.js";
|
|
15
17
|
export { usePathname } from "./browser/react/use-pathname.js";
|
|
16
18
|
export { useSearchParams } from "./browser/react/use-search-params.js";
|
|
19
|
+
export type { SearchParamsInit, SetSearchParams, SetSearchParamsOptions, } from "./browser/react/use-search-params.js";
|
|
17
20
|
export { useParams } from "./browser/react/use-params.js";
|
|
18
21
|
export { useNonce } from "./browser/react/nonce-context.js";
|
|
19
22
|
export { useMount } from "./browser/react/use-mount.js";
|
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Markers for loader-thrown AUTHORITY SIGNALS (notFound()/redirect()) on the
|
|
4
|
+
* reconstructed read-site error. Siblings of LOADER_ERROR_FALLBACK, routed
|
|
5
|
+
* differently by StreamedLoaderErrorBoundary: NOT_FOUND renders the
|
|
6
|
+
* server-rendered not-found UI riding the envelope; REDIRECT triggers a
|
|
7
|
+
* client replace-navigation to the (server-resolved, same-origin-guarded)
|
|
8
|
+
* target. Signals are control flow, not failures — they take precedence over
|
|
9
|
+
* the plain error-fallback path.
|
|
10
|
+
*
|
|
11
|
+
* Only decodeLoaderEntry (the read-site path — client components, so the
|
|
12
|
+
* throw lands in the router-owned boundary; during document SSR, Fizz emits
|
|
13
|
+
* the Suspense fallback and replays the throw at hydration) throws these.
|
|
14
|
+
* decodeLoaderResults runs during the SERVER tree build on forceAwait/action
|
|
15
|
+
* lanes, where a throw would collapse the whole payload — it routes signals
|
|
16
|
+
* through the errorFallback slot instead (same visual: the slot replaces the
|
|
17
|
+
* children under OutletProvider).
|
|
18
|
+
*/
|
|
19
|
+
export declare const LOADER_NOT_FOUND_FALLBACK: unique symbol;
|
|
20
|
+
export declare const LOADER_REDIRECT: unique symbol;
|
|
2
21
|
export declare function decodeLoaderResults(resolvedData: any[], loaderIds: string[]): {
|
|
3
22
|
loaderData: Record<string, any>;
|
|
4
23
|
errorFallback: ReactNode;
|
|
5
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Marker property carrying the errorBoundary() fallback on a read-site loader
|
|
27
|
+
* error. decodeLoaderEntry attaches the pre-rendered boundary node (produced
|
|
28
|
+
* server-side by loader-resolution) to the thrown error; the router-owned
|
|
29
|
+
* StreamedLoaderErrorBoundary above the readers (segment-system wires it for
|
|
30
|
+
* every loader-bearing segment) catches by this marker and renders the
|
|
31
|
+
* fallback — restoring the build-time errorFallback-swap contract for
|
|
32
|
+
* streamed loaders. Errors without the marker rethrow to the app's boundaries.
|
|
33
|
+
*/
|
|
34
|
+
export declare const LOADER_ERROR_FALLBACK: unique symbol;
|
|
35
|
+
/**
|
|
36
|
+
* Streaming useLoader: single-entry decode for read-site resolution. Mirrors
|
|
37
|
+
* decodeLoaderResults for one result. An error entry throws the reconstructed
|
|
38
|
+
* error (name/stack/code/cause preserved); when the entry carries an
|
|
39
|
+
* errorBoundary() fallback, the node rides the throw via
|
|
40
|
+
* LOADER_ERROR_FALLBACK for the boundary above the readers to render.
|
|
41
|
+
*/
|
|
42
|
+
export declare function decodeLoaderEntry(result: any): any;
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare class DataNotFoundError extends Error {
|
|
|
38
38
|
cause?: unknown;
|
|
39
39
|
constructor(message?: string, options?: ErrorOptions);
|
|
40
40
|
}
|
|
41
|
+
export declare function isDataNotFoundError(error: unknown): error is DataNotFoundError;
|
|
41
42
|
/**
|
|
42
43
|
* Convenience function to throw a DataNotFoundError
|
|
43
44
|
* Shorter syntax for common not-found scenarios
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* handle entries are deferred (`Promise`) values to await before any consumer
|
|
5
|
-
* sees them, and which pass through verbatim.
|
|
2
|
+
* Shared thenable predicate for framework orchestration. It decides which values
|
|
3
|
+
* participate in promise lifecycles and which pass through synchronously.
|
|
6
4
|
*
|
|
7
5
|
* Requires a CALLABLE `then` (`typeof obj.then === "function"`), not merely a
|
|
8
6
|
* `"then" in obj` membership check, so a non-promise carrying a `then` field
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export { RouteNotFoundError, DataNotFoundError, notFound, MiddlewareError, HandlerError, BuildError, DslContextError, InvalidHandlerError, RouterError, Skip, isSkip, } from "./errors.js";
|
|
13
13
|
export type { DocumentProps, DefaultEnv, RouteDefinition, RouteConfig, RouteDefinitionOptions, TrailingSlashMode, Handler, // Supports params object, path pattern, or route name
|
|
14
|
-
HandlerContext, ExtractParams, GenericParams, Middleware, RevalidateParams, Revalidate, ActionRef, RouteKeys, LoaderDefinition, LoaderFn, LoaderContext, FetchableLoaderOptions, LoadOptions, ErrorInfo, ErrorBoundaryFallbackProps, ErrorBoundaryHandler, ClientErrorBoundaryFallbackProps, NotFoundInfo, NotFoundBoundaryFallbackProps, NotFoundBoundaryHandler, ErrorPhase, OnErrorContext, OnErrorCallback, } from "./types.js";
|
|
14
|
+
HandlerContext, ExtractParams, GenericParams, Middleware, RevalidateParams, Revalidate, ActionRef, RouteKeys, LoaderDefinition, LoaderFn, LoaderContext, LoaderOptions, FetchableLoaderOptions, LoadOptions, ErrorInfo, ErrorBoundaryFallbackProps, ErrorBoundaryHandler, ClientErrorBoundaryFallbackProps, NotFoundInfo, NotFoundBoundaryFallbackProps, NotFoundBoundaryHandler, ErrorPhase, OnErrorContext, OnErrorCallback, } from "./types.js";
|
|
15
15
|
export type { SearchSchema, SearchSchemaValue, ResolveSearchSchema, RouteSearchParams, RouteParams, } from "./search-params.js";
|
|
16
16
|
export { TRACKING_SEARCH_PARAMS, type CacheSearchParams, } from "./cache/search-params-filter.js";
|
|
17
17
|
export { createLoader } from "./loader.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Executes a loader-thrown redirect() once mounted. The target was resolved
|
|
4
|
+
* through the soft-redirect same-origin rules server-side
|
|
5
|
+
* (wrapLoaderWithErrorHandling), so anything absolute AND cross-origin here is
|
|
6
|
+
* an explicit `{ external: true }` opt-in — those leave via location.replace
|
|
7
|
+
* (the SPA router cannot cross origins); everything else is a router
|
|
8
|
+
* replace-navigation. Renders nothing while the navigation commits.
|
|
9
|
+
*
|
|
10
|
+
* Own module (not route-content-wrapper.tsx) because BOTH consumers need it
|
|
11
|
+
* without a cycle: the StreamedLoaderErrorBoundary redirect branch (read-site
|
|
12
|
+
* throw path) and decodeLoaderResults (aggregate forceAwait/action path, which
|
|
13
|
+
* runs during the server tree build and cannot throw — it plants this element
|
|
14
|
+
* in the errorFallback slot instead).
|
|
15
|
+
*/
|
|
16
|
+
export declare function LoaderRedirect({ to, state, }: {
|
|
17
|
+
to: string;
|
|
18
|
+
/**
|
|
19
|
+
* Resolved `redirect(url, { state })` record off the loader-result marker.
|
|
20
|
+
* Delivered as the redirect navigation's state (same application path as
|
|
21
|
+
* the ServerRedirect lane in navigation-bridge.ts: buildHistoryState
|
|
22
|
+
* spreads the `__rsc_ls_*` keys into the target entry). `_skipCache`
|
|
23
|
+
* matches that lane — a cached segment commit must not skip the re-render
|
|
24
|
+
* that lets useLocationState read the fresh entry.
|
|
25
|
+
*/
|
|
26
|
+
state?: Record<string, unknown>;
|
|
27
|
+
}): ReactNode;
|
|
@@ -2,9 +2,21 @@ import { type Context, type ReactNode } from "react";
|
|
|
2
2
|
import type { ResolvedSegment } from "./types";
|
|
3
3
|
export interface OutletContextValue {
|
|
4
4
|
content: ReactNode;
|
|
5
|
+
/** Unresolved client-route work owned by descendants of this outlet. */
|
|
6
|
+
pending?: boolean;
|
|
5
7
|
parallel?: ResolvedSegment[];
|
|
6
8
|
segment?: ResolvedSegment;
|
|
7
9
|
loaderData?: Record<string, any>;
|
|
10
|
+
/**
|
|
11
|
+
* SPIKE (streaming useLoader): per-loader UNDECODED results keyed by loader
|
|
12
|
+
* $$id. A value may be a pending Promise (loader still streaming) or an
|
|
13
|
+
* already-settled result entry. useLoader `use()`es a pending value at the
|
|
14
|
+
* read site — implicit suspension to the nearest consumer Suspense boundary —
|
|
15
|
+
* and decodes via decodeLoaderEntry. Populated instead of `loaderData` on
|
|
16
|
+
* streaming lanes (plain navs, document SSR); forceAwait/action lanes keep
|
|
17
|
+
* the resolved `loaderData` record.
|
|
18
|
+
*/
|
|
19
|
+
loaderStreams?: Record<string, unknown>;
|
|
8
20
|
parent?: OutletContextValue | null;
|
|
9
21
|
/** Loading component for Suspense fallback (from segment's loading() definition) */
|
|
10
22
|
loading?: ReactNode;
|
|
@@ -3,10 +3,12 @@ import type { ResolvedSegment } from "./types.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Outlet content provider — stores parent context for useLoader chain walking.
|
|
5
5
|
*/
|
|
6
|
-
export declare function OutletProvider({ content, parallel, segment, loaderData, children, }: {
|
|
6
|
+
export declare function OutletProvider({ content, parallel, segment, loaderData, loaderStreams, pending, children, }: {
|
|
7
7
|
content: ReactNode;
|
|
8
8
|
parallel?: ResolvedSegment[];
|
|
9
9
|
segment?: ResolvedSegment;
|
|
10
10
|
loaderData?: Record<string, any>;
|
|
11
|
+
loaderStreams?: Record<string, unknown>;
|
|
12
|
+
pending?: boolean;
|
|
11
13
|
children: ReactNode;
|
|
12
14
|
}): ReactNode;
|
|
@@ -58,6 +58,10 @@ export declare function resolveSoftRedirectUrl(url: string, requestOrigin: strin
|
|
|
58
58
|
export declare function markExternalRedirect(response: Response): void;
|
|
59
59
|
/** Read the out-of-band `{ external: true }` brand off a Response. */
|
|
60
60
|
export declare function isExternalRedirect(response: Response): boolean;
|
|
61
|
+
/** Brand a redirect Response with its RESOLVED location-state record. */
|
|
62
|
+
export declare function attachRedirectState(response: Response, state: Record<string, unknown>): void;
|
|
63
|
+
/** Read the resolved location-state record off a redirect Response. */
|
|
64
|
+
export declare function getRedirectState(response: Response): Record<string, unknown> | undefined;
|
|
61
65
|
/**
|
|
62
66
|
* Reserved internal header name. No longer a trust signal -- the external
|
|
63
67
|
* opt-in is the out-of-band brand above. It is kept only so the redirect-rebuild
|
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import { Component } from "react";
|
|
2
3
|
import type { ResolvedSegment } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Router-owned error boundary for read-site loader errors. segment-system
|
|
6
|
+
* wraps every loader-bearing segment's children in one (unconditionally —
|
|
7
|
+
* streams and forceAwait lanes alike, so the tree shape never differs between
|
|
8
|
+
* navigation lanes; see docs/tree-structure.md). A loader error thrown by a
|
|
9
|
+
* suspending read carries its errorBoundary() fallback via
|
|
10
|
+
* LOADER_ERROR_FALLBACK (decodeLoaderEntry); this boundary renders that node,
|
|
11
|
+
* restoring the pre-streaming errorFallback-swap contract.
|
|
12
|
+
*
|
|
13
|
+
* Loader-thrown AUTHORITY SIGNALS ride sibling markers:
|
|
14
|
+
* - LOADER_NOT_FOUND_FALLBACK (notFound()): renders the SERVER-RENDERED
|
|
15
|
+
* not-found UI carried on the marker — nearest notFoundBoundary → router
|
|
16
|
+
* notFound option — zero extra fetches. Document lane: Fizz emitted the
|
|
17
|
+
* Suspense fallback and replays the throw at hydration, so the swap happens
|
|
18
|
+
* client-side (the HTTP status was already set opportunistically by the
|
|
19
|
+
* producer when the rejection won the flush race).
|
|
20
|
+
* - LOADER_REDIRECT (redirect()): mounts LoaderRedirect, which navigates.
|
|
21
|
+
*
|
|
22
|
+
* Errors without any marker rethrow to the app's own boundaries.
|
|
23
|
+
*/
|
|
24
|
+
export declare class StreamedLoaderErrorBoundary extends Component<{
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}, {
|
|
27
|
+
error: unknown;
|
|
28
|
+
}> {
|
|
29
|
+
state: {
|
|
30
|
+
error: unknown;
|
|
31
|
+
};
|
|
32
|
+
static getDerivedStateFromError(error: unknown): {
|
|
33
|
+
error: unknown;
|
|
34
|
+
};
|
|
35
|
+
render(): ReactNode;
|
|
36
|
+
}
|
|
3
37
|
/**
|
|
4
38
|
* Stable async wrapper component for route content
|
|
5
39
|
* Using a module-level component ensures React sees the same component reference
|
|
@@ -30,6 +64,13 @@ export declare function RouteContentWrapper({ content, fallback, segmentId, }: {
|
|
|
30
64
|
export interface LoaderBoundaryProps {
|
|
31
65
|
loaderDataPromise: Promise<any[]> | any[];
|
|
32
66
|
loaderIds: string[];
|
|
67
|
+
/**
|
|
68
|
+
* SPIKE (streaming useLoader): per-loader UNDECODED results from the
|
|
69
|
+
* producer (values or individually-pending promises). When present, the
|
|
70
|
+
* resolver passes them through instead of resolving the aggregate above
|
|
71
|
+
* the children; useLoader suspends per loader at the read site.
|
|
72
|
+
*/
|
|
73
|
+
loaderStreams?: Record<string, unknown>;
|
|
33
74
|
fallback?: ReactNode;
|
|
34
75
|
outletKey: string;
|
|
35
76
|
outletContent: ReactNode;
|
|
@@ -37,4 +78,4 @@ export interface LoaderBoundaryProps {
|
|
|
37
78
|
parallel?: ResolvedSegment[];
|
|
38
79
|
children: ReactNode;
|
|
39
80
|
}
|
|
40
|
-
export declare function LoaderBoundary({ loaderDataPromise, loaderIds, fallback, outletKey, outletContent, segment, parallel, children, }: LoaderBoundaryProps): ReactNode;
|
|
81
|
+
export declare function LoaderBoundary({ loaderDataPromise, loaderIds, loaderStreams, fallback, outletKey, outletContent, segment, parallel, children, }: LoaderBoundaryProps): ReactNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type { ExtractRouteParams, Handler, PartialCacheOptions, ErrorBoundaryHandler, LoaderDefinition, MiddlewareFn, NotFoundBoundaryHandler, ResolvedRouteMap, RouteDefinition, ShouldRevalidateFn, TransitionConfig } from "../types.js";
|
|
2
|
+
import type { ExtractRouteParams, Handler, PartialCacheOptions, ErrorBoundaryHandler, LoaderDefinition, LoaderOptions, MiddlewareFn, NotFoundBoundaryHandler, ResolvedRouteMap, RouteDefinition, ShouldRevalidateFn, TransitionConfig } from "../types.js";
|
|
3
3
|
import type { AllUseItems, LayoutItem, RouteItem, ParallelItem, InterceptItem, MiddlewareItem, RevalidateItem, LoaderItem, LoadingItem, ErrorBoundaryItem, NotFoundBoundaryItem, LayoutUseItem, RouteUseItem, ParallelUseItem, InterceptUseItem, LoaderUseItem, CacheItem, TransitionItem, UseItems } from "../route-types.js";
|
|
4
4
|
import type { StaticHandlerRef } from "../static-handler.js";
|
|
5
5
|
export type { AllUseItems, LayoutItem, RouteItem, ParallelItem, InterceptItem, MiddlewareItem, RevalidateItem, LoaderItem, ErrorBoundaryItem, NotFoundBoundaryItem, LayoutUseItem, RouteUseItem, ParallelUseItem, InterceptUseItem, CacheItem, } from "../route-types.js";
|
|
@@ -208,10 +208,21 @@ export type RouteHelpers<T extends RouteDefinition, TEnv> = {
|
|
|
208
208
|
* return <div>{data.name}</div>;
|
|
209
209
|
* }
|
|
210
210
|
* ```
|
|
211
|
+
* Pass `{ stream: "navigation" }` to await this loader before first flush on
|
|
212
|
+
* DOCUMENT requests (see {@link LoaderOptions}) — the opt-in for loaders whose
|
|
213
|
+
* data, handle pushes, or thrown notFound()/redirect() must be in the SSR'd
|
|
214
|
+
* HTML. Per-loader: a dynamic sibling in the same segment keeps streaming.
|
|
215
|
+
*
|
|
216
|
+
* ```typescript
|
|
217
|
+
* loader(ProductLoader, { stream: "navigation" }, () => [cache()]),
|
|
218
|
+
* loader(RecommendationsLoader), // still streams behind loading()
|
|
219
|
+
* ```
|
|
220
|
+
*
|
|
211
221
|
* @param loaderDef - Loader created with createLoader()
|
|
222
|
+
* @param optionsOrUse - Delivery options, or the use() callback when passing none
|
|
212
223
|
* @param use - Optional callback for loader-specific revalidation rules
|
|
213
224
|
*/
|
|
214
|
-
loader: <TData>(loaderDef: LoaderDefinition<TData>, use?: () => UseItems<LoaderUseItem>) => LoaderItem;
|
|
225
|
+
loader: <TData>(loaderDef: LoaderDefinition<TData>, optionsOrUse?: LoaderOptions | (() => UseItems<LoaderUseItem>), use?: () => UseItems<LoaderUseItem>) => LoaderItem;
|
|
215
226
|
/**
|
|
216
227
|
* Attach a loading component to the current route/layout
|
|
217
228
|
* ```typescript
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Error boundary and not-found boundary handling for Rango.
|
|
5
5
|
* Also includes the shared invokeOnError utility for error callback invocation.
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
7
|
+
import { type ReactNode } from "react";
|
|
8
8
|
import type { EntryData } from "../server/context";
|
|
9
9
|
import type { ResolvedSegment, ErrorInfo, ErrorBoundaryHandler, NotFoundInfo, NotFoundBoundaryHandler, ErrorPhase, OnErrorCallback } from "../types";
|
|
10
10
|
/**
|
|
@@ -69,6 +69,40 @@ export declare function createErrorSegment(errorInfo: ErrorInfo, fallback: React
|
|
|
69
69
|
export declare function createNotFoundInfo(error: {
|
|
70
70
|
message: string;
|
|
71
71
|
}, segmentId: string, segmentType: NotFoundInfo["segmentType"], pathname?: string): NotFoundInfo;
|
|
72
|
+
/** Router-level `createRouter({ notFound })` option shape. */
|
|
73
|
+
export type NotFoundComponentOption = ReactNode | ((props: {
|
|
74
|
+
pathname: string;
|
|
75
|
+
}) => ReactNode);
|
|
76
|
+
/**
|
|
77
|
+
* Pick the effective notFound fallback: nearest `notFoundBoundary`, else the
|
|
78
|
+
* router-level `notFound` option, else a plain default.
|
|
79
|
+
*
|
|
80
|
+
* The router option is resolved ONLY when no nearer boundary won — it may be a
|
|
81
|
+
* user render function doing arbitrary work, so computing it eagerly (as three
|
|
82
|
+
* earlier copies of this policy did) burned a full render on every 404 that a
|
|
83
|
+
* boundary was going to handle anyway.
|
|
84
|
+
*
|
|
85
|
+
* Every 404 origin routes through here — segment resolution
|
|
86
|
+
* (`segment-resolution/helpers.ts`), loader-thrown `notFound()`
|
|
87
|
+
* (`loader-resolution.ts`), and the unmatched-route path (`rsc/handler.ts`) —
|
|
88
|
+
* so the default text and the boundary-wins precedence cannot drift apart.
|
|
89
|
+
*/
|
|
90
|
+
export declare function resolveNotFoundFallback(boundary: ReactNode | NotFoundBoundaryHandler | null | undefined, notFoundComponent: NotFoundComponentOption | undefined, pathname: string | undefined): ReactNode | NotFoundBoundaryHandler;
|
|
91
|
+
/**
|
|
92
|
+
* The router-level default alone: `createRouter({ notFound })` rendered, or the
|
|
93
|
+
* plain fallback node. Separate from {@link resolveNotFoundFallback} for the
|
|
94
|
+
* unmatched-route path, which has no entry chain and therefore no boundary to
|
|
95
|
+
* consult — it gets a `ReactNode` back rather than a possible handler.
|
|
96
|
+
*/
|
|
97
|
+
export declare function resolveDefaultNotFound(notFoundComponent: NotFoundComponentOption | undefined, pathname: string | undefined): ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* Invoke a notFound fallback that may be a boundary handler or a plain node.
|
|
100
|
+
*
|
|
101
|
+
* Callers that cannot propagate a throw (the loader envelope) wrap this in
|
|
102
|
+
* their own try/catch; it deliberately does not swallow, so a throwing boundary
|
|
103
|
+
* still surfaces where that is the correct behavior.
|
|
104
|
+
*/
|
|
105
|
+
export declare function renderNotFoundFallback(fallback: ReactNode | NotFoundBoundaryHandler, notFoundInfo: NotFoundInfo): ReactNode;
|
|
72
106
|
/**
|
|
73
107
|
* Create a notFound segment with the fallback component
|
|
74
108
|
* Renders the fallback with not found info
|
|
@@ -19,6 +19,18 @@ export declare function evaluateInterceptWhen(intercept: InterceptEntry, selecto
|
|
|
19
19
|
* Find an intercept for the target route by walking up the entry chain.
|
|
20
20
|
* Returns the first (innermost) matching intercept along with the entry that defines it.
|
|
21
21
|
*/
|
|
22
|
+
/**
|
|
23
|
+
* Collect every intercept TARGET route name reachable from an origin entry —
|
|
24
|
+
* the same chain walk findInterceptForRoute() performs when this location is
|
|
25
|
+
* the navigation origin. Shipped in payload metadata so the browser-local
|
|
26
|
+
* clientUrls matcher can DECLINE its optimistic presentation for targets an
|
|
27
|
+
* intercept would claim (the committed result keeps the origin page + modal,
|
|
28
|
+
* so destination loading would flash and revert). Deliberately includes
|
|
29
|
+
* `when`-conditional intercepts: selectors need the live navigation context,
|
|
30
|
+
* so the browser stays conservative — worst case a non-intercepted navigation
|
|
31
|
+
* loses its optimistic loading, never the reverse.
|
|
32
|
+
*/
|
|
33
|
+
export declare function collectInterceptTargetNames(fromEntry: EntryData | null): string[];
|
|
22
34
|
export declare function findInterceptForRoute(targetRouteKey: string, fromEntry: EntryData | null, selectorContext?: InterceptSelectorContext | null, isAction?: boolean): {
|
|
23
35
|
intercept: InterceptEntry;
|
|
24
36
|
entry: EntryData;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { ReactNode } from "react";
|
|
7
7
|
import type { EntryData } from "../server/context";
|
|
8
|
-
import type { HandlerContext, LoaderDataResult, ErrorBoundaryHandler, ErrorInfo } from "../types";
|
|
8
|
+
import type { HandlerContext, LoaderDataResult, ErrorBoundaryHandler, ErrorInfo, NotFoundBoundaryHandler } from "../types";
|
|
9
9
|
/**
|
|
10
10
|
* Internal callback signature for loader error notifications.
|
|
11
11
|
* This is a simplified callback for internal use in wrapLoaderWithErrorHandling.
|
|
@@ -21,12 +21,34 @@ export type LoaderErrorCallback = (error: unknown, context: {
|
|
|
21
21
|
* Catches errors and converts them to LoaderDataResult objects that include
|
|
22
22
|
* error info and pre-rendered fallback UI when an error boundary is available.
|
|
23
23
|
*
|
|
24
|
+
* Loader-thrown SIGNALS are routed before error handling — they are control
|
|
25
|
+
* flow, not failures (onError is not invoked for them):
|
|
26
|
+
* - notFound(): the not-found UI is resolved and rendered HERE, server-side
|
|
27
|
+
* (nearest notFoundBoundary → router notFound option → default), exactly
|
|
28
|
+
* like the consumption lane (segment-resolution/helpers.ts), and rides the
|
|
29
|
+
* envelope's `fallback` — the client swaps with zero extra fetches. The
|
|
30
|
+
* response status is opportunistically set to 404 via the request stub: if
|
|
31
|
+
* the rejection settles before the document Response is constructed the
|
|
32
|
+
* status is a real 404; after, the stub write is inert (streamed fix-up
|
|
33
|
+
* only). Nav-lane payloads are 200 either way — the client owns 404
|
|
34
|
+
* presentation there.
|
|
35
|
+
* - redirect() (thrown 3xx Response): the target is resolved through the
|
|
36
|
+
* soft-redirect same-origin rules NOW so unsafe targets never leave the
|
|
37
|
+
* server; the client navigates when the entry decodes. No document-lane
|
|
38
|
+
* 302 — pre-stream redirect authority belongs to middleware (doctrine);
|
|
39
|
+
* a loader redirect is always a client-side navigate.
|
|
40
|
+
*
|
|
24
41
|
* @param onError - Optional callback invoked when loader errors occur.
|
|
25
42
|
* This has a simplified signature for internal use - the caller (typically
|
|
26
43
|
* wrapLoaderPromise in router.ts) is responsible for bridging to the full
|
|
27
44
|
* OnErrorCallback with complete request context (request, url, env, etc.).
|
|
28
45
|
*/
|
|
29
|
-
export declare function wrapLoaderWithErrorHandling<T>(promise: Promise<T>, entry: EntryData, segmentId: string, pathname: string, findNearestErrorBoundary: (entry: EntryData | null) => ReactNode | ErrorBoundaryHandler | null, createErrorInfo: (error: unknown, segmentId: string, segmentType: ErrorInfo["segmentType"]) => ErrorInfo, onError?: LoaderErrorCallback
|
|
46
|
+
export declare function wrapLoaderWithErrorHandling<T>(promise: Promise<T>, entry: EntryData, segmentId: string, pathname: string, findNearestErrorBoundary: (entry: EntryData | null) => ReactNode | ErrorBoundaryHandler | null, createErrorInfo: (error: unknown, segmentId: string, segmentType: ErrorInfo["segmentType"]) => ErrorInfo, onError?: LoaderErrorCallback, notFoundDeps?: {
|
|
47
|
+
findNearestNotFoundBoundary: (entry: EntryData | null) => ReactNode | NotFoundBoundaryHandler | null;
|
|
48
|
+
notFoundComponent?: ReactNode | ((props: {
|
|
49
|
+
pathname: string;
|
|
50
|
+
}) => ReactNode);
|
|
51
|
+
}): Promise<LoaderDataResult<T>>;
|
|
30
52
|
/**
|
|
31
53
|
* Set up the use() method on handler context to access loaders and handles.
|
|
32
54
|
*
|
|
@@ -43,10 +43,17 @@ interface EvaluateRevalidationOptions<TEnv> {
|
|
|
43
43
|
* reason flows into the trace. Callers use this when client-knowledge
|
|
44
44
|
* (e.g. parallel slot not in clientSegmentIds) should dictate the seed
|
|
45
45
|
* instead of the params/method-based heuristic.
|
|
46
|
+
*
|
|
47
|
+
* `floor` makes a `true` seed a guarantee rather than a suggestion: user fns
|
|
48
|
+
* may raise the decision but never lower it. Set it when the segment has no
|
|
49
|
+
* client-side content to fall back on, so a `false` would render nothing
|
|
50
|
+
* instead of keeping a cached copy — see the parallel-slot call site in
|
|
51
|
+
* segment-resolution/revalidation.ts.
|
|
46
52
|
*/
|
|
47
53
|
defaultOverride?: {
|
|
48
54
|
value: boolean;
|
|
49
55
|
reason: string;
|
|
56
|
+
floor?: boolean;
|
|
50
57
|
};
|
|
51
58
|
}
|
|
52
59
|
/**
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Runtime Route Trie Construction
|
|
3
3
|
*
|
|
4
|
-
* Builds a serializable trie from
|
|
4
|
+
* Builds a serializable trie from route manifest data for O(path_length)
|
|
5
5
|
* route matching at runtime.
|
|
6
6
|
*/
|
|
7
|
-
import type { FullManifest } from "./generate-manifest.js";
|
|
8
7
|
/**
|
|
9
8
|
* A response-type variant folded into a primary leaf's negotiate list. `pa` is
|
|
10
9
|
* the variant's own positional param-name array, carried so the runtime can
|
|
@@ -49,7 +48,7 @@ export interface TrieNode {
|
|
|
49
48
|
n: string;
|
|
50
49
|
c: TrieNode;
|
|
51
50
|
};
|
|
52
|
-
/** Suffix-param children keyed by suffix (e.g., ".html"
|
|
51
|
+
/** Suffix-param children keyed by suffix (e.g., ".html" -> { n: "productId", c: ... }) */
|
|
53
52
|
xp?: Record<string, {
|
|
54
53
|
n: string;
|
|
55
54
|
c: TrieNode;
|
|
@@ -66,7 +65,7 @@ export interface TrieNode {
|
|
|
66
65
|
};
|
|
67
66
|
}
|
|
68
67
|
/**
|
|
69
|
-
* Build a route trie from
|
|
68
|
+
* Build a route trie from route manifest data.
|
|
70
69
|
*
|
|
71
70
|
* @param routeManifest - Map of route name to full URL pattern
|
|
72
71
|
* @param routeToStaticPrefix - Map of route name to its entry's staticPrefix
|
|
@@ -76,14 +75,3 @@ export interface TrieNode {
|
|
|
76
75
|
* @param responseTypeRoutes - Optional map of route name to response type (sets leaf.rt)
|
|
77
76
|
*/
|
|
78
77
|
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;
|
|
79
|
-
/**
|
|
80
|
-
* Build a per-router trie from a generated manifest. This is the single
|
|
81
|
-
* construction path shared by build/discovery (discover-routers.ts, serialized
|
|
82
|
-
* into the production chunk) and the dev/HMR runtime rebuild
|
|
83
|
-
* (rsc/manifest-init.ts). Keeping one code path is what guarantees the dev
|
|
84
|
-
* runtime trie and the production serialized trie are byte-for-byte identical.
|
|
85
|
-
*
|
|
86
|
-
* Returns null when the manifest has no routes, matching the prior guard at
|
|
87
|
-
* both call sites.
|
|
88
|
-
*/
|
|
89
|
-
export declare function buildPerRouterTrie(manifest: FullManifest): TrieNode | null;
|