@rangojs/router 0.4.0 → 0.4.1
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 +19 -1
- package/dist/types/browser/event-controller.d.ts +4 -0
- package/dist/types/browser/link-interceptor.d.ts +17 -7
- package/dist/types/browser/navigation-bridge.d.ts +13 -1
- package/dist/types/browser/notify-listeners.d.ts +2 -0
- package/dist/types/browser/prefetch/cache.d.ts +1 -1
- package/dist/types/browser/prefetch/default-strategy.d.ts +12 -3
- package/dist/types/browser/prefetch/invalidation.d.ts +6 -0
- package/dist/types/browser/prefetch/loader.d.ts +3 -1
- package/dist/types/browser/prefetch/observer.d.ts +3 -6
- package/dist/types/browser/rango-state.d.ts +4 -0
- package/dist/types/browser/react/Link.d.ts +4 -9
- package/dist/types/browser/react/context.d.ts +3 -0
- package/dist/types/browser/rsc-router.d.ts +7 -2
- package/dist/types/browser/types.d.ts +1 -0
- package/dist/types/cache/cache-key-utils.d.ts +11 -3
- package/dist/types/cache/cache-scope.d.ts +82 -3
- package/dist/types/cache/cf/cf-cache-store.d.ts +2 -2
- package/dist/types/cache/index.d.ts +3 -1
- package/dist/types/cache/search-params-filter.d.ts +64 -0
- package/dist/types/cache/shell-snapshot.d.ts +4 -4
- package/dist/types/cache/types.d.ts +30 -2
- package/dist/types/cache/vercel/vercel-cache-store.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.rsc.d.ts +1 -0
- package/dist/types/router/match-middleware/cache-lookup.d.ts +13 -0
- package/dist/types/router/navigation-snapshot.d.ts +29 -0
- package/dist/types/router/router-options.d.ts +27 -3
- package/dist/types/rsc/shell-build-manifest.d.ts +7 -1
- package/dist/types/rsc/shell-serve.d.ts +7 -1
- package/dist/types/rsc/types.d.ts +17 -0
- package/dist/types/server/request-context.d.ts +57 -4
- package/dist/types/testing/render-route.d.ts +10 -1
- package/dist/types/testing/shell-status.d.ts +6 -3
- package/dist/types/vite/plugin-types.d.ts +1 -1
- package/dist/vite/index.js +5 -5
- package/package.json +23 -22
- package/skills/caching/SKILL.md +39 -0
- package/skills/comparison/references/framework-comparison.md +7 -1
- package/skills/links/SKILL.md +24 -0
- package/skills/ppr/SKILL.md +53 -4
- package/skills/router-setup/SKILL.md +7 -2
- package/skills/testing/client-components.md +15 -14
- package/skills/vercel/SKILL.md +1 -1
- package/src/browser/event-controller.ts +110 -11
- package/src/browser/link-interceptor.ts +469 -20
- package/src/browser/navigation-bridge.ts +71 -2
- package/src/browser/navigation-store.ts +24 -1
- package/src/browser/notify-listeners.ts +22 -0
- package/src/browser/prefetch/cache.ts +4 -2
- package/src/browser/prefetch/default-strategy.ts +43 -3
- package/src/browser/prefetch/invalidation.ts +30 -0
- package/src/browser/prefetch/loader.ts +19 -12
- package/src/browser/prefetch/observer.ts +50 -22
- package/src/browser/rango-state.ts +21 -0
- package/src/browser/react/Link.tsx +97 -88
- package/src/browser/react/NavigationProvider.tsx +1 -0
- package/src/browser/react/context.ts +4 -0
- package/src/browser/rsc-router.tsx +22 -9
- package/src/browser/types.ts +1 -0
- package/src/cache/cache-key-utils.ts +18 -4
- package/src/cache/cache-runtime.ts +7 -2
- package/src/cache/cache-scope.ts +152 -23
- package/src/cache/cf/cf-cache-store.ts +51 -16
- package/src/cache/document-cache.ts +7 -1
- package/src/cache/index.ts +7 -0
- package/src/cache/search-params-filter.ts +118 -0
- package/src/cache/shell-snapshot.ts +8 -4
- package/src/cache/types.ts +33 -2
- package/src/cache/vercel/vercel-cache-store.ts +17 -3
- package/src/index.rsc.ts +4 -0
- package/src/index.ts +6 -0
- package/src/router/match-middleware/cache-lookup.ts +146 -33
- package/src/router/match-middleware/cache-store.ts +70 -0
- package/src/router/navigation-snapshot.ts +46 -6
- package/src/router/router-options.ts +31 -4
- package/src/rsc/handler.ts +9 -0
- package/src/rsc/response-cache-serve.ts +1 -1
- package/src/rsc/rsc-rendering.ts +252 -27
- package/src/rsc/shell-build-manifest.ts +8 -1
- package/src/rsc/shell-capture.ts +5 -0
- package/src/rsc/shell-serve.ts +8 -2
- package/src/rsc/types.ts +17 -0
- package/src/server/request-context.ts +62 -3
- package/src/testing/dispatch.ts +21 -3
- package/src/testing/render-route.tsx +86 -17
- package/src/testing/shell-status.ts +20 -3
- package/src/vite/plugin-types.ts +1 -1
- package/src/vite/plugins/vercel-output.ts +2 -2
- 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-trie.d.ts +0 -89
- 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,214 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-safe type-safe href function
|
|
3
|
-
*
|
|
4
|
-
* This is a compile-time only href that validates paths against registered routes.
|
|
5
|
-
* No runtime route map lookup - just an identity function with TypeScript validation.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { href } from "rsc-router/client";
|
|
10
|
-
*
|
|
11
|
-
* href("/blog/my-post"); // ✓ matches /blog/:slug
|
|
12
|
-
* href("/shop/product/widget"); // ✓ matches /shop/product/:slug
|
|
13
|
-
* href("/invalid"); // ✗ TypeScript error
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
import type { GetRegisteredRoutes } from "./types.js";
|
|
17
|
-
import type { JsonSerialize } from "./serialize.js";
|
|
18
|
-
/**
|
|
19
|
-
* Parse constraint values into a union type for paths
|
|
20
|
-
* "a|b|c" → "a" | "b" | "c"
|
|
21
|
-
*/
|
|
22
|
-
type ParseConstraintPath<T extends string> = T extends `${infer First}|${infer Rest}` ? First | ParseConstraintPath<Rest> : T;
|
|
23
|
-
/**
|
|
24
|
-
* Convert a route pattern to a template literal type
|
|
25
|
-
*
|
|
26
|
-
* Supports:
|
|
27
|
-
* - Static: /about → "/about"
|
|
28
|
-
* - Dynamic: /blog/:slug → `/blog/${string}`
|
|
29
|
-
* - Optional: /:locale?/blog → "/blog" | `/${string}/blog`
|
|
30
|
-
* - Constrained: /:locale(en|gb)/blog → "/en/blog" | "/gb/blog"
|
|
31
|
-
* - Optional + Constrained: /:locale(en|gb)?/blog → "/blog" | "/en/blog" | "/gb/blog"
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* PatternToPath<"/blog/:slug"> = `/blog/${string}`
|
|
35
|
-
* PatternToPath<"/:locale?/blog"> = "/blog" | `/${string}/blog`
|
|
36
|
-
* PatternToPath<"/:locale(en|gb)/blog"> = "/en/blog" | "/gb/blog"
|
|
37
|
-
* PatternToPath<"/:locale(en|gb)?/blog"> = "/blog" | "/en/blog" | "/gb/blog"
|
|
38
|
-
*/
|
|
39
|
-
export type PatternToPath<T extends string> = T extends `${infer Before}:${infer _Name}(${infer Constraint})?/${infer After}` ? PatternToPath<`${Before}${After}`> | `${Before}${ParseConstraintPath<Constraint>}/${PatternToPath<After>}` : T extends `${infer Before}:${infer _Name}(${infer Constraint})?` ? Before | `${Before}${ParseConstraintPath<Constraint>}` : T extends `${infer Before}:${infer _Name}(${infer Constraint})/${infer After}` ? `${Before}${ParseConstraintPath<Constraint>}/${PatternToPath<After>}` : T extends `${infer Before}:${infer _Name}(${infer Constraint})` ? `${Before}${ParseConstraintPath<Constraint>}` : T extends `${infer Before}:${infer _Param}?/${infer After}` ? PatternToPath<`${Before}${After}`> | `${Before}${string}/${PatternToPath<After>}` : T extends `${infer Before}:${infer _Param}?` ? Before | `${Before}${string}` : T extends `${infer Before}:${infer _Param}/${infer After}` ? `${Before}${string}/${PatternToPath<After>}` : T extends `${infer Before}:${infer _Param}` ? `${Before}${string}` : T;
|
|
40
|
-
/**
|
|
41
|
-
* Allow optional query string (?...) and/or hash fragment (#...) suffix
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* WithSuffix<"/about"> = "/about" | "/about?..." | "/about#..." | "/about?...#..."
|
|
45
|
-
*/
|
|
46
|
-
type WithSuffix<T extends string> = T | `${T}?${string}` | `${T}#${string}` | `${T}?${string}#${string}`;
|
|
47
|
-
/**
|
|
48
|
-
* Helper type to get pattern from routes, handling string values and { path, response } objects
|
|
49
|
-
*/
|
|
50
|
-
type RoutePattern<TRoutes, K extends keyof TRoutes> = TRoutes[K] extends string ? TRoutes[K] : TRoutes[K] extends {
|
|
51
|
-
readonly path: infer P extends string;
|
|
52
|
-
} ? P : string;
|
|
53
|
-
/**
|
|
54
|
-
* Strip a query (`?…`) and/or hash (`#…`) suffix before matching, so a concrete
|
|
55
|
-
* URL like `/api/health?ts=1` still resolves to its route's response. Removes
|
|
56
|
-
* from the earliest of `?`/`#`: a `#` before the first `?` (the query is part of
|
|
57
|
-
* a fragment, e.g. `/health#top?x=1`) is handled, as is a `/:` that only appears
|
|
58
|
-
* inside the query (e.g. `/health?next=/:id`).
|
|
59
|
-
*/
|
|
60
|
-
type StripPathSuffix<T extends string> = T extends `${infer Base}?${string}` ? Base extends `${infer Frag}#${string}` ? Frag : Base : T extends `${infer Base}#${string}` ? Base : T;
|
|
61
|
-
/** Extract a route entry's response payload (or `never` for RSC routes). */
|
|
62
|
-
type ResponsePayloadOf<TRoutes, K extends keyof TRoutes> = TRoutes[K] extends {
|
|
63
|
-
readonly response: infer R;
|
|
64
|
-
} ? Exclude<R, Response> : never;
|
|
65
|
-
/**
|
|
66
|
-
* Look up the response payload for a route, keyed by either a route pattern
|
|
67
|
-
* (`/api/products/:id`) or a concrete path (`/api/products/123`). The same type
|
|
68
|
-
* serves a pattern lookup and a typed `fetch` wrapper that forwards a concrete
|
|
69
|
-
* `Rango.Path`:
|
|
70
|
-
*
|
|
71
|
-
* PathResponse<"/api/products/:id"> → Product // by pattern
|
|
72
|
-
* PathResponse<"/api/products/123"> → Product // by concrete path
|
|
73
|
-
*
|
|
74
|
-
* The query/hash suffix is stripped first; the stripped key is then treated as a
|
|
75
|
-
* pattern when it contains a `/:param` segment and matched exactly (precise even
|
|
76
|
-
* for nested dynamic routes), otherwise as a concrete path matched against each
|
|
77
|
-
* route's `PatternToPath` template. Because those holes are `${string}`
|
|
78
|
-
* (slash-greedy), a concrete path under a *nested* dynamic route can match several
|
|
79
|
-
* patterns and union their responses — pattern lookups do not have this
|
|
80
|
-
* looseness. RSC routes (no response) and unmatched keys resolve to `never`.
|
|
81
|
-
*/
|
|
82
|
-
type ResponsePayloadFor<TPath extends string, TRoutes = GetRegisteredRoutes> = ResponsePayloadForKey<StripPathSuffix<TPath>, TRoutes>;
|
|
83
|
-
type ResponsePayloadForKey<TKey extends string, TRoutes> = TKey extends `${string}/:${string}` ? {
|
|
84
|
-
[K in keyof TRoutes]: RoutePattern<TRoutes, K> extends TKey ? ResponsePayloadOf<TRoutes, K> : never;
|
|
85
|
-
}[keyof TRoutes] : {
|
|
86
|
-
[K in keyof TRoutes]: TKey extends PatternToPath<RoutePattern<TRoutes, K>> ? ResponsePayloadOf<TRoutes, K> : never;
|
|
87
|
-
}[keyof TRoutes];
|
|
88
|
-
/**
|
|
89
|
-
* Public response type for a route, keyed by pattern or concrete path. JSON
|
|
90
|
-
* response routes send the handler's return value verbatim (bare), so the
|
|
91
|
-
* payload is wrapped only in `JsonSerialize` to describe the JSON **wire** value
|
|
92
|
-
* a consumer receives from `fetch().then(r => r.json())` — e.g. a handler
|
|
93
|
-
* returning `{ createdAt: Date }` resolves here to `{ createdAt: string }`.
|
|
94
|
-
*/
|
|
95
|
-
export type PathResponse<TPath extends string, TRoutes = GetRegisteredRoutes> = JsonSerialize<ResponsePayloadFor<TPath, TRoutes>>;
|
|
96
|
-
/**
|
|
97
|
-
* Strip trailing slash from a path (e.g., "/blog/" -> "/blog" | "/blog/")
|
|
98
|
-
* Allows navigation to include() prefixes without requiring trailing slash
|
|
99
|
-
*/
|
|
100
|
-
type OptionalTrailingSlash<T extends string> = T extends `${infer Base}/` ? Base extends "" ? T : Base | T : T;
|
|
101
|
-
/**
|
|
102
|
-
* Union of all valid paths from registered routes
|
|
103
|
-
*
|
|
104
|
-
* Generated from Rango.RegisteredRoutes via module augmentation.
|
|
105
|
-
* Allows optional query strings and hash fragments.
|
|
106
|
-
*/
|
|
107
|
-
export type ValidPaths<TRoutes = GetRegisteredRoutes> = keyof TRoutes extends never ? `/${string}` : WithSuffix<{
|
|
108
|
-
[K in keyof TRoutes]: OptionalTrailingSlash<PatternToPath<RoutePattern<TRoutes, K>>>;
|
|
109
|
-
}[keyof TRoutes]>;
|
|
110
|
-
type GlobalPathResponse<TPattern extends string, TRoutes = GetRegisteredRoutes> = PathResponse<TPattern, TRoutes>;
|
|
111
|
-
/**
|
|
112
|
-
* Ambient path types on the `Rango` namespace.
|
|
113
|
-
*
|
|
114
|
-
* These live on the same global namespace consumers already augment for
|
|
115
|
-
* `Rango.Env` / `Rango.Vars`, so they are reachable with no import wherever the
|
|
116
|
-
* router's types are in scope. They are the public, recommended surface for
|
|
117
|
-
* typing anything that wraps `href()`. `ValidPaths` / `PathResponse` stay as the
|
|
118
|
-
* internal building blocks behind them.
|
|
119
|
-
*/
|
|
120
|
-
declare global {
|
|
121
|
-
namespace Rango {
|
|
122
|
-
/**
|
|
123
|
-
* Union of every valid route path accepted by `href()`.
|
|
124
|
-
*
|
|
125
|
-
* Type a wrapper's path parameter as `Rango.Path` so it shares `href()`'s
|
|
126
|
-
* compile-time validation against the registered routes:
|
|
127
|
-
*
|
|
128
|
-
* ```ts
|
|
129
|
-
* import { href } from "@rangojs/router/client";
|
|
130
|
-
*
|
|
131
|
-
* export const appHref = (path: Rango.Path) => href(path);
|
|
132
|
-
* ```
|
|
133
|
-
*
|
|
134
|
-
* Resolves from `Rango.RegisteredRoutes` when augmented, otherwise the
|
|
135
|
-
* auto-generated `Rango.GeneratedRouteMap`, otherwise a permissive
|
|
136
|
-
* `/${string}` fallback.
|
|
137
|
-
*/
|
|
138
|
-
type Path<TRoutes = GetRegisteredRoutes> = ValidPaths<TRoutes>;
|
|
139
|
-
/**
|
|
140
|
-
* Response payload for a route, looked up from the global route map by
|
|
141
|
-
* either a route pattern (`/api/products/:id`) or a concrete path
|
|
142
|
-
* (`/api/products/123`). Because it accepts a concrete `Rango.Path`, it
|
|
143
|
-
* doubles as the return type of a typed `fetch` wrapper:
|
|
144
|
-
*
|
|
145
|
-
* ```ts
|
|
146
|
-
* type Product = Rango.PathResponse<"/api/products/:id">; // by pattern
|
|
147
|
-
* type Same = Rango.PathResponse<"/api/products/42">; // by concrete path
|
|
148
|
-
*
|
|
149
|
-
* const get = async <T extends Rango.Path>(
|
|
150
|
-
* path: T,
|
|
151
|
-
* ): Promise<Rango.PathResponse<T>> =>
|
|
152
|
-
* fetch(href(path)).then((r) => r.json());
|
|
153
|
-
* ```
|
|
154
|
-
*
|
|
155
|
-
* The payload is the JSON **wire** shape (via `Rango.JsonSerialize`), not the
|
|
156
|
-
* handler's raw return — a handler returning `{ createdAt: Date }` resolves
|
|
157
|
-
* here to `{ createdAt: string }` (bare, no envelope), matching what
|
|
158
|
-
* `fetch().then(r => r.json())` actually yields.
|
|
159
|
-
*
|
|
160
|
-
* Only resolves once `Rango.RegisteredRoutes` carries response metadata (the
|
|
161
|
-
* generated map has paths and search but no payloads). Pass an explicit route
|
|
162
|
-
* map as the second argument to look up against a non-global map (rarely
|
|
163
|
-
* needed in app code).
|
|
164
|
-
*/
|
|
165
|
-
type PathResponse<TPath extends string, TRoutes = GetRegisteredRoutes> = GlobalPathResponse<TPath, TRoutes>;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Type-safe href function for client-side use
|
|
170
|
-
*
|
|
171
|
-
* Without mount: identity function, validates absolute paths at compile time.
|
|
172
|
-
* With mount: prepends mount path, for use with useMount() inside include() scopes.
|
|
173
|
-
*
|
|
174
|
-
* @param path - A valid path matching one of the registered route patterns
|
|
175
|
-
* @param mount - Optional mount prefix from useMount() for include-scoped paths
|
|
176
|
-
* @returns The resolved path
|
|
177
|
-
*
|
|
178
|
-
* @example
|
|
179
|
-
* ```typescript
|
|
180
|
-
* // Absolute paths (type-safe)
|
|
181
|
-
* href("/blog/hello"); // "/blog/hello"
|
|
182
|
-
* href("/shop/product/widget"); // "/shop/product/widget"
|
|
183
|
-
*
|
|
184
|
-
* // With mount (inside an include)
|
|
185
|
-
* const mount = useMount(); // "/articles"
|
|
186
|
-
* href("/", mount); // "/articles/"
|
|
187
|
-
* href("/my-post", mount); // "/articles/my-post"
|
|
188
|
-
*
|
|
189
|
-
* // Query strings and hashes pass through
|
|
190
|
-
* href("/blog/hello?page=1");
|
|
191
|
-
* href("/about#contact");
|
|
192
|
-
* ```
|
|
193
|
-
*/
|
|
194
|
-
export declare function href<T extends ValidPaths>(path: T, mount?: string): string;
|
|
195
|
-
/**
|
|
196
|
-
* Props shape returned by href.json() etc. for spreading on <Link>.
|
|
197
|
-
* Sets data-external to trigger hard navigation (skips RSC fetch).
|
|
198
|
-
*/
|
|
199
|
-
export interface ResponseHrefProps {
|
|
200
|
-
to: string;
|
|
201
|
-
"data-external": "";
|
|
202
|
-
}
|
|
203
|
-
type ResponseHrefFn = <T extends ValidPaths>(path: T, mount?: string) => ResponseHrefProps;
|
|
204
|
-
export declare namespace href {
|
|
205
|
-
const json: ResponseHrefFn;
|
|
206
|
-
const text: ResponseHrefFn;
|
|
207
|
-
const html: ResponseHrefFn;
|
|
208
|
-
const xml: ResponseHrefFn;
|
|
209
|
-
const md: ResponseHrefFn;
|
|
210
|
-
const image: ResponseHrefFn;
|
|
211
|
-
const stream: ResponseHrefFn;
|
|
212
|
-
const any: ResponseHrefFn;
|
|
213
|
-
}
|
|
214
|
-
export {};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @rangojs/router
|
|
3
|
-
*
|
|
4
|
-
* Single user-facing entrypoint for all router APIs.
|
|
5
|
-
*
|
|
6
|
-
* The "react-server" export condition selects index.rsc.ts (real implementations)
|
|
7
|
-
* vs this file (client stubs for server-only functions).
|
|
8
|
-
*
|
|
9
|
-
* For client-only exports (Outlet, useOutlet, hooks, components):
|
|
10
|
-
* import from "@rangojs/router/client"
|
|
11
|
-
*/
|
|
12
|
-
export { RouteNotFoundError, DataNotFoundError, notFound, MiddlewareError, HandlerError, BuildError, DslContextError, InvalidHandlerError, RouterError, Skip, isSkip, } from "./errors.js";
|
|
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";
|
|
15
|
-
export type { SearchSchema, SearchSchemaValue, ResolveSearchSchema, RouteSearchParams, RouteParams, } from "./search-params.js";
|
|
16
|
-
export { createLoader } from "./loader.js";
|
|
17
|
-
export type { RouteHelpers, RouteHandlers } from "./route-definition.js";
|
|
18
|
-
export type { TransitionConfig, TransitionWhenFn, TransitionWhenContext, ViewTransitionClass, } from "./types.js";
|
|
19
|
-
export type { RouteUseItem, LayoutUseItem, AllUseItems, UseItems, HandlerUseItem, } from "./route-types.js";
|
|
20
|
-
export type { ResponseHandler, ResponseHandlerContext, JsonResponseHandler, TextResponseHandler, JsonValue, ResponsePathFn, JsonResponsePathFn, TextResponsePathFn, RouteResponse, ProblemDetails, PartialPrerenderProps, } from "./urls.js";
|
|
21
|
-
export type { MiddlewareContext, CookieOptions } from "./router/middleware.js";
|
|
22
|
-
/**
|
|
23
|
-
* Error-throwing stub for server-only `urls` function.
|
|
24
|
-
*/
|
|
25
|
-
export declare function urls(): never;
|
|
26
|
-
/**
|
|
27
|
-
* Error-throwing stub for server-only `createRouter` function.
|
|
28
|
-
*/
|
|
29
|
-
export declare function createRouter(): never;
|
|
30
|
-
/**
|
|
31
|
-
* Error-throwing stub for server-only `redirect` function.
|
|
32
|
-
*/
|
|
33
|
-
export declare function redirect(): never;
|
|
34
|
-
export { createHandle, isHandle, type Handle } from "./handle.js";
|
|
35
|
-
export { DEFAULT_DEFER_TIMEOUT_MS, type DeferOptions, type HandlePush, type HandlePushFn, } from "./defer.js";
|
|
36
|
-
export { createVar, type ContextVar } from "./context-var.js";
|
|
37
|
-
export { nonce } from "./rsc/nonce.js";
|
|
38
|
-
/**
|
|
39
|
-
* SSR/client stub for server-only `Prerender` function.
|
|
40
|
-
*
|
|
41
|
-
* Returns a lightweight stub object instead of throwing so that the
|
|
42
|
-
* production SSR build can safely bundle the RSC entry chunk — the SSR
|
|
43
|
-
* bundler resolves `@rangojs/router` to this (SSR) entry, so Prerender
|
|
44
|
-
* calls in RSC code must not crash at module-evaluation time.
|
|
45
|
-
*/
|
|
46
|
-
export declare function Prerender(_handler?: any, _optionsOrId?: any, __injectedId?: string): any;
|
|
47
|
-
/**
|
|
48
|
-
* SSR/client stub for server-only `Passthrough` function.
|
|
49
|
-
*/
|
|
50
|
-
export declare function Passthrough(_handler?: any, _optionsOrId?: any, __injectedId?: string): any;
|
|
51
|
-
/**
|
|
52
|
-
* SSR/client stub for server-only `Static` function.
|
|
53
|
-
*
|
|
54
|
-
* Returns a lightweight stub object instead of throwing so that the
|
|
55
|
-
* production SSR build can safely bundle the RSC entry chunk — the SSR
|
|
56
|
-
* bundler resolves `@rangojs/router` to this (SSR) entry, so Static
|
|
57
|
-
* calls in RSC code must not crash at module-evaluation time.
|
|
58
|
-
*/
|
|
59
|
-
export declare function Static(_handler?: any, _optionsOrId?: any, __injectedId?: string): any;
|
|
60
|
-
/**
|
|
61
|
-
* Error-throwing stub for server-only `getRequestContext` function.
|
|
62
|
-
*/
|
|
63
|
-
export declare function getRequestContext(): never;
|
|
64
|
-
/**
|
|
65
|
-
* Error-throwing stub for server-only `cookies` function.
|
|
66
|
-
*/
|
|
67
|
-
export declare function cookies(): never;
|
|
68
|
-
/**
|
|
69
|
-
* Error-throwing stub for server-only `headers` function.
|
|
70
|
-
*/
|
|
71
|
-
export declare function headers(): never;
|
|
72
|
-
/**
|
|
73
|
-
* Client implementation of `invalidateClientCache()`. Unlike the server-only
|
|
74
|
-
* stubs above this is a REAL function under the `default` condition (it marks
|
|
75
|
-
* the client's caches stale); the `react-server` condition (index.rsc.ts)
|
|
76
|
-
* selects the server implementation that writes a rotated `Set-Cookie`.
|
|
77
|
-
*/
|
|
78
|
-
export { invalidateClientCache, keepClientCache, } from "./browser/invalidate-client-cache.js";
|
|
79
|
-
/**
|
|
80
|
-
* Error-throwing stub for server-only `createReverse` function.
|
|
81
|
-
*/
|
|
82
|
-
export declare function createReverse(): never;
|
|
83
|
-
export declare function layout(): never;
|
|
84
|
-
export declare function cache(): never;
|
|
85
|
-
export declare function middleware(): never;
|
|
86
|
-
export declare function revalidate(): never;
|
|
87
|
-
export declare function cacheTag(): never;
|
|
88
|
-
export declare function updateTag(): never;
|
|
89
|
-
export declare function revalidateTag(): never;
|
|
90
|
-
export declare function loader(): never;
|
|
91
|
-
export declare function loading(): never;
|
|
92
|
-
export declare function parallel(): never;
|
|
93
|
-
export declare function intercept(): never;
|
|
94
|
-
export declare function errorBoundary(): never;
|
|
95
|
-
export declare function notFoundBoundary(): never;
|
|
96
|
-
export declare function transition(): never;
|
|
97
|
-
export type { PublicRequestContext as RequestContext } from "./server/request-context.js";
|
|
98
|
-
export type { RequestScope, ExecutionContext } from "./types/request-scope.js";
|
|
99
|
-
export type { CookieStore, Cookie, ReadonlyHeaders, } from "./server/cookie-store.js";
|
|
100
|
-
export { Meta } from "./handles/meta.js";
|
|
101
|
-
export { Script, type ScriptConfig, type ScriptAttributes, } from "./handles/script.js";
|
|
102
|
-
export { Breadcrumbs } from "./handles/breadcrumbs.js";
|
|
103
|
-
export type { MetaDescriptor, MetaDescriptorBase } from "./router/types.js";
|
|
104
|
-
export type { BreadcrumbItem } from "./handles/breadcrumbs.js";
|
|
105
|
-
export type { ScopedReverseFunction, ReverseFunction, ExtractLocalRoutes, ParamsFor, } from "./reverse.js";
|
|
106
|
-
export { scopedReverse } from "./reverse.js";
|
|
107
|
-
export { createLocationState, type LocationStateDefinition, type LocationStateEntry, type LocationStateOptions, } from "./browser/react/location-state-shared.js";
|
|
108
|
-
export type { OTelTracer, OTelActiveSpanTracer, OTelSpan, OTelTracingOptions, } from "./router/telemetry-otel.js";
|
|
109
|
-
export type { TelemetrySink, TelemetryEvent, RequestStartEvent, RequestEndEvent, RequestErrorEvent, LoaderStartEvent, LoaderEndEvent, LoaderErrorEvent, HandlerErrorEvent, CacheSegmentStatus, CacheSegmentSignal, CacheDecisionEvent, RevalidationDecisionEvent, RequestTimeoutEvent, OriginCheckRejectedEvent, } from "./router/telemetry.js";
|
|
110
|
-
export type { RouterTracingConfig, TracePhase, TracePhaseToggles, TracingToggleOptions, } from "./router/tracing.js";
|
|
111
|
-
export { RouterTimeoutError } from "./router/timeout.js";
|
|
112
|
-
export type { RouterTimeouts, TimeoutPhase, TimeoutContext, } from "./router/timeout.js";
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @rangojs/router (react-server environment)
|
|
3
|
-
*
|
|
4
|
-
* This file is used when importing "@rangojs/router" from RSC (server components).
|
|
5
|
-
* It re-exports everything from the universal index.ts plus adds server-side
|
|
6
|
-
* implementations that replace the client-side error stubs.
|
|
7
|
-
*
|
|
8
|
-
* The bundler uses the "react-server" export condition to select this file
|
|
9
|
-
* in RSC context, while the regular index.ts is used in client components.
|
|
10
|
-
*/
|
|
11
|
-
export { RouteNotFoundError, DataNotFoundError, notFound, MiddlewareError, HandlerError, BuildError, DslContextError, InvalidHandlerError, RouterError, Skip, isSkip, } from "./index.js";
|
|
12
|
-
export type { DocumentProps, DefaultEnv, RouteDefinition, RouteConfig, RouteDefinitionOptions, TrailingSlashMode, Handler, HandlerContext, ExtractParams, GenericParams, Middleware, RevalidateParams, Revalidate, ActionRef, RouteKeys, LoaderDefinition, LoaderFn, LoaderContext, FetchableLoaderOptions, LoadOptions, ErrorInfo, ErrorBoundaryFallbackProps, ErrorBoundaryHandler, ClientErrorBoundaryFallbackProps, NotFoundInfo, NotFoundBoundaryFallbackProps, NotFoundBoundaryHandler, ErrorPhase, OnErrorContext, OnErrorCallback, TransitionConfig, TransitionWhenFn, TransitionWhenContext, ViewTransitionClass, } from "./types.js";
|
|
13
|
-
export type { RangoOptions, SSRStreamMode, SSROptions, ResolveStreamingContext, } from "./router.js";
|
|
14
|
-
export type { OriginCheckConfig, OriginCheckContext, OriginCheckPhase, } from "./rsc/origin-guard.js";
|
|
15
|
-
export type { ShellCaptureDebug, ShellCaptureDebugEvent, } from "./rsc/shell-capture.js";
|
|
16
|
-
export { createLoader, redirect, type RouteHelpers, type RouteHandlers, layout, cache, middleware, revalidate, loader, loading, parallel, intercept, errorBoundary, notFoundBoundary, transition, } from "./route-definition.js";
|
|
17
|
-
export type { RouteUseItem, LayoutUseItem, AllUseItems, UseItems, HandlerUseItem, } from "./route-types.js";
|
|
18
|
-
export { createHandle, isHandle, type Handle } from "./handle.js";
|
|
19
|
-
export { DEFAULT_DEFER_TIMEOUT_MS, type DeferOptions, type HandlePush, type HandlePushFn, } from "./defer.js";
|
|
20
|
-
export { createVar, type ContextVar } from "./context-var.js";
|
|
21
|
-
export { nonce } from "./rsc/nonce.js";
|
|
22
|
-
export { Prerender, Passthrough, type PrerenderHandlerDefinition, type PassthroughHandlerDefinition, type PrerenderOptions, type BuildContext, type StaticBuildContext, type GetParamsContext, type PrerenderPassthroughResult, } from "./prerender.js";
|
|
23
|
-
export { Static, type StaticHandlerDefinition, type StaticHandlerOptions, } from "./static-handler.js";
|
|
24
|
-
export { urls, type PathHelpers, type PathOptions, type PartialPrerenderProps, type UrlPatterns, type IncludeOptions, type IncludeItem, type RouteResponse, type ProblemDetails, type ResponseHandler, type ResponseHandlerContext, type JsonResponseHandler, type TextResponseHandler, type JsonValue, type ResponsePathFn, type JsonResponsePathFn, type TextResponsePathFn, } from "./urls.js";
|
|
25
|
-
export { createRouter, type Rango, type RootLayoutProps, type RouterRequestInput, } from "./router.js";
|
|
26
|
-
export type { HandlerCacheConfig } from "./rsc/types.js";
|
|
27
|
-
export { Meta } from "./handles/meta.js";
|
|
28
|
-
export { Script, type ScriptConfig, type ScriptAttributes, } from "./handles/script.js";
|
|
29
|
-
export { Breadcrumbs, type BreadcrumbItem } from "./handles/breadcrumbs.js";
|
|
30
|
-
export type { PublicRequestContext as RequestContext } from "./server/request-context.js";
|
|
31
|
-
import type { PublicRequestContext } from "./server/request-context.js";
|
|
32
|
-
import type { DefaultEnv } from "./types/global-namespace.js";
|
|
33
|
-
export type { RequestScope, ExecutionContext } from "./types/request-scope.js";
|
|
34
|
-
export declare const getRequestContext: <TEnv = DefaultEnv>() => PublicRequestContext<TEnv>;
|
|
35
|
-
export { cookies, headers, invalidateClientCache, keepClientCache, type CookieStore, type Cookie, type ReadonlyHeaders, } from "./server/cookie-store.js";
|
|
36
|
-
export { cacheTag } from "./cache/cache-tag.js";
|
|
37
|
-
export { updateTag, revalidateTag } from "./cache/tag-invalidation.js";
|
|
38
|
-
export type { MetaDescriptor, MetaDescriptorBase } from "./router/types.js";
|
|
39
|
-
export type { MiddlewareContext, CookieOptions, MiddlewareFn, } from "./router/middleware.js";
|
|
40
|
-
export type { ScopedReverseFunction, ReverseFunction, ExtractLocalRoutes, ParamsFor, } from "./reverse.js";
|
|
41
|
-
export { scopedReverse, createReverse } from "./reverse.js";
|
|
42
|
-
export type { SearchSchema, SearchSchemaValue, ResolveSearchSchema, RouteSearchParams, RouteParams, } from "./search-params.js";
|
|
43
|
-
export { createLocationState, type LocationStateDefinition, type LocationStateEntry, type LocationStateOptions, } from "./browser/react/location-state-shared.js";
|
|
44
|
-
export { createConsoleSink } from "./router/telemetry.js";
|
|
45
|
-
export { createOTelSink } from "./router/telemetry-otel.js";
|
|
46
|
-
export { createOTelTracing } from "./router/telemetry-otel.js";
|
|
47
|
-
export type { OTelTracer, OTelActiveSpanTracer, OTelSpan, OTelTracingOptions, } from "./router/telemetry-otel.js";
|
|
48
|
-
export type { TelemetrySink, TelemetryEvent, RequestStartEvent, RequestEndEvent, RequestErrorEvent, LoaderStartEvent, LoaderEndEvent, LoaderErrorEvent, HandlerErrorEvent, CacheSegmentStatus, CacheSegmentSignal, CacheDecisionEvent, RevalidationDecisionEvent, RequestTimeoutEvent, OriginCheckRejectedEvent, } from "./router/telemetry.js";
|
|
49
|
-
export type { RouterTracingConfig, TracePhase, TracePhaseToggles, TracingToggleOptions, } from "./router/tracing.js";
|
|
50
|
-
export { RouterTimeoutError } from "./router/timeout.js";
|
|
51
|
-
export type { RouterTimeouts, TimeoutPhase, TimeoutContext, } from "./router/timeout.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const INTERNAL_RANGO_DEBUG: boolean;
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LoaderStore — shared subscription model for `useLoader` / `useFetchLoader`.
|
|
3
|
-
*
|
|
4
|
-
* Each bucket key gets one entry that holds the latest committed snapshot plus a
|
|
5
|
-
* set of listeners. Snapshots are frozen and replaced atomically on mutation, so
|
|
6
|
-
* subscribers can compare snapshot identity and avoid unnecessary updates
|
|
7
|
-
* between real changes.
|
|
8
|
-
*
|
|
9
|
-
* The bucket key is `loader.$$id` by default, or `loader.$$id + key` when the
|
|
10
|
-
* hook is given an explicit client refresh `key`. Multiple buckets belonging to
|
|
11
|
-
* the same loader form a family (indexed by `loader.$$id`) so a navigation /
|
|
12
|
-
* route-context reset can clear them all at once via `clearFamily`.
|
|
13
|
-
*
|
|
14
|
-
* Mutations that come in for an old request id (e.g. a slow response that
|
|
15
|
-
* resolves after a newer load() was issued, or after a navigation cleared the
|
|
16
|
-
* entry) are silently dropped. `reserveRequestId` is the only way to claim the
|
|
17
|
-
* "latest" slot; `clear` bumps it too so pre-navigation in-flight loads cannot
|
|
18
|
-
* commit into the new route's context.
|
|
19
|
-
*
|
|
20
|
-
* Bucket lifecycle differs by registration:
|
|
21
|
-
* - Sticky buckets (a route-registered reader subscribed at least once) keep
|
|
22
|
-
* their entry after the last subscriber leaves so an in-flight load() can
|
|
23
|
-
* still commit on remount; they reset on navigation via `clearFamily`.
|
|
24
|
-
* - Ephemeral buckets (only ever subscribed by readers with no route context,
|
|
25
|
-
* i.e. keyed `useFetchLoader` of an unregistered loader) have no
|
|
26
|
-
* route-context reset trigger, so they are reference-counted: dropped once
|
|
27
|
-
* the last subscriber unsubscribes. The drop is deferred to a microtask and
|
|
28
|
-
* cancelled on resubscribe so a StrictMode / transition remount does not
|
|
29
|
-
* reclaim a bucket that is about to be reused, and is held until any
|
|
30
|
-
* in-flight load settles.
|
|
31
|
-
*
|
|
32
|
-
* The store is intentionally module-level: each browser tab is its own JS
|
|
33
|
-
* realm, so there is no cross-request pollution. Server renders never mutate
|
|
34
|
-
* the store — the hook falls back to `OutletContext.loaderData`.
|
|
35
|
-
*/
|
|
36
|
-
export interface LoaderEntry<T = unknown> {
|
|
37
|
-
readonly value: T | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Whether a load has committed a value to this bucket. Distinguishes a
|
|
40
|
-
* committed `null`/`undefined` result from "never loaded", so a loader that
|
|
41
|
-
* resolves to a falsy value is not mistaken for an empty bucket and is not
|
|
42
|
-
* overridden by the server-seeded context value.
|
|
43
|
-
*/
|
|
44
|
-
readonly hasValue: boolean;
|
|
45
|
-
readonly error: Error | null;
|
|
46
|
-
readonly isLoading: boolean;
|
|
47
|
-
/** Identifies the request that produced this snapshot. 0 means "no request". */
|
|
48
|
-
readonly requestId: number;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Options for `subscribe`.
|
|
52
|
-
*/
|
|
53
|
-
export interface SubscribeOptions {
|
|
54
|
-
/**
|
|
55
|
-
* Family id (`loader.$$id`) this bucket belongs to. `clearFamily` uses it to
|
|
56
|
-
* reach every keyed bucket of the same loader. Defaults to the bucket key.
|
|
57
|
-
*/
|
|
58
|
-
loaderId?: string;
|
|
59
|
-
/**
|
|
60
|
-
* When true, this subscription is from a reader with no route context (keyed
|
|
61
|
-
* `useFetchLoader` of an unregistered loader). Such buckets have no
|
|
62
|
-
* route-context reset trigger and are reference-counted instead. A bucket
|
|
63
|
-
* becomes sticky for the rest of its life as soon as any non-ephemeral
|
|
64
|
-
* subscriber attaches, and from then on resets via `clearFamily`.
|
|
65
|
-
*/
|
|
66
|
-
ephemeral?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Cross-loader refresh group name(s). Tags this bucket so `refreshGroups(name)`
|
|
69
|
-
* can refresh it alongside buckets of other loaders. A bucket may be tagged
|
|
70
|
-
* with several group names at once (pass an array); it is then refreshed when
|
|
71
|
-
* ANY of its groups is refreshed. Group membership follows subscriber presence:
|
|
72
|
-
* a bucket leaves a group when that group's last subscriber unsubscribes.
|
|
73
|
-
*/
|
|
74
|
-
group?: string | string[];
|
|
75
|
-
/**
|
|
76
|
-
* Plain-GET refresh thunk used by `refreshGroups`. Provided alongside `group`.
|
|
77
|
-
* Refreshes this bucket in place (no params/body) and rejects on failure.
|
|
78
|
-
*/
|
|
79
|
-
refetch?: () => Promise<void>;
|
|
80
|
-
}
|
|
81
|
-
export declare class LoaderStore {
|
|
82
|
-
private readonly entries;
|
|
83
|
-
/** loader.$$id -> set of bucket keys, so clearFamily() can reach every bucket. */
|
|
84
|
-
private readonly families;
|
|
85
|
-
/** refresh group name -> set of bucket keys, for refreshGroups(). */
|
|
86
|
-
private readonly groups;
|
|
87
|
-
private getOrCreate;
|
|
88
|
-
private registerFamily;
|
|
89
|
-
/**
|
|
90
|
-
* Subscribe to entry changes for `bucketKey`.
|
|
91
|
-
* Returns an unsubscribe function. A sticky bucket's entry is kept around even
|
|
92
|
-
* after the last subscriber leaves so that an in-flight `load()` can still
|
|
93
|
-
* commit if the consumer remounts. An ephemeral bucket is dropped once its
|
|
94
|
-
* last subscriber leaves (deferred, see maybeScheduleRefcountClear).
|
|
95
|
-
*/
|
|
96
|
-
subscribe(bucketKey: string, cb: () => void, options?: SubscribeOptions): () => void;
|
|
97
|
-
private addToGroup;
|
|
98
|
-
private releaseGroup;
|
|
99
|
-
/** Remove a bucket from every group it belongs to (used when it is dropped). */
|
|
100
|
-
private removeFromAllGroups;
|
|
101
|
-
/**
|
|
102
|
-
* Refresh every currently-mounted bucket tagged with ANY of the given group
|
|
103
|
-
* names, with a plain GET (no params/body). Accepts a single name or an array
|
|
104
|
-
* of names. A bucket that belongs to more than one of the named groups is
|
|
105
|
-
* refreshed exactly once (members are unioned and deduped by bucket key), as
|
|
106
|
-
* are multiple reads of one bucket. Resolves when all refreshes settle; rejects
|
|
107
|
-
* with an `AggregateError` of the failures if any member fails — each failing
|
|
108
|
-
* member also records its error on its own snapshot.
|
|
109
|
-
*/
|
|
110
|
-
refreshGroups(groups: string | string[]): Promise<void>;
|
|
111
|
-
/**
|
|
112
|
-
* Schedule a deferred drop for an ad-hoc (never-sticky) bucket whose last
|
|
113
|
-
* subscriber just left. Deferred to a microtask so a StrictMode / transition
|
|
114
|
-
* remount that resubscribes in the same tick cancels it.
|
|
115
|
-
*/
|
|
116
|
-
private maybeScheduleRefcountClear;
|
|
117
|
-
/** Remove a bucket entry entirely and prune it from its family/group indexes. */
|
|
118
|
-
private dropBucket;
|
|
119
|
-
/** Drop an ephemeral bucket that settled with no subscribers left. */
|
|
120
|
-
private dropIfSettled;
|
|
121
|
-
/**
|
|
122
|
-
* Returns the current snapshot for `bucketKey`. Stable reference between
|
|
123
|
-
* mutations — subscribers rely on this to avoid spurious re-renders.
|
|
124
|
-
* Returns `EMPTY_SNAPSHOT` (a singleton) when the entry has never been
|
|
125
|
-
* mutated or has been cleared.
|
|
126
|
-
*/
|
|
127
|
-
getSnapshot(bucketKey: string): LoaderEntry;
|
|
128
|
-
/**
|
|
129
|
-
* Reserve a fresh request id for an upcoming `load()` call. The returned id
|
|
130
|
-
* is the new "latest"; any older in-flight requests will fail their gating
|
|
131
|
-
* check on `finishData` / `finishError` / `finishLoading` and be dropped.
|
|
132
|
-
*
|
|
133
|
-
* Callers should follow with `beginRequest(id, requestId)` to flip the
|
|
134
|
-
* loading flag on AND clear any leftover error from a previous attempt
|
|
135
|
-
* — the latter matters for `throwOnError: false` consumers, which would
|
|
136
|
-
* otherwise keep showing the stale error throughout the retry.
|
|
137
|
-
*/
|
|
138
|
-
reserveRequestId(bucketKey: string): number;
|
|
139
|
-
/**
|
|
140
|
-
* Mark the request as in-flight: `isLoading = true`, `error = null`.
|
|
141
|
-
* Combines the two operations so a retry doesn't render the previous
|
|
142
|
-
* error during the new request. Gated on `requestId === latestRequestId`
|
|
143
|
-
* for symmetry with the other mutators.
|
|
144
|
-
*/
|
|
145
|
-
beginRequest(bucketKey: string, requestId: number): void;
|
|
146
|
-
/**
|
|
147
|
-
* Commit a successful result. No-op if `requestId` is not the latest
|
|
148
|
-
* (a newer `load()` was issued or `clear()` ran). Clearing `error` is
|
|
149
|
-
* intentional: a successful refetch should hide the previous failure.
|
|
150
|
-
*/
|
|
151
|
-
finishData<T>(bucketKey: string, requestId: number, value: T): void;
|
|
152
|
-
/**
|
|
153
|
-
* Commit an error. Preserves the last good `value` so consumers can keep
|
|
154
|
-
* showing previous data while displaying the error if they choose. No-op
|
|
155
|
-
* if `requestId` is not the latest.
|
|
156
|
-
*/
|
|
157
|
-
finishError(bucketKey: string, requestId: number, error: Error): void;
|
|
158
|
-
/**
|
|
159
|
-
* Update loading flag. Gated on `requestId` to fix the race where an old
|
|
160
|
-
* load() finishes after a new one started — its `setLoading(false)` would
|
|
161
|
-
* otherwise hide the new request's spinner.
|
|
162
|
-
*/
|
|
163
|
-
setLoading(bucketKey: string, requestId: number, isLoading: boolean): void;
|
|
164
|
-
/**
|
|
165
|
-
* Reset a single bucket entry. Bumps `latestRequestId` so any in-flight
|
|
166
|
-
* `load()` whose promise is still pending will fail its gate when it resolves
|
|
167
|
-
* and be dropped — prevents pre-navigation loads from clobbering the new
|
|
168
|
-
* route's context. The entry itself is kept (sticky-bucket semantics).
|
|
169
|
-
*/
|
|
170
|
-
clear(bucketKey: string): void;
|
|
171
|
-
/**
|
|
172
|
-
* Reset every sticky bucket belonging to `loaderId`. Called on navigation /
|
|
173
|
-
* route-context change: all route-registered reads of the loader (keyed or
|
|
174
|
-
* not) drop back to seeding from fresh `loaderData`. Ephemeral buckets are
|
|
175
|
-
* intentionally left alone — they are governed by subscriber refcount, so a
|
|
176
|
-
* persistent keyed reader outside the outlet keeps its value across a
|
|
177
|
-
* navigation rather than blanking out.
|
|
178
|
-
*/
|
|
179
|
-
clearFamily(loaderId: string): void;
|
|
180
|
-
private notify;
|
|
181
|
-
/**
|
|
182
|
-
* Test-only escape hatch. Drops every entry. Production code should never
|
|
183
|
-
* call this; the store is process-scoped and lives for the tab's lifetime.
|
|
184
|
-
* @internal
|
|
185
|
-
*/
|
|
186
|
-
reset(): void;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Module-level singleton. Each browser tab gets its own; SSR never mutates it.
|
|
190
|
-
* The hook falls through to `OutletContext.loaderData` during the server render.
|
|
191
|
-
*/
|
|
192
|
-
export declare const loaderStore: LoaderStore;
|
|
193
|
-
export declare const EMPTY_LOADER_SNAPSHOT: LoaderEntry;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @rangojs/router/loader (client version)
|
|
3
|
-
*
|
|
4
|
-
* Client-only stub for createLoader. Returns a minimal loader definition
|
|
5
|
-
* ({ __brand, $$id }) that can be passed to hooks like useLoader.
|
|
6
|
-
* The actual loader function is not included -- it only exists on the server.
|
|
7
|
-
*
|
|
8
|
-
* For export-only loader files, the Vite plugin replaces the entire file with
|
|
9
|
-
* object literals (bypassing this function). Those stubs only contain
|
|
10
|
-
* { __brand, $$id }.
|
|
11
|
-
* This function only runs when loaders are in mixed files (not export-only).
|
|
12
|
-
*
|
|
13
|
-
* The $$id is injected by the Vite exposeInternalIds plugin.
|
|
14
|
-
*/
|
|
15
|
-
import type { FetchableLoaderOptions, LoaderDefinition, LoaderFn } from "./types.js";
|
|
16
|
-
export declare function createLoader<T>(fn: LoaderFn<T, Record<string, string | undefined>, any>): LoaderDefinition<Awaited<T>, Record<string, string | undefined>>;
|
|
17
|
-
export declare function createLoader<T>(fn: LoaderFn<T, Record<string, string | undefined>, any>, fetchable: true): LoaderDefinition<Awaited<T>, Record<string, string | undefined>>;
|
|
18
|
-
export declare function createLoader<T>(fn: LoaderFn<T, Record<string, string | undefined>, any>, options: FetchableLoaderOptions): LoaderDefinition<Awaited<T>, Record<string, string | undefined>>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* rsc-router/loader (RSC/server version)
|
|
3
|
-
*
|
|
4
|
-
* Server-side createLoader implementation with full loader functionality.
|
|
5
|
-
* Only used in react-server context via export conditions.
|
|
6
|
-
*
|
|
7
|
-
* For non-fetchable loaders: returns a loader definition with fn included
|
|
8
|
-
* For fetchable loaders: stores fn in registry and returns a serializable loader
|
|
9
|
-
*
|
|
10
|
-
* The $$id is injected by the Vite exposeInternalIds plugin as a hidden parameter.
|
|
11
|
-
* Users don't need to pass any name - IDs are auto-generated from file path.
|
|
12
|
-
*/
|
|
13
|
-
import type { FetchableLoaderOptions, LoaderDefinition, LoaderFn } from "./types.js";
|
|
14
|
-
import { getFetchableLoader } from "./server/fetchable-loader-store.js";
|
|
15
|
-
export { getFetchableLoader };
|
|
16
|
-
export declare function createLoader<T>(fn: LoaderFn<T, Record<string, string | undefined>, any>): LoaderDefinition<Awaited<T>, Record<string, string | undefined>>;
|
|
17
|
-
export declare function createLoader<T>(fn: LoaderFn<T, Record<string, string | undefined>, any>, fetchable: true): LoaderDefinition<Awaited<T>, Record<string, string | undefined>>;
|
|
18
|
-
export declare function createLoader<T>(fn: LoaderFn<T, Record<string, string | undefined>, any>, options: FetchableLoaderOptions): LoaderDefinition<Awaited<T>, Record<string, string | undefined>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function missingInjectedIdError(kind: "Loader" | "Handle", fnName: "createLoader" | "createHandle"): Error;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Context, type ReactNode } from "react";
|
|
2
|
-
import type { ResolvedSegment } from "./types";
|
|
3
|
-
export interface OutletContextValue {
|
|
4
|
-
content: ReactNode;
|
|
5
|
-
parallel?: ResolvedSegment[];
|
|
6
|
-
segment?: ResolvedSegment;
|
|
7
|
-
loaderData?: Record<string, any>;
|
|
8
|
-
parent?: OutletContextValue | null;
|
|
9
|
-
/** Loading component for Suspense fallback (from segment's loading() definition) */
|
|
10
|
-
loading?: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
export declare const OutletContext: Context<OutletContextValue | null>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
import type { ResolvedSegment } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Outlet content provider — stores parent context for useLoader chain walking.
|
|
5
|
-
*/
|
|
6
|
-
export declare function OutletProvider({ content, parallel, segment, loaderData, children, }: {
|
|
7
|
-
content: ReactNode;
|
|
8
|
-
parallel?: ResolvedSegment[];
|
|
9
|
-
segment?: ResolvedSegment;
|
|
10
|
-
loaderData?: Record<string, any>;
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
}): ReactNode;
|