@rangojs/router 0.4.3 → 0.5.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/dist/types/browser/prefetch/cache.d.ts +31 -2
- package/dist/types/cache/cf/cf-cache-store.d.ts +2 -0
- package/dist/types/cache/types.d.ts +39 -6
- package/dist/types/route-definition/helpers-types.d.ts +5 -4
- package/dist/types/rsc/capture-queue.d.ts +19 -3
- package/dist/types/rsc/shell-build-manifest.d.ts +2 -2
- package/dist/types/rsc/shell-capture.d.ts +22 -2
- package/dist/types/rsc/shell-serve.d.ts +18 -12
- package/dist/types/static-handler.d.ts +15 -1
- package/dist/types/urls/path-helper-types.d.ts +6 -7
- package/dist/types.backup/__internal.d.ts +127 -0
- package/dist/types.backup/bin/rango.d.ts +1 -0
- package/dist/types.backup/browser/action-coordinator.d.ts +57 -0
- package/dist/types.backup/browser/action-fence.d.ts +33 -0
- package/dist/types.backup/browser/app-shell.d.ts +34 -0
- package/dist/types.backup/browser/app-version.d.ts +6 -0
- package/dist/types.backup/browser/connection-warmup.d.ts +31 -0
- package/dist/types.backup/browser/cookie-name.d.ts +66 -0
- package/dist/types.backup/browser/event-controller.d.ts +221 -0
- package/dist/types.backup/browser/history-state.d.ts +26 -0
- package/dist/types.backup/browser/index.d.ts +1 -0
- package/dist/types.backup/browser/intercept-utils.d.ts +30 -0
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +17 -0
- package/dist/types.backup/browser/link-interceptor.d.ts +43 -0
- package/dist/types.backup/browser/logging.d.ts +33 -0
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +38 -0
- package/dist/types.backup/browser/navigation-bridge.d.ts +27 -0
- package/dist/types.backup/browser/navigation-client.d.ts +17 -0
- package/dist/types.backup/browser/navigation-store-handle.d.ts +25 -0
- package/dist/types.backup/browser/navigation-store.d.ts +95 -0
- package/dist/types.backup/browser/navigation-transaction.d.ts +75 -0
- package/dist/types.backup/browser/network-error-handler.d.ts +35 -0
- package/dist/types.backup/browser/partial-update.d.ts +61 -0
- package/dist/types.backup/browser/prefetch/cache.d.ts +183 -0
- package/dist/types.backup/browser/prefetch/fetch.d.ts +52 -0
- package/dist/types.backup/browser/prefetch/observer.d.ts +27 -0
- package/dist/types.backup/browser/prefetch/policy.d.ts +13 -0
- package/dist/types.backup/browser/prefetch/queue.d.ts +48 -0
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +28 -0
- package/dist/types.backup/browser/rango-state.d.ts +52 -0
- package/dist/types.backup/browser/react/Link.d.ts +140 -0
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +88 -0
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +78 -0
- package/dist/types.backup/browser/react/context.d.ts +54 -0
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +35 -0
- package/dist/types.backup/browser/react/index.d.ts +1 -0
- package/dist/types.backup/browser/react/location-state-shared.d.ts +162 -0
- package/dist/types.backup/browser/react/location-state.d.ts +29 -0
- package/dist/types.backup/browser/react/mount-context.d.ts +23 -0
- package/dist/types.backup/browser/react/nonce-context.d.ts +14 -0
- package/dist/types.backup/browser/react/shallow-equal.d.ts +5 -0
- package/dist/types.backup/browser/react/use-action.d.ts +61 -0
- package/dist/types.backup/browser/react/use-handle.d.ts +21 -0
- package/dist/types.backup/browser/react/use-href.d.ts +32 -0
- package/dist/types.backup/browser/react/use-link-status.d.ts +36 -0
- package/dist/types.backup/browser/react/use-mount.d.ts +24 -0
- package/dist/types.backup/browser/react/use-navigation.d.ts +15 -0
- package/dist/types.backup/browser/react/use-params.d.ts +21 -0
- package/dist/types.backup/browser/react/use-pathname.d.ts +13 -0
- package/dist/types.backup/browser/react/use-reverse.d.ts +40 -0
- package/dist/types.backup/browser/react/use-router.d.ts +23 -0
- package/dist/types.backup/browser/react/use-search-params.d.ts +19 -0
- package/dist/types.backup/browser/react/use-segments.d.ts +29 -0
- package/dist/types.backup/browser/response-adapter.d.ts +58 -0
- package/dist/types.backup/browser/rsc-router.d.ts +141 -0
- package/dist/types.backup/browser/scroll-restoration.d.ts +103 -0
- package/dist/types.backup/browser/segment-reconciler.d.ts +74 -0
- package/dist/types.backup/browser/segment-structure-assert.d.ts +16 -0
- package/dist/types.backup/browser/server-action-bridge.d.ts +29 -0
- package/dist/types.backup/browser/types.d.ts +530 -0
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +28 -0
- package/dist/types.backup/build/collect-fallback-refs.d.ts +5 -0
- package/dist/types.backup/build/generate-manifest.d.ts +100 -0
- package/dist/types.backup/build/generate-route-types.d.ts +8 -0
- package/dist/types.backup/build/index.d.ts +21 -0
- package/dist/types.backup/build/prefix-tree-utils.d.ts +56 -0
- package/dist/types.backup/build/route-trie.d.ts +89 -0
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +3 -0
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/codegen.d.ts +16 -0
- package/dist/types.backup/build/route-types/include-resolution.d.ts +74 -0
- package/dist/types.backup/build/route-types/param-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +18 -0
- package/dist/types.backup/build/route-types/router-processing.d.ts +82 -0
- package/dist/types.backup/build/route-types/scan-filter.d.ts +17 -0
- package/dist/types.backup/build/route-types/source-scan.d.ts +13 -0
- package/dist/types.backup/build/runtime-discovery.d.ts +24 -0
- package/dist/types.backup/cache/background-task.d.ts +21 -0
- package/dist/types.backup/cache/cache-error.d.ts +71 -0
- package/dist/types.backup/cache/cache-key-utils.d.ts +35 -0
- package/dist/types.backup/cache/cache-policy.d.ts +59 -0
- package/dist/types.backup/cache/cache-runtime.d.ts +51 -0
- package/dist/types.backup/cache/cache-scope.d.ts +134 -0
- package/dist/types.backup/cache/cache-tag.d.ts +79 -0
- package/dist/types.backup/cache/cf/cf-base64.d.ts +4 -0
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +105 -0
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +481 -0
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +300 -0
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +22 -0
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +15 -0
- package/dist/types.backup/cache/cf/index.d.ts +3 -0
- package/dist/types.backup/cache/document-cache.d.ts +69 -0
- package/dist/types.backup/cache/handle-capture.d.ts +23 -0
- package/dist/types.backup/cache/handle-snapshot.d.ts +39 -0
- package/dist/types.backup/cache/index.d.ts +7 -0
- package/dist/types.backup/cache/memory-segment-store.d.ts +163 -0
- package/dist/types.backup/cache/profile-registry.d.ts +40 -0
- package/dist/types.backup/cache/read-through-swr.d.ts +60 -0
- package/dist/types.backup/cache/segment-codec.d.ts +78 -0
- package/dist/types.backup/cache/shell-snapshot.d.ts +162 -0
- package/dist/types.backup/cache/tag-invalidation.d.ts +74 -0
- package/dist/types.backup/cache/taint.d.ts +71 -0
- package/dist/types.backup/cache/types.d.ts +407 -0
- package/dist/types.backup/cache/vercel/index.d.ts +1 -0
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +267 -0
- package/dist/types.backup/client.d.ts +184 -0
- package/dist/types.backup/client.rsc.d.ts +39 -0
- package/dist/types.backup/cloudflare/index.d.ts +7 -0
- package/dist/types.backup/cloudflare/tracing.d.ts +53 -0
- package/dist/types.backup/component-utils.d.ts +46 -0
- package/dist/types.backup/components/DefaultDocument.d.ts +13 -0
- package/dist/types.backup/context-var.d.ts +84 -0
- package/dist/types.backup/debug.d.ts +57 -0
- package/dist/types.backup/decode-loader-results.d.ts +5 -0
- package/dist/types.backup/default-error-boundary.d.ts +10 -0
- package/dist/types.backup/defer.d.ts +89 -0
- package/dist/types.backup/deps/browser.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-client.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-server.d.ts +1 -0
- package/dist/types.backup/deps/rsc.d.ts +1 -0
- package/dist/types.backup/deps/ssr.d.ts +1 -0
- package/dist/types.backup/encode-kv.d.ts +35 -0
- package/dist/types.backup/errors.d.ts +226 -0
- package/dist/types.backup/escape-script.d.ts +44 -0
- package/dist/types.backup/handle.d.ts +93 -0
- package/dist/types.backup/handles/MetaTags.d.ts +17 -0
- package/dist/types.backup/handles/Scripts.d.ts +38 -0
- package/dist/types.backup/handles/breadcrumbs.d.ts +43 -0
- package/dist/types.backup/handles/deferred-resolution.d.ts +53 -0
- package/dist/types.backup/handles/is-thenable.d.ts +12 -0
- package/dist/types.backup/handles/meta.d.ts +43 -0
- package/dist/types.backup/handles/script.d.ts +139 -0
- package/dist/types.backup/host/cookie-handler.d.ts +8 -0
- package/dist/types.backup/host/errors.d.ts +40 -0
- package/dist/types.backup/host/index.d.ts +33 -0
- package/dist/types.backup/host/pattern-matcher.d.ts +30 -0
- package/dist/types.backup/host/router.d.ts +12 -0
- package/dist/types.backup/host/testing.d.ts +41 -0
- package/dist/types.backup/host/types.d.ts +148 -0
- package/dist/types.backup/host/utils.d.ts +20 -0
- package/dist/types.backup/href-client.d.ts +214 -0
- package/dist/types.backup/index.d.ts +112 -0
- package/dist/types.backup/index.rsc.d.ts +51 -0
- package/dist/types.backup/internal-debug.d.ts +1 -0
- package/dist/types.backup/loader-store.d.ts +193 -0
- package/dist/types.backup/loader.d.ts +18 -0
- package/dist/types.backup/loader.rsc.d.ts +18 -0
- package/dist/types.backup/missing-id-error.d.ts +1 -0
- package/dist/types.backup/outlet-context.d.ts +12 -0
- package/dist/types.backup/outlet-provider.d.ts +12 -0
- package/dist/types.backup/prerender/build-shell-capture.d.ts +104 -0
- package/dist/types.backup/prerender/param-hash.d.ts +6 -0
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +18 -0
- package/dist/types.backup/prerender/store.d.ts +62 -0
- package/dist/types.backup/prerender.d.ts +292 -0
- package/dist/types.backup/redirect-origin.d.ts +55 -0
- package/dist/types.backup/regex-escape.d.ts +6 -0
- package/dist/types.backup/render-error-thrower.d.ts +13 -0
- package/dist/types.backup/response-utils.d.ts +35 -0
- package/dist/types.backup/reverse.d.ts +206 -0
- package/dist/types.backup/root-error-boundary.d.ts +32 -0
- package/dist/types.backup/route-content-wrapper.d.ts +40 -0
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +130 -0
- package/dist/types.backup/route-definition/helper-factories.d.ts +22 -0
- package/dist/types.backup/route-definition/helpers-types.d.ts +392 -0
- package/dist/types.backup/route-definition/index.d.ts +7 -0
- package/dist/types.backup/route-definition/redirect.d.ts +48 -0
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +19 -0
- package/dist/types.backup/route-definition/use-item-types.d.ts +1 -0
- package/dist/types.backup/route-definition.d.ts +1 -0
- package/dist/types.backup/route-map-builder.d.ts +127 -0
- package/dist/types.backup/route-name.d.ts +27 -0
- package/dist/types.backup/route-types.d.ts +172 -0
- package/dist/types.backup/router/basename.d.ts +10 -0
- package/dist/types.backup/router/content-negotiation.d.ts +91 -0
- package/dist/types.backup/router/debug-manifest.d.ts +7 -0
- package/dist/types.backup/router/error-handling.d.ts +76 -0
- package/dist/types.backup/router/find-match.d.ts +19 -0
- package/dist/types.backup/router/handler-context.d.ts +41 -0
- package/dist/types.backup/router/instrument.d.ts +161 -0
- package/dist/types.backup/router/intercept-resolution.d.ts +79 -0
- package/dist/types.backup/router/lazy-includes.d.ts +26 -0
- package/dist/types.backup/router/loader-resolution.d.ts +63 -0
- package/dist/types.backup/router/logging.d.ts +41 -0
- package/dist/types.backup/router/manifest.d.ts +8 -0
- package/dist/types.backup/router/match-api.d.ts +19 -0
- package/dist/types.backup/router/match-context.d.ts +184 -0
- package/dist/types.backup/router/match-handlers.d.ts +49 -0
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +112 -0
- package/dist/types.backup/router/match-middleware/index.d.ts +80 -0
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +116 -0
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +94 -0
- package/dist/types.backup/router/match-pipelines.d.ts +103 -0
- package/dist/types.backup/router/match-result.d.ts +114 -0
- package/dist/types.backup/router/metrics.d.ts +6 -0
- package/dist/types.backup/router/middleware-types.d.ts +74 -0
- package/dist/types.backup/router/middleware.d.ts +116 -0
- package/dist/types.backup/router/navigation-snapshot.d.ts +22 -0
- package/dist/types.backup/router/params-util.d.ts +8 -0
- package/dist/types.backup/router/parse-pattern.d.ts +38 -0
- package/dist/types.backup/router/pattern-matching.d.ts +169 -0
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +27 -0
- package/dist/types.backup/router/prefetch-limits.d.ts +20 -0
- package/dist/types.backup/router/prerender-match.d.ts +50 -0
- package/dist/types.backup/router/preview-match.d.ts +22 -0
- package/dist/types.backup/router/request-classification.d.ts +104 -0
- package/dist/types.backup/router/revalidation.d.ts +57 -0
- package/dist/types.backup/router/route-snapshot.d.ts +112 -0
- package/dist/types.backup/router/router-context.d.ts +137 -0
- package/dist/types.backup/router/router-interfaces.d.ts +432 -0
- package/dist/types.backup/router/router-options.d.ts +738 -0
- package/dist/types.backup/router/router-registry.d.ts +15 -0
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +55 -0
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +93 -0
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +33 -0
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +44 -0
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +90 -0
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +53 -0
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +85 -0
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +17 -0
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +28 -0
- package/dist/types.backup/router/segment-resolution.d.ts +3 -0
- package/dist/types.backup/router/segment-wrappers.d.ts +53 -0
- package/dist/types.backup/router/state-cookie-name.d.ts +1 -0
- package/dist/types.backup/router/substitute-pattern-params.d.ts +23 -0
- package/dist/types.backup/router/telemetry-otel.d.ts +113 -0
- package/dist/types.backup/router/telemetry.d.ts +215 -0
- package/dist/types.backup/router/timeout.d.ts +68 -0
- package/dist/types.backup/router/tracing.d.ts +125 -0
- package/dist/types.backup/router/trie-matching.d.ts +32 -0
- package/dist/types.backup/router/types.d.ts +98 -0
- package/dist/types.backup/router/url-params.d.ts +26 -0
- package/dist/types.backup/router.d.ts +7 -0
- package/dist/types.backup/rsc/capture-queue.d.ts +6 -0
- package/dist/types.backup/rsc/full-payload.d.ts +22 -0
- package/dist/types.backup/rsc/handler-context.d.ts +31 -0
- package/dist/types.backup/rsc/handler.d.ts +9 -0
- package/dist/types.backup/rsc/helpers.d.ts +213 -0
- package/dist/types.backup/rsc/index.d.ts +17 -0
- package/dist/types.backup/rsc/json-route-result.d.ts +20 -0
- package/dist/types.backup/rsc/loader-fetch.d.ts +14 -0
- package/dist/types.backup/rsc/manifest-init.d.ts +18 -0
- package/dist/types.backup/rsc/nonce.d.ts +28 -0
- package/dist/types.backup/rsc/origin-guard.d.ts +50 -0
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +19 -0
- package/dist/types.backup/rsc/redirect-guard.d.ts +35 -0
- package/dist/types.backup/rsc/response-cache-serve.d.ts +46 -0
- package/dist/types.backup/rsc/response-error.d.ts +19 -0
- package/dist/types.backup/rsc/response-route-handler.d.ts +29 -0
- package/dist/types.backup/rsc/rsc-rendering.d.ts +23 -0
- package/dist/types.backup/rsc/runtime-warnings.d.ts +22 -0
- package/dist/types.backup/rsc/server-action.d.ts +68 -0
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +84 -0
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +27 -0
- package/dist/types.backup/rsc/shell-capture.d.ts +374 -0
- package/dist/types.backup/rsc/shell-serve.d.ts +136 -0
- package/dist/types.backup/rsc/ssr-setup.d.ts +48 -0
- package/dist/types.backup/rsc/transition-gate.d.ts +27 -0
- package/dist/types.backup/rsc/types.d.ts +290 -0
- package/dist/types.backup/runtime-env.d.ts +1 -0
- package/dist/types.backup/search-params.d.ts +125 -0
- package/dist/types.backup/segment-content-promise.d.ts +13 -0
- package/dist/types.backup/segment-fragments.d.ts +56 -0
- package/dist/types.backup/segment-loader-promise.d.ts +22 -0
- package/dist/types.backup/segment-system.d.ts +84 -0
- package/dist/types.backup/serialize.d.ts +164 -0
- package/dist/types.backup/server/context.d.ts +494 -0
- package/dist/types.backup/server/cookie-parse.d.ts +10 -0
- package/dist/types.backup/server/cookie-store.d.ts +107 -0
- package/dist/types.backup/server/fetchable-loader-store.d.ts +20 -0
- package/dist/types.backup/server/handle-store.d.ts +100 -0
- package/dist/types.backup/server/loader-registry.d.ts +32 -0
- package/dist/types.backup/server/request-context.d.ts +596 -0
- package/dist/types.backup/server/root-layout.d.ts +3 -0
- package/dist/types.backup/server.d.ts +15 -0
- package/dist/types.backup/ssr/index.d.ts +233 -0
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +3 -0
- package/dist/types.backup/ssr/preinit-client-references.d.ts +71 -0
- package/dist/types.backup/ssr/ssr-root.d.ts +69 -0
- package/dist/types.backup/static-handler.d.ts +57 -0
- package/dist/types.backup/testing/cache-status.d.ts +63 -0
- package/dist/types.backup/testing/collect-handle.d.ts +20 -0
- package/dist/types.backup/testing/dispatch.d.ts +123 -0
- package/dist/types.backup/testing/dom.entry.d.ts +15 -0
- package/dist/types.backup/testing/e2e/fixture.d.ts +37 -0
- package/dist/types.backup/testing/e2e/index.d.ts +30 -0
- package/dist/types.backup/testing/e2e/matchers.d.ts +17 -0
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +62 -0
- package/dist/types.backup/testing/e2e/parity.d.ts +111 -0
- package/dist/types.backup/testing/e2e/server.d.ts +35 -0
- package/dist/types.backup/testing/flight-matchers.d.ts +55 -0
- package/dist/types.backup/testing/flight-normalize.d.ts +1 -0
- package/dist/types.backup/testing/flight-tree.d.ts +192 -0
- package/dist/types.backup/testing/flight.d.ts +115 -0
- package/dist/types.backup/testing/flight.entry.d.ts +27 -0
- package/dist/types.backup/testing/generated-routes.d.ts +66 -0
- package/dist/types.backup/testing/index.d.ts +52 -0
- package/dist/types.backup/testing/internal/context.d.ts +225 -0
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +1 -0
- package/dist/types.backup/testing/internal/seed-vars.d.ts +30 -0
- package/dist/types.backup/testing/render-handler.d.ts +160 -0
- package/dist/types.backup/testing/render-route.d.ts +246 -0
- package/dist/types.backup/testing/run-loader.d.ts +186 -0
- package/dist/types.backup/testing/run-middleware.d.ts +132 -0
- package/dist/types.backup/testing/run-transition-when.d.ts +77 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +1 -0
- package/dist/types.backup/testing/vitest.d.ts +205 -0
- package/dist/types.backup/theme/ThemeProvider.d.ts +13 -0
- package/dist/types.backup/theme/ThemeScript.d.ts +45 -0
- package/dist/types.backup/theme/constants.d.ts +39 -0
- package/dist/types.backup/theme/index.d.ts +29 -0
- package/dist/types.backup/theme/theme-context.d.ts +21 -0
- package/dist/types.backup/theme/theme-script.d.ts +26 -0
- package/dist/types.backup/theme/types.d.ts +162 -0
- package/dist/types.backup/theme/use-theme.d.ts +8 -0
- package/dist/types.backup/types/boundaries.d.ts +93 -0
- package/dist/types.backup/types/cache-types.d.ts +191 -0
- package/dist/types.backup/types/error-types.d.ts +114 -0
- package/dist/types.backup/types/global-namespace.d.ts +90 -0
- package/dist/types.backup/types/handler-context.d.ts +658 -0
- package/dist/types.backup/types/index.d.ts +11 -0
- package/dist/types.backup/types/loader-types.d.ts +182 -0
- package/dist/types.backup/types/request-scope.d.ts +93 -0
- package/dist/types.backup/types/route-config.d.ts +105 -0
- package/dist/types.backup/types/route-entry.d.ts +95 -0
- package/dist/types.backup/types/segments.d.ts +234 -0
- package/dist/types.backup/types.d.ts +1 -0
- package/dist/types.backup/urls/include-helper.d.ts +17 -0
- package/dist/types.backup/urls/include-provider.d.ts +27 -0
- package/dist/types.backup/urls/index.d.ts +6 -0
- package/dist/types.backup/urls/path-helper-types.d.ts +197 -0
- package/dist/types.backup/urls/path-helper.d.ts +12 -0
- package/dist/types.backup/urls/pattern-types.d.ts +166 -0
- package/dist/types.backup/urls/response-types.d.ts +67 -0
- package/dist/types.backup/urls/type-extraction.d.ts +157 -0
- package/dist/types.backup/urls/urls-function.d.ts +24 -0
- package/dist/types.backup/urls.d.ts +1 -0
- package/dist/types.backup/use-loader.d.ts +150 -0
- package/dist/types.backup/vercel/index.d.ts +10 -0
- package/dist/types.backup/vercel/tracing.d.ts +70 -0
- package/dist/types.backup/vite/debug.d.ts +80 -0
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +12 -0
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +65 -0
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +17 -0
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +113 -0
- package/dist/types.backup/vite/discovery/gate-state.d.ts +79 -0
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +24 -0
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +32 -0
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +22 -0
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +40 -0
- package/dist/types.backup/vite/discovery/state.d.ts +162 -0
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +15 -0
- package/dist/types.backup/vite/index.d.ts +11 -0
- package/dist/types.backup/vite/inject-client-debug.d.ts +56 -0
- package/dist/types.backup/vite/plugin-types.d.ts +298 -0
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +6 -0
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +40 -0
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +35 -0
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +18 -0
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +37 -0
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +13 -0
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +29 -0
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +6 -0
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +25 -0
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +20 -0
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +20 -0
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +85 -0
- package/dist/types.backup/vite/plugins/version-injector.d.ts +21 -0
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +19 -0
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +36 -0
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +7 -0
- package/dist/types.backup/vite/rango.d.ts +29 -0
- package/dist/types.backup/vite/router-discovery.d.ts +23 -0
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +64 -0
- package/dist/types.backup/vite/utils/banner.d.ts +2 -0
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +28 -0
- package/dist/types.backup/vite/utils/client-chunks.d.ts +55 -0
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +16 -0
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +37 -0
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +7 -0
- package/dist/types.backup/vite/utils/package-resolution.d.ts +6 -0
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +32 -0
- package/dist/types.backup/vite/utils/shared-utils.d.ts +55 -0
- package/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/skills/parallel/SKILL.md +1 -1
- package/skills/ppr/SKILL.md +44 -3
- package/src/browser/prefetch/cache.ts +53 -9
- package/src/browser/prefetch/fetch.ts +83 -2
- package/src/cache/cf/cf-cache-store.ts +27 -8
- package/src/cache/types.ts +41 -6
- package/src/cache/vercel/vercel-cache-store.ts +24 -10
- package/src/route-definition/helpers-types.ts +5 -3
- package/src/rsc/capture-queue.ts +120 -47
- package/src/rsc/rsc-rendering.ts +11 -3
- package/src/rsc/shell-build-manifest.ts +20 -7
- package/src/rsc/shell-capture.ts +164 -12
- package/src/rsc/shell-serve.ts +27 -12
- package/src/static-handler.ts +18 -2
- package/src/urls/path-helper-types.ts +9 -10
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { Component, type ReactNode } from "react";
|
|
2
|
+
import { type ClientErrorBoundaryFallbackProps } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Outlet component - renders child content in layouts
|
|
5
|
+
*
|
|
6
|
+
* If the current segment defines a loading component, the outlet content
|
|
7
|
+
* is wrapped in Suspense with the loading component as fallback.
|
|
8
|
+
* This means during navigation/streaming, React's Suspense will automatically
|
|
9
|
+
* show the loading skeleton until the content is ready.
|
|
10
|
+
*
|
|
11
|
+
* When a name prop is provided (e.g., "@modal"), renders content from
|
|
12
|
+
* the parallel segment with that slot name instead of the default content.
|
|
13
|
+
* This is used for parallel routes and intercepting routes.
|
|
14
|
+
*
|
|
15
|
+
* For a named slot, `<Outlet name="@x" />` is equivalent to
|
|
16
|
+
* `<ParallelOutlet name="@x" />` — both run the same resolution + wrapping
|
|
17
|
+
* pipeline. Convention: use bare `<Outlet />` for default content and
|
|
18
|
+
* `<ParallelOutlet name="@x" />` for named slots.
|
|
19
|
+
*
|
|
20
|
+
* @param name - Optional slot name for parallel/intercept content (must start with @)
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* function BlogLayout() {
|
|
25
|
+
* return (
|
|
26
|
+
* <div>
|
|
27
|
+
* <h1>Blog</h1>
|
|
28
|
+
* <Outlet />
|
|
29
|
+
* </div>
|
|
30
|
+
* );
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* // With named slot for modal/parallel content:
|
|
34
|
+
* function KanbanLayout() {
|
|
35
|
+
* return (
|
|
36
|
+
* <div>
|
|
37
|
+
* <KanbanBoard />
|
|
38
|
+
* <Outlet name="@modal" />
|
|
39
|
+
* <Outlet />
|
|
40
|
+
* </div>
|
|
41
|
+
* );
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function Outlet({ name }?: {
|
|
46
|
+
name?: `@${string}`;
|
|
47
|
+
}): ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* ParallelOutlet component - renders content for a named parallel slot
|
|
50
|
+
*
|
|
51
|
+
* If the parallel segment defines a loading component, the content
|
|
52
|
+
* is wrapped in Suspense with the loading component as fallback.
|
|
53
|
+
* This enables streaming and navigation loading states for parallels.
|
|
54
|
+
*
|
|
55
|
+
* Equivalent to `<Outlet name="@x" />` for a named slot; ParallelOutlet
|
|
56
|
+
* requires `name` and is named-slot-only, which reads clearer at the call site.
|
|
57
|
+
*
|
|
58
|
+
* @param name - The slot name (must start with @, e.g., "@modal", "@sidebar")
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* function DashboardLayout() {
|
|
63
|
+
* return (
|
|
64
|
+
* <div>
|
|
65
|
+
* <h1>Dashboard</h1>
|
|
66
|
+
* <ParallelOutlet name="@sidebar" />
|
|
67
|
+
* <ParallelOutlet name="@modal" />
|
|
68
|
+
* </div>
|
|
69
|
+
* );
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function ParallelOutlet({ name }: {
|
|
74
|
+
name: `@${string}`;
|
|
75
|
+
}): ReactNode;
|
|
76
|
+
/**
|
|
77
|
+
* Hook to access outlet content programmatically
|
|
78
|
+
*
|
|
79
|
+
* Alternative to using <Outlet /> component. Useful when you need
|
|
80
|
+
* direct access to the outlet content in your logic.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* function BlogLayout() {
|
|
85
|
+
* const outlet = useOutlet();
|
|
86
|
+
* return <div><h1>Blog</h1>{outlet}</div>;
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare function useOutlet(): ReactNode;
|
|
91
|
+
export { useLoader, useFetchLoader, useRefreshLoaders, type LoadFunction, type UseLoaderResult, type UseFetchLoaderResult, type UseLoaderOptions, } from "./use-loader.js";
|
|
92
|
+
/**
|
|
93
|
+
* Props for the ErrorBoundary component
|
|
94
|
+
*/
|
|
95
|
+
export interface ErrorBoundaryProps {
|
|
96
|
+
/** Fallback UI to show when an error is caught */
|
|
97
|
+
fallback: ReactNode | ((props: ClientErrorBoundaryFallbackProps) => ReactNode);
|
|
98
|
+
/** Children to render */
|
|
99
|
+
children: ReactNode;
|
|
100
|
+
/** Optional callback when an error is caught */
|
|
101
|
+
onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
|
|
102
|
+
}
|
|
103
|
+
interface ErrorBoundaryState {
|
|
104
|
+
hasError: boolean;
|
|
105
|
+
error: Error | null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Client-side ErrorBoundary component
|
|
109
|
+
*
|
|
110
|
+
* Catches JavaScript errors in child components during rendering,
|
|
111
|
+
* in lifecycle methods, and in constructors of the whole tree below them.
|
|
112
|
+
* Displays a fallback UI instead of the component tree that crashed.
|
|
113
|
+
*
|
|
114
|
+
* Use this to wrap client components that might throw during hydration
|
|
115
|
+
* or user interaction. For server-side errors (middleware, loaders, handlers),
|
|
116
|
+
* use the errorBoundary() helper in route definitions instead.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```tsx
|
|
120
|
+
* "use client";
|
|
121
|
+
* import { ErrorBoundary } from "rsc-router/client";
|
|
122
|
+
*
|
|
123
|
+
* function MyComponent() {
|
|
124
|
+
* return (
|
|
125
|
+
* <ErrorBoundary fallback={<div>Something went wrong</div>}>
|
|
126
|
+
* <ComponentThatMightThrow />
|
|
127
|
+
* </ErrorBoundary>
|
|
128
|
+
* );
|
|
129
|
+
* }
|
|
130
|
+
*
|
|
131
|
+
* // Or with a function fallback for more control:
|
|
132
|
+
* function MyComponent() {
|
|
133
|
+
* return (
|
|
134
|
+
* <ErrorBoundary
|
|
135
|
+
* fallback={({ error, reset }) => (
|
|
136
|
+
* <div>
|
|
137
|
+
* <p>Error: {error.message}</p>
|
|
138
|
+
* <button onClick={reset}>Try again</button>
|
|
139
|
+
* </div>
|
|
140
|
+
* )}
|
|
141
|
+
* >
|
|
142
|
+
* <ComponentThatMightThrow />
|
|
143
|
+
* </ErrorBoundary>
|
|
144
|
+
* );
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
149
|
+
constructor(props: ErrorBoundaryProps);
|
|
150
|
+
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
151
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
152
|
+
reset: () => void;
|
|
153
|
+
render(): ReactNode;
|
|
154
|
+
}
|
|
155
|
+
export { useNavigation } from "./browser/react/use-navigation.js";
|
|
156
|
+
export { useRouter } from "./browser/react/use-router.js";
|
|
157
|
+
export { usePathname } from "./browser/react/use-pathname.js";
|
|
158
|
+
export { useSearchParams } from "./browser/react/use-search-params.js";
|
|
159
|
+
export { useParams } from "./browser/react/use-params.js";
|
|
160
|
+
export { useNonce } from "./browser/react/nonce-context.js";
|
|
161
|
+
export type { RouterInstance, RouterNavigateOptions, ReadonlyURLSearchParams, ActionState, ActionLifecycleState, } from "./browser/types.js";
|
|
162
|
+
export { useAction, type ServerActionFunction, } from "./browser/react/use-action.js";
|
|
163
|
+
export { useSegments, type SegmentsState, } from "./browser/react/use-segments.js";
|
|
164
|
+
export { NavigationProvider, type NavigationProviderProps, } from "./browser/react/NavigationProvider.js";
|
|
165
|
+
export { Link, type LinkProps, type PrefetchStrategy, type StateOrGetter, type LinkState, } from "./browser/react/Link.js";
|
|
166
|
+
export { useLinkStatus, type LinkStatus, } from "./browser/react/use-link-status.js";
|
|
167
|
+
export { ScrollRestoration, useScrollRestoration, type ScrollRestorationProps, } from "./browser/react/ScrollRestoration.js";
|
|
168
|
+
export { type Handle } from "./handle.js";
|
|
169
|
+
export { useHandle } from "./browser/react/use-handle.js";
|
|
170
|
+
export { Meta } from "./handles/meta.js";
|
|
171
|
+
export { MetaTags } from "./handles/MetaTags.js";
|
|
172
|
+
export type { MetaDescriptor, MetaDescriptorBase } from "./router/types.js";
|
|
173
|
+
export { Script, type ScriptConfig, type ScriptAttributes, } from "./handles/script.js";
|
|
174
|
+
export { Scripts } from "./handles/Scripts.js";
|
|
175
|
+
export { Breadcrumbs, type BreadcrumbItem } from "./handles/breadcrumbs.js";
|
|
176
|
+
export { createLocationState, useLocationState, type LocationStateDefinition, type LocationStateEntry, type LocationStateOptions, } from "./browser/react/location-state.js";
|
|
177
|
+
export { href, type PatternToPath } from "./href-client.js";
|
|
178
|
+
export type { ProblemDetails } from "./urls.js";
|
|
179
|
+
export { useMount } from "./browser/react/use-mount.js";
|
|
180
|
+
export { MountContext } from "./browser/react/mount-context.js";
|
|
181
|
+
export { useHref } from "./browser/react/use-href.js";
|
|
182
|
+
export { useReverse } from "./browser/react/use-reverse.js";
|
|
183
|
+
export type { ScopedReverseFunction, LocalReverseFunction } from "./reverse.js";
|
|
184
|
+
export type { LoaderDefinition } from "./types.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RSC-environment version of client exports
|
|
3
|
+
*
|
|
4
|
+
* This file is used when importing "rsc-router/client" from RSC (server components).
|
|
5
|
+
* It re-exports the server's createLoader so that loader definitions work in both
|
|
6
|
+
* environments with the same import.
|
|
7
|
+
*
|
|
8
|
+
* The bundler uses the "react-server" export condition to select this file
|
|
9
|
+
* in RSC context, while the regular client.tsx is used in client components.
|
|
10
|
+
*/
|
|
11
|
+
export { Outlet, ParallelOutlet, useOutlet, useLoader, ErrorBoundary, type ErrorBoundaryProps, } from "./client.js";
|
|
12
|
+
export { useFetchLoader, useRefreshLoaders, type LoadFunction, type UseLoaderResult, type UseFetchLoaderResult, type UseLoaderOptions, } from "./use-loader.js";
|
|
13
|
+
export { createLoader } from "./route-definition.js";
|
|
14
|
+
export { useRouter } from "./browser/react/use-router.js";
|
|
15
|
+
export { usePathname } from "./browser/react/use-pathname.js";
|
|
16
|
+
export { useSearchParams } from "./browser/react/use-search-params.js";
|
|
17
|
+
export { useParams } from "./browser/react/use-params.js";
|
|
18
|
+
export { useNonce } from "./browser/react/nonce-context.js";
|
|
19
|
+
export { useMount } from "./browser/react/use-mount.js";
|
|
20
|
+
export { useSegments, type SegmentsState, } from "./browser/react/use-segments.js";
|
|
21
|
+
export { useLinkStatus, type LinkStatus, } from "./browser/react/use-link-status.js";
|
|
22
|
+
export { useScrollRestoration } from "./browser/react/ScrollRestoration.js";
|
|
23
|
+
export { Link, type LinkProps, type PrefetchStrategy, } from "./browser/react/Link.js";
|
|
24
|
+
export { ScrollRestoration, type ScrollRestorationProps, } from "./browser/react/ScrollRestoration.js";
|
|
25
|
+
export { NavigationProvider, type NavigationProviderProps, } from "./browser/react/NavigationProvider.js";
|
|
26
|
+
export { href } from "./href-client.js";
|
|
27
|
+
export { MountContext } from "./browser/react/mount-context.js";
|
|
28
|
+
export { createHandle, isHandle, type Handle } from "./handle.js";
|
|
29
|
+
export { Meta } from "./handles/meta.js";
|
|
30
|
+
export { MetaTags } from "./handles/MetaTags.js";
|
|
31
|
+
export type { MetaDescriptor, MetaDescriptorBase } from "./router/types.js";
|
|
32
|
+
export { Script, type ScriptConfig, type ScriptAttributes, } from "./handles/script.js";
|
|
33
|
+
export { Scripts } from "./handles/Scripts.js";
|
|
34
|
+
export { Breadcrumbs, type BreadcrumbItem } from "./handles/breadcrumbs.js";
|
|
35
|
+
export { createLocationState, type LocationStateDefinition, type LocationStateEntry, type LocationStateOptions, } from "./browser/react/location-state-shared.js";
|
|
36
|
+
export { useHref } from "./browser/react/use-href.js";
|
|
37
|
+
export { useReverse } from "./browser/react/use-reverse.js";
|
|
38
|
+
export { useHandle } from "./browser/react/use-handle.js";
|
|
39
|
+
export { useLocationState } from "./browser/react/location-state.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare preset integration surface for @rangojs/router.
|
|
3
|
+
*
|
|
4
|
+
* Imported via `@rangojs/router/cloudflare`. Cloudflare-only helpers live here
|
|
5
|
+
* so Node/other-platform consumers never pull them in.
|
|
6
|
+
*/
|
|
7
|
+
export { createCloudflareTracing, type CloudflareTracingOptions, } from "./tracing.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare custom-spans integration.
|
|
3
|
+
*
|
|
4
|
+
* Bridges the router's performance phases (request, middleware, action,
|
|
5
|
+
* loaders, handler, render, ssr) onto Cloudflare Workers custom spans so they show
|
|
6
|
+
* up in the trace waterfall and OpenTelemetry exports next to the platform's
|
|
7
|
+
* automatic spans (KV reads, D1 queries, fetch calls), with correct nesting.
|
|
8
|
+
*
|
|
9
|
+
* Usage (Cloudflare preset only):
|
|
10
|
+
*
|
|
11
|
+
* import { createRouter } from "@rangojs/router";
|
|
12
|
+
* import { createCloudflareTracing } from "@rangojs/router/cloudflare";
|
|
13
|
+
*
|
|
14
|
+
* export const router = createRouter({
|
|
15
|
+
* tracing: createCloudflareTracing(),
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* The runner reads `executionContext.tracing` (the same object as
|
|
19
|
+
* `import { tracing } from "cloudflare:workers"`) at call time. It is therefore
|
|
20
|
+
* dependency-free: no `cloudflare:workers` import and no hard dependency on
|
|
21
|
+
* `@cloudflare/workers-types`, matching the convention in cache/cf. When the
|
|
22
|
+
* worker is not running on a tracing-enabled Cloudflare runtime — Node, dev
|
|
23
|
+
* without a tracing destination, an older runtime — `executionContext.tracing`
|
|
24
|
+
* is undefined and every span call falls through to the work directly, so the
|
|
25
|
+
* request behaves exactly as if tracing were off. Whether spans are actually
|
|
26
|
+
* recorded is governed by the `observability`/tracing block in wrangler config.
|
|
27
|
+
*
|
|
28
|
+
* Span duration note: enterSpan ends a span when its callback's returned value
|
|
29
|
+
* (or promise) settles. For the streaming phases (request/render/ssr) that is at
|
|
30
|
+
* stream CONSTRUCTION, not body-drain. Instrumentation is best-effort and never
|
|
31
|
+
* wraps or buffers the response body, so it cannot regress streaming or latency.
|
|
32
|
+
* A loader/Suspense child that resolves mid-stream therefore keeps a rango.loader
|
|
33
|
+
* span that can extend past its render parent — overlapping spans are valid. Uses
|
|
34
|
+
* only the typed enterSpan API; spans bound work up to stream-handoff, matching
|
|
35
|
+
* the co-emitted perf metric.
|
|
36
|
+
*/
|
|
37
|
+
import { type RouterTracingConfig, type TracingToggleOptions } from "../router/tracing.js";
|
|
38
|
+
/**
|
|
39
|
+
* Options for createCloudflareTracing. Alias of the shared
|
|
40
|
+
* {@link TracingToggleOptions} (`enabled` master switch + per-phase `spans`
|
|
41
|
+
* toggles); the name is public API.
|
|
42
|
+
*/
|
|
43
|
+
export type CloudflareTracingOptions = TracingToggleOptions;
|
|
44
|
+
/**
|
|
45
|
+
* Create the tracing config for a Cloudflare router. Pass the result to
|
|
46
|
+
* `createRouter({ tracing })`. Spans are emitted for the request, middleware,
|
|
47
|
+
* action, loaders, handler, render, and ssr phases; pass `spans` to turn
|
|
48
|
+
* individual phases off.
|
|
49
|
+
*
|
|
50
|
+
* @see createOTelTracing (`@rangojs/router`) for the same slot on any platform
|
|
51
|
+
* with an OpenTelemetry SDK.
|
|
52
|
+
*/
|
|
53
|
+
export declare function createCloudflareTracing(options?: CloudflareTracingOptions): RouterTracingConfig;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component utilities for RSC
|
|
3
|
+
*
|
|
4
|
+
* Helpers for working with React Server Components and client components.
|
|
5
|
+
*/
|
|
6
|
+
import type { ComponentType } from "react";
|
|
7
|
+
/**
|
|
8
|
+
* Check if a component is a client component (has "use client" directive).
|
|
9
|
+
*
|
|
10
|
+
* Client components are marked by the bundler with:
|
|
11
|
+
* - $$typeof: Symbol.for("react.client.reference")
|
|
12
|
+
* - $$id: string (module identifier)
|
|
13
|
+
*
|
|
14
|
+
* @param component - The component to check
|
|
15
|
+
* @returns true if the component has client reference marker
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { MyComponent } from "./my-component"; // has "use client"
|
|
20
|
+
*
|
|
21
|
+
* if (!isClientComponent(MyComponent)) {
|
|
22
|
+
* throw new Error("MyComponent must be a client component");
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function isClientComponent(component: ComponentType<unknown> | unknown): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Assert that a component is a client component.
|
|
29
|
+
* Throws a descriptive error if not.
|
|
30
|
+
*
|
|
31
|
+
* @param component - The component to check
|
|
32
|
+
* @param name - Name to use in error message (e.g., "document")
|
|
33
|
+
* @param opts.allowServerInTest - When true AND running under a test runner
|
|
34
|
+
* (`isUnderTestRunner()`), relax ONLY the "use client" requirement: a server
|
|
35
|
+
* component is accepted. The plugin's "use client" transform does not run in a
|
|
36
|
+
* bare unit test, so a real exported `document` (almost every app sets one) has
|
|
37
|
+
* no client marker and would otherwise throw at `createRouter`, blocking
|
|
38
|
+
* `dispatch`/`assertGeneratedRoutesMatch` against the real router. The document
|
|
39
|
+
* reference is irrelevant to those (no Flight render). The "not a JSX element"
|
|
40
|
+
* guard still fires, and a real dev/build still throws (mirrors the runtime
|
|
41
|
+
* fallback-id gating in handle.ts/loader.ts).
|
|
42
|
+
* @throws Error if the component is not a client component
|
|
43
|
+
*/
|
|
44
|
+
export declare function assertClientComponent(component: ComponentType<unknown> | unknown, name: string, opts?: {
|
|
45
|
+
allowServerInTest?: boolean;
|
|
46
|
+
}): asserts component is ComponentType<unknown>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode, ReactElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Default document component that provides a basic HTML structure.
|
|
4
|
+
* Used when no custom document is provided to createRouter.
|
|
5
|
+
* Includes MetaTags for automatic charset, viewport, and route meta support,
|
|
6
|
+
* and Scripts (head + body sites) so the Script handle works out of the box.
|
|
7
|
+
*
|
|
8
|
+
* Uses suppressHydrationWarning on <html> because the theme script
|
|
9
|
+
* may modify class/style attributes before React hydrates.
|
|
10
|
+
*/
|
|
11
|
+
export declare function DefaultDocument({ children, }: {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}): ReactElement;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed context variables for ctx.set() / ctx.get().
|
|
3
|
+
*
|
|
4
|
+
* createVar<T>() produces a typed token that handlers set and layouts/middleware
|
|
5
|
+
* read. The token carries a unique Symbol used as the property key on the
|
|
6
|
+
* per-request variables object — no build-time processing, no IDs.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { createVar } from "@rangojs/router";
|
|
11
|
+
*
|
|
12
|
+
* interface PaginationData { current: number; total: number }
|
|
13
|
+
* export const Pagination = createVar<PaginationData>();
|
|
14
|
+
*
|
|
15
|
+
* // Non-cacheable var — ctx.get(User) throws inside a cache() boundary
|
|
16
|
+
* export const User = createVar<UserData>({ cache: false });
|
|
17
|
+
*
|
|
18
|
+
* // handler
|
|
19
|
+
* ctx.set(Pagination, { current: 1, total: 4 });
|
|
20
|
+
*
|
|
21
|
+
* // layout
|
|
22
|
+
* const pg = ctx.get(Pagination); // PaginationData | undefined
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export interface ContextVar<T> {
|
|
26
|
+
readonly __brand: "context-var";
|
|
27
|
+
readonly key: symbol;
|
|
28
|
+
/** When false, ctx.get(var) throws inside a cache() boundary. */
|
|
29
|
+
readonly cache: boolean;
|
|
30
|
+
/** Phantom field to carry the type parameter. Never set at runtime. */
|
|
31
|
+
readonly __type?: T;
|
|
32
|
+
}
|
|
33
|
+
export interface ContextVarOptions {
|
|
34
|
+
/**
|
|
35
|
+
* When false, marks this variable as non-cacheable.
|
|
36
|
+
* Reading this var with ctx.get() inside a cache() boundary throws. Use for
|
|
37
|
+
* inherently request-specific data (user sessions, auth tokens, etc.) that
|
|
38
|
+
* must never be baked into cached segments.
|
|
39
|
+
*
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
cache?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create a typed context variable token.
|
|
46
|
+
*
|
|
47
|
+
* The returned object is used with ctx.set(token, value) and ctx.get(token)
|
|
48
|
+
* for compile-time-checked data flow between handlers, layouts, and middleware.
|
|
49
|
+
*/
|
|
50
|
+
export declare function createVar<T>(options?: ContextVarOptions): ContextVar<T>;
|
|
51
|
+
/**
|
|
52
|
+
* Type guard: is the value a ContextVar token?
|
|
53
|
+
*/
|
|
54
|
+
export declare function isContextVar(value: unknown): value is ContextVar<unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* Does a variables object hold any entries? Counts both string keys and the
|
|
57
|
+
* symbol-keyed entries (context vars are stored under symbols), so an object
|
|
58
|
+
* carrying only symbol-keyed vars is still reported as non-empty.
|
|
59
|
+
*/
|
|
60
|
+
export declare function hasContextVars(variables: object): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Check if a variable value is non-cacheable (either var-level or write-level).
|
|
63
|
+
*/
|
|
64
|
+
export declare function isNonCacheable(variables: any, keyOrVar: string | ContextVar<any>): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Read a variable from the variables store.
|
|
67
|
+
* Accepts either a string key (legacy) or a ContextVar token (typed).
|
|
68
|
+
*/
|
|
69
|
+
export declare function contextGet(variables: any, keyOrVar: string | ContextVar<any>): any;
|
|
70
|
+
export interface ContextSetOptions {
|
|
71
|
+
/**
|
|
72
|
+
* When false, marks this specific write as non-cacheable.
|
|
73
|
+
* "Least cacheable wins" — if either the var definition or this option
|
|
74
|
+
* says cache: false, the value is non-cacheable.
|
|
75
|
+
*
|
|
76
|
+
* @default true (inherits from createVar)
|
|
77
|
+
*/
|
|
78
|
+
cache?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Write a variable to the variables store.
|
|
82
|
+
* Accepts either a string key (legacy) or a ContextVar token (typed).
|
|
83
|
+
*/
|
|
84
|
+
export declare function contextSet(variables: any, keyOrVar: string | ContextVar<any>, value: any, options?: ContextSetOptions): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug utilities for manifest inspection and comparison
|
|
3
|
+
*/
|
|
4
|
+
import { type EntryData } from "./server/context";
|
|
5
|
+
/**
|
|
6
|
+
* Serialized entry for debug output
|
|
7
|
+
*/
|
|
8
|
+
export interface SerializedEntry {
|
|
9
|
+
id: string;
|
|
10
|
+
shortCode: string;
|
|
11
|
+
type: string;
|
|
12
|
+
parentShortCode: string | null;
|
|
13
|
+
pattern?: string;
|
|
14
|
+
hasLoader: boolean;
|
|
15
|
+
hasMiddleware: boolean;
|
|
16
|
+
hasErrorBoundary: boolean;
|
|
17
|
+
parallelCount: number;
|
|
18
|
+
interceptCount: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Serialized manifest structure
|
|
22
|
+
*/
|
|
23
|
+
export interface SerializedManifest {
|
|
24
|
+
routes: Record<string, SerializedEntry>;
|
|
25
|
+
layouts: Record<string, SerializedEntry>;
|
|
26
|
+
totalRoutes: number;
|
|
27
|
+
totalLayouts: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Serialize a manifest Map into a JSON-friendly structure
|
|
31
|
+
*/
|
|
32
|
+
export declare function serializeManifest(manifest: Map<string, EntryData>): SerializedManifest;
|
|
33
|
+
/**
|
|
34
|
+
* Compare two manifests and return differences
|
|
35
|
+
*/
|
|
36
|
+
export declare function compareManifests(oldManifest: SerializedManifest, newManifest: SerializedManifest): {
|
|
37
|
+
addedRoutes: string[];
|
|
38
|
+
removedRoutes: string[];
|
|
39
|
+
changedRoutes: Array<{
|
|
40
|
+
key: string;
|
|
41
|
+
field: string;
|
|
42
|
+
old: any;
|
|
43
|
+
new: any;
|
|
44
|
+
}>;
|
|
45
|
+
addedLayouts: string[];
|
|
46
|
+
removedLayouts: string[];
|
|
47
|
+
changedLayouts: Array<{
|
|
48
|
+
key: string;
|
|
49
|
+
field: string;
|
|
50
|
+
old: any;
|
|
51
|
+
new: any;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Format manifest diff as a human-readable string
|
|
56
|
+
*/
|
|
57
|
+
export declare function formatManifestDiff(diff: ReturnType<typeof compareManifests>): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ErrorBoundaryFallbackProps } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Default error boundary fallback component
|
|
5
|
+
*
|
|
6
|
+
* This is rendered when an error occurs and no custom error boundary
|
|
7
|
+
* is defined in the route tree. Shows a simple "Internal Server Error"
|
|
8
|
+
* message with the error details in development.
|
|
9
|
+
*/
|
|
10
|
+
export declare function DefaultErrorFallback({ error, }: ErrorBoundaryFallbackProps): ReactNode;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deferred handle values — "decide synchronously, resolve late".
|
|
3
|
+
*
|
|
4
|
+
* A handle is pushed from code that holds `ctx` (a route/layout handler), so the
|
|
5
|
+
* decision to push lands before the handles stream seals. But the value often
|
|
6
|
+
* isn't known there — it may come from a deep async component far from the
|
|
7
|
+
* handler. `ctx.use(Handle).defer()` reserves the handle's slot now (synchronous,
|
|
8
|
+
* so ordering and the pre-seal timing hold) and returns a resolver with the SAME
|
|
9
|
+
* signature as the push: you call it later, anywhere in the render, with the same
|
|
10
|
+
* value you would have passed to the push.
|
|
11
|
+
*
|
|
12
|
+
* const breadcrumb = ctx.use(Breadcrumbs); // (item) => void & .defer()
|
|
13
|
+
* const resolve = breadcrumb.defer({ timeoutMs: 5000, else: null });
|
|
14
|
+
* // deep async component, far from ctx:
|
|
15
|
+
* resolve({ label, href, content }); // identical call, just deferred
|
|
16
|
+
*
|
|
17
|
+
* Under the hood the reserved slot is a Promise. Handle values are resolved
|
|
18
|
+
* before any consumer sees them (resolve-by-default: the full render resolves
|
|
19
|
+
* server-side, navigation resolves client-side before apply), so `useHandle`
|
|
20
|
+
* receives the resolved value, never the Promise. The hazard that guards against
|
|
21
|
+
* bugs: a deferred slot whose resolver is never called would keep the render —
|
|
22
|
+
* and the HTTP response — waiting forever. So a deferred auto-resolves to `else`
|
|
23
|
+
* after `timeoutMs` (default {@link DEFAULT_DEFER_TIMEOUT_MS}) if the resolver is
|
|
24
|
+
* never called, degrading gracefully (and warning in dev) instead of hanging.
|
|
25
|
+
*/
|
|
26
|
+
/** Default auto-resolve window. Long enough for genuine deep async work, short
|
|
27
|
+
* enough that a forgotten resolve does not hang the response indefinitely. */
|
|
28
|
+
export declare const DEFAULT_DEFER_TIMEOUT_MS = 10000;
|
|
29
|
+
/** Options for `ctx.use(Handle).defer()`. */
|
|
30
|
+
export interface DeferOptions<TData> {
|
|
31
|
+
/**
|
|
32
|
+
* Auto-resolve to `else` after this many ms if the resolver is never called,
|
|
33
|
+
* so a forgotten resolve cannot hold the Flight stream — and thus the HTTP
|
|
34
|
+
* response — open. Defaults to {@link DEFAULT_DEFER_TIMEOUT_MS}. `0` or
|
|
35
|
+
* `Infinity` disable the timeout intentionally (not recommended on a request
|
|
36
|
+
* path). Any other non-finite or negative value is treated as a mistake and
|
|
37
|
+
* falls back to the default rather than silently disabling the safety net.
|
|
38
|
+
* Named `timeoutMs` to match the router's `*Ms` duration convention.
|
|
39
|
+
*/
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Value the slot resolves to if the timeout fires before the resolver is
|
|
43
|
+
* called. Defaults to `undefined` (the deferred item is skipped/empty). For
|
|
44
|
+
* renderable handle content, `null` is the usual graceful fallback, so the
|
|
45
|
+
* type admits `null` even when `TData` does not.
|
|
46
|
+
*/
|
|
47
|
+
else?: TData | null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The call signature shared by a handle push and the resolver returned by
|
|
51
|
+
* `.defer()`: a concrete value, a `Promise` of the value (Flight streams it as a
|
|
52
|
+
* late row), or a thunk returning a `Promise` (called immediately).
|
|
53
|
+
*/
|
|
54
|
+
export type HandlePushFn<TData> = (data: TData | Promise<TData> | (() => Promise<TData>)) => void;
|
|
55
|
+
/**
|
|
56
|
+
* The push function returned by `ctx.use(Handle)`. Call it to push a value now,
|
|
57
|
+
* or call `.defer()` to reserve the slot now and resolve the value later (e.g.
|
|
58
|
+
* from a deep async component) with a timeout safety net.
|
|
59
|
+
*/
|
|
60
|
+
export type HandlePush<TData> = HandlePushFn<TData> & {
|
|
61
|
+
/**
|
|
62
|
+
* Reserve this handle's slot synchronously and return a resolver that is
|
|
63
|
+
* push-equal: it takes the same argument shapes as the push (value, Promise, or
|
|
64
|
+
* thunk) and behaves identically. Two things the resolver adds over a direct
|
|
65
|
+
* push: a timeout (if the resolver is never called, the slot auto-resolves to
|
|
66
|
+
* `options.else` after `options.timeoutMs`; calling the resolver cancels it),
|
|
67
|
+
* and — on the action/revalidation path only — a thunk it runs does NOT
|
|
68
|
+
* re-enter the deadlock-guard push-callback scope a direct push thunk gets,
|
|
69
|
+
* because a deferred resolver fires after the handler phase has closed.
|
|
70
|
+
*
|
|
71
|
+
* The reserved slot is resolved before any consumer reads it
|
|
72
|
+
* (resolve-by-default), so `useHandle` receives the resolved value (or the
|
|
73
|
+
* `else` fallback on timeout), never a Promise.
|
|
74
|
+
*/
|
|
75
|
+
defer(options?: DeferOptions<TData>): HandlePushFn<TData>;
|
|
76
|
+
};
|
|
77
|
+
export declare function createDeferred<T>(options?: {
|
|
78
|
+
timeoutMs?: number;
|
|
79
|
+
fallback?: T | null;
|
|
80
|
+
}): {
|
|
81
|
+
promise: Promise<T | null | undefined>;
|
|
82
|
+
resolve: (value: T | null | undefined) => void;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Attach `.defer()` to a handle push function. The deferred slot is reserved by
|
|
86
|
+
* pushing the deferred promise through the same push (so ordering, sealing, and
|
|
87
|
+
* Flight streaming all reuse the existing path); the returned resolver settles it.
|
|
88
|
+
*/
|
|
89
|
+
export declare function withDefer<TData>(push: HandlePushFn<TData>): HandlePush<TData>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createFromReadableStream, createFromFetch, setServerCallback, encodeReply, createTemporaryReferenceSet, } from "@vitejs/plugin-rsc/browser";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { rscStream } from "rsc-html-stream/client";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { injectRSCPayload } from "rsc-html-stream/server";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { renderToReadableStream, decodeReply, createTemporaryReferenceSet, loadServerAction, decodeAction, decodeFormState, } from "@vitejs/plugin-rsc/rsc";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createFromReadableStream, setOnClientReference, } from "@vitejs/plugin-rsc/ssr";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared key=value serialization core.
|
|
3
|
+
*
|
|
4
|
+
* One encode+join rule shared by every deterministic query-string serializer
|
|
5
|
+
* in the codebase (cache keys, route-param strings, search-param strings,
|
|
6
|
+
* prerender param hashes). Each call site differs only in how it pre-filters
|
|
7
|
+
* and orders the pairs it hands in, plus whether it sorts; the encoding itself
|
|
8
|
+
* (`encodeURIComponent(k)=encodeURIComponent(v)` joined by `&`) is identical.
|
|
9
|
+
*
|
|
10
|
+
* Dependency-free leaf module so any layer (build-time prerender hashing,
|
|
11
|
+
* runtime cache keys, client search-param serialization) can import it without
|
|
12
|
+
* pulling in cache/router internals.
|
|
13
|
+
*/
|
|
14
|
+
export interface EncodeKVOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Sort pairs by key in codepoint (byte) order before joining. Byte order via
|
|
17
|
+
* the `<` operator, NOT localeCompare, so the result is identical across
|
|
18
|
+
* Node, Workers, and browsers regardless of runtime locale.
|
|
19
|
+
*
|
|
20
|
+
* Defaults to false (insertion order preserved).
|
|
21
|
+
*/
|
|
22
|
+
sort?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Serialize an array of [key, value] pairs to a deterministic query string
|
|
26
|
+
* (no leading `?`). Both key and value are passed through encodeURIComponent
|
|
27
|
+
* so a key/value containing `&` or `=` cannot collide with a structurally
|
|
28
|
+
* different pair set.
|
|
29
|
+
*
|
|
30
|
+
* Callers are responsible for any filtering (e.g. dropping reserved params) and
|
|
31
|
+
* any value coercion (e.g. String(v), skipping null/undefined) BEFORE calling.
|
|
32
|
+
* This function never inspects or skips values; it encodes exactly what it is
|
|
33
|
+
* given so each call site keeps its own existing output.
|
|
34
|
+
*/
|
|
35
|
+
export declare function encodeKV(pairs: Iterable<readonly [string, string]>, options?: EncodeKVOptions): string;
|