@timber-js/app 0.2.0-alpha.185 → 0.2.0-alpha.187
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/_chunks/{actions-O_LsyCE4.js → actions-35jnMdeJ.js} +4 -3
- package/dist/_chunks/{actions-O_LsyCE4.js.map → actions-35jnMdeJ.js.map} +1 -1
- package/dist/_chunks/als-registry-C6kcfprT.js +41 -0
- package/dist/_chunks/als-registry-C6kcfprT.js.map +1 -0
- package/dist/_chunks/als-slots-BEEIPKYm.js +26 -0
- package/dist/_chunks/als-slots-BEEIPKYm.js.map +1 -0
- package/dist/_chunks/base-path-DaQrzbez.js +80 -0
- package/dist/_chunks/base-path-DaQrzbez.js.map +1 -0
- package/dist/_chunks/build-manifest-DWppEdLB.js +86 -0
- package/dist/_chunks/build-manifest-DWppEdLB.js.map +1 -0
- package/dist/_chunks/build-output-helper-C3DrfzZR.js +369 -0
- package/dist/_chunks/build-output-helper-C3DrfzZR.js.map +1 -0
- package/dist/_chunks/{cache-api-B-lhk9p4.js → cache-api-DjNrIWRR.js} +8 -14
- package/dist/_chunks/cache-api-DjNrIWRR.js.map +1 -0
- package/dist/_chunks/cli-check-CpmN7Nh-.js +256 -0
- package/dist/_chunks/cli-check-CpmN7Nh-.js.map +1 -0
- package/dist/_chunks/cli-schema-sync-CGMp_Psg.js +298 -0
- package/dist/_chunks/cli-schema-sync-CGMp_Psg.js.map +1 -0
- package/dist/_chunks/{cloudflare-CnT5Lr7U.js → cloudflare-CGP6BZKO.js} +92 -14
- package/dist/_chunks/{cloudflare-CnT5Lr7U.js.map → cloudflare-CGP6BZKO.js.map} +1 -1
- package/dist/_chunks/convention-lint-kXsgc_-7.js +784 -0
- package/dist/_chunks/convention-lint-kXsgc_-7.js.map +1 -0
- package/dist/_chunks/error-boundary-D-ODYX41.js +353 -0
- package/dist/_chunks/error-boundary-D-ODYX41.js.map +1 -0
- package/dist/_chunks/{fast-hash-D6hIVt1Y.js → fast-hash-C-tVYrLb.js} +6 -1
- package/dist/_chunks/fast-hash-C-tVYrLb.js.map +1 -0
- package/dist/_chunks/file-cache-DmX7OqZP.js +454 -0
- package/dist/_chunks/file-cache-DmX7OqZP.js.map +1 -0
- package/dist/_chunks/fs-identity-D7vb6GdI.js +208 -0
- package/dist/_chunks/fs-identity-D7vb6GdI.js.map +1 -0
- package/dist/_chunks/{logger-AWfuX-KJ.js → logger-D8xJZXIN.js} +34 -51
- package/dist/_chunks/logger-D8xJZXIN.js.map +1 -0
- package/dist/_chunks/mdx-file-C005ay-P.js +25 -0
- package/dist/_chunks/mdx-file-C005ay-P.js.map +1 -0
- package/dist/_chunks/{plugin-context---kTF5v8.js → plugin-context-rCinWLiE.js} +8 -2
- package/dist/_chunks/plugin-context-rCinWLiE.js.map +1 -0
- package/dist/_chunks/purge-store-Byr8XOjU.js +14 -0
- package/dist/_chunks/purge-store-Byr8XOjU.js.map +1 -0
- package/dist/_chunks/{resolve-schema-Dz3fcFUo.js → resolve-schema-5ma5pp1b.js} +2 -2
- package/dist/_chunks/{resolve-schema-Dz3fcFUo.js.map → resolve-schema-5ma5pp1b.js.map} +1 -1
- package/dist/_chunks/{router-ref-CtmF-aPv.js → router-ref-DuYuV_0Q.js} +2 -2
- package/dist/_chunks/router-ref-DuYuV_0Q.js.map +1 -0
- package/dist/_chunks/rsc-cache-key-DD0fl_-s.js +243 -0
- package/dist/_chunks/rsc-cache-key-DD0fl_-s.js.map +1 -0
- package/dist/_chunks/rsc-error-envelope-tT5PJs4q.js +40 -0
- package/dist/_chunks/rsc-error-envelope-tT5PJs4q.js.map +1 -0
- package/dist/_chunks/rsc-media-type-DRqE_lD_.js +46 -0
- package/dist/_chunks/rsc-media-type-DRqE_lD_.js.map +1 -0
- package/dist/_chunks/rsc-payload-path-B_LBodc2.js +48 -0
- package/dist/_chunks/rsc-payload-path-B_LBodc2.js.map +1 -0
- package/dist/_chunks/scanner-C8b0Gcw3.js +1564 -0
- package/dist/_chunks/scanner-C8b0Gcw3.js.map +1 -0
- package/dist/_chunks/schema-bridge-Cc2Gngu1.js +199 -0
- package/dist/_chunks/schema-bridge-Cc2Gngu1.js.map +1 -0
- package/dist/_chunks/{segment-classify-Byy425ng.js → segment-classify-C539Pa2O.js} +23 -2
- package/dist/_chunks/segment-classify-C539Pa2O.js.map +1 -0
- package/dist/_chunks/segment-context-CjOlyB8Y.js +97 -0
- package/dist/_chunks/segment-context-CjOlyB8Y.js.map +1 -0
- package/dist/_chunks/{canonicalize-DQHyFClh.js → segment-keys-BawYuNFO.js} +61 -2
- package/dist/_chunks/segment-keys-BawYuNFO.js.map +1 -0
- package/dist/_chunks/slot-params-BCTmZkQB.js +76 -0
- package/dist/_chunks/slot-params-BCTmZkQB.js.map +1 -0
- package/dist/_chunks/{ssr-data-BOWsq18U.js → ssr-data-14MXm7Pj.js} +17 -2
- package/dist/_chunks/ssr-data-14MXm7Pj.js.map +1 -0
- package/dist/_chunks/{use-query-states-DFvWd-EA.js → use-query-states-BbU5Ge1V.js} +74 -26
- package/dist/_chunks/use-query-states-BbU5Ge1V.js.map +1 -0
- package/dist/_chunks/use-segment-params-C4r4BD9T.js +398 -0
- package/dist/_chunks/use-segment-params-C4r4BD9T.js.map +1 -0
- package/dist/_chunks/walkers-RzN6AFjr.js +141 -0
- package/dist/_chunks/walkers-RzN6AFjr.js.map +1 -0
- package/dist/adapters/build-output-helper.d.ts +37 -0
- package/dist/adapters/build-output-helper.d.ts.map +1 -1
- package/dist/adapters/cloudflare-dev.js +1 -1
- package/dist/adapters/cloudflare-kv-cache.js +1 -1
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +1 -1
- package/dist/adapters/compress-module.d.ts +12 -0
- package/dist/adapters/compress-module.d.ts.map +1 -1
- package/dist/adapters/fs-identity.d.ts +64 -0
- package/dist/adapters/fs-identity.d.ts.map +1 -0
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +56 -5
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/shared.d.ts +57 -1
- package/dist/adapters/shared.d.ts.map +1 -1
- package/dist/adapters/types.d.ts +13 -1
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/cache/fast-hash.d.ts +5 -0
- package/dist/cache/fast-hash.d.ts.map +1 -1
- package/dist/cache/index.js +1 -1
- package/dist/cdn/cloudflare-purge.js +30 -0
- package/dist/cdn/cloudflare-purge.js.map +1 -0
- package/dist/cdn/fastly-purge.js +33 -0
- package/dist/cdn/fastly-purge.js.map +1 -0
- package/dist/cdn/index.js +94 -0
- package/dist/cdn/index.js.map +1 -0
- package/dist/cdn/workers-cache-purge.js +35 -0
- package/dist/cdn/workers-cache-purge.js.map +1 -0
- package/dist/cli-check.d.ts +153 -0
- package/dist/cli-check.d.ts.map +1 -0
- package/dist/cli.d.ts +34 -8
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +46 -21
- package/dist/cli.js.map +1 -1
- package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -1
- package/dist/client/browser-entry/hydrate.d.ts +20 -9
- package/dist/client/browser-entry/hydrate.d.ts.map +1 -1
- package/dist/client/browser-entry/index.d.ts +1 -1
- package/dist/client/browser-entry/index.d.ts.map +1 -1
- package/dist/client/browser-entry/post-hydration.d.ts +4 -1
- package/dist/client/browser-entry/post-hydration.d.ts.map +1 -1
- package/dist/client/browser-entry/router-init.d.ts +3 -0
- package/dist/client/browser-entry/router-init.d.ts.map +1 -1
- package/dist/client/browser-entry/rsc-stream.d.ts +8 -0
- package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -1
- package/dist/client/error-boundary.d.ts +7 -0
- package/dist/client/error-boundary.d.ts.map +1 -1
- package/dist/client/error-boundary.js +1 -162
- package/dist/client/history.d.ts +13 -6
- package/dist/client/history.d.ts.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +42 -41
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +4 -3
- package/dist/client/internal.d.ts.map +1 -1
- package/dist/client/internal.js +877 -311
- package/dist/client/internal.js.map +1 -1
- package/dist/client/link.d.ts +1 -7
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/navigation-api.d.ts +2 -2
- package/dist/client/navigation-commit.d.ts +87 -0
- package/dist/client/navigation-commit.d.ts.map +1 -0
- package/dist/client/navigation-context.d.ts +37 -20
- package/dist/client/navigation-context.d.ts.map +1 -1
- package/dist/client/navigation-root.d.ts +63 -23
- package/dist/client/navigation-root.d.ts.map +1 -1
- package/dist/client/params-context.d.ts +81 -0
- package/dist/client/params-context.d.ts.map +1 -0
- package/dist/client/router-effects.d.ts +129 -0
- package/dist/client/router-effects.d.ts.map +1 -0
- package/dist/client/router-lifecycle.d.ts +55 -0
- package/dist/client/router-lifecycle.d.ts.map +1 -0
- package/dist/client/router-pipeline.d.ts +84 -0
- package/dist/client/router-pipeline.d.ts.map +1 -0
- package/dist/client/router-ref.d.ts +1 -1
- package/dist/client/router-ref.d.ts.map +1 -1
- package/dist/client/router-skew.d.ts +21 -0
- package/dist/client/router-skew.d.ts.map +1 -0
- package/dist/client/router-types.d.ts +207 -0
- package/dist/client/router-types.d.ts.map +1 -0
- package/dist/client/router.d.ts +1 -182
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/rsc-fetch.d.ts +47 -26
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +87 -34
- package/dist/client/segment-cache.d.ts.map +1 -1
- package/dist/client/ssr-data.d.ts +6 -0
- package/dist/client/ssr-data.d.ts.map +1 -1
- package/dist/client/stale-client.d.ts +69 -0
- package/dist/client/stale-client.d.ts.map +1 -0
- package/dist/client/state.d.ts +10 -1
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/top-loader.d.ts +2 -1
- package/dist/client/top-loader.d.ts.map +1 -1
- package/dist/client/unload-guard.d.ts +5 -0
- package/dist/client/unload-guard.d.ts.map +1 -1
- package/dist/client/use-cookie.d.ts.map +1 -1
- package/dist/client/use-query-states.d.ts +9 -3
- package/dist/client/use-query-states.d.ts.map +1 -1
- package/dist/client/use-router.d.ts +1 -1
- package/dist/client/use-segment-params.d.ts +18 -8
- package/dist/client/use-segment-params.d.ts.map +1 -1
- package/dist/codec.js +1 -1
- package/dist/cookies/define-cookie.d.ts.map +1 -1
- package/dist/cookies/index.js +5 -5
- package/dist/cookies/index.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1009 -759
- package/dist/index.js.map +1 -1
- package/dist/params/index.js +1 -1
- package/dist/plugin-context.d.ts +46 -0
- package/dist/plugin-context.d.ts.map +1 -1
- package/dist/plugins/adapter-build.d.ts.map +1 -1
- package/dist/plugins/build-manifest.d.ts +1 -1
- package/dist/plugins/build-manifest.d.ts.map +1 -1
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/plugins/fonts.d.ts.map +1 -1
- package/dist/plugins/request-dep/analysis.d.ts +106 -0
- package/dist/plugins/request-dep/analysis.d.ts.map +1 -0
- package/dist/plugins/request-dep/index.d.ts +75 -0
- package/dist/plugins/request-dep/index.d.ts.map +1 -0
- package/dist/plugins/request-dep/origin.d.ts +61 -0
- package/dist/plugins/request-dep/origin.d.ts.map +1 -0
- package/dist/plugins/routing.d.ts.map +1 -1
- package/dist/plugins/shims.d.ts.map +1 -1
- package/dist/plugins/static-build.d.ts +160 -8
- package/dist/plugins/static-build.d.ts.map +1 -1
- package/dist/routing/codegen-shared.d.ts +3 -44
- package/dist/routing/codegen-shared.d.ts.map +1 -1
- package/dist/routing/codegen-types.d.ts +28 -31
- package/dist/routing/codegen-types.d.ts.map +1 -1
- package/dist/routing/codegen-write.d.ts +51 -0
- package/dist/routing/codegen-write.d.ts.map +1 -0
- package/dist/routing/codegen.d.ts.map +1 -1
- package/dist/routing/collision-probe.d.ts +104 -0
- package/dist/routing/collision-probe.d.ts.map +1 -0
- package/dist/routing/collision-spaces.d.ts +26 -0
- package/dist/routing/collision-spaces.d.ts.map +1 -0
- package/dist/routing/convention-lint.d.ts +18 -4
- package/dist/routing/convention-lint.d.ts.map +1 -1
- package/dist/routing/export-detect.d.ts +16 -0
- package/dist/routing/export-detect.d.ts.map +1 -1
- package/dist/routing/index.js +4 -3
- package/dist/routing/interception.d.ts +235 -6
- package/dist/routing/interception.d.ts.map +1 -1
- package/dist/routing/link-codegen.d.ts +19 -4
- package/dist/routing/link-codegen.d.ts.map +1 -1
- package/dist/routing/manifest-codegen.d.ts +1 -7
- package/dist/routing/manifest-codegen.d.ts.map +1 -1
- package/dist/routing/scanner.d.ts.map +1 -1
- package/dist/routing/segment-classify.d.ts +33 -0
- package/dist/routing/segment-classify.d.ts.map +1 -1
- package/dist/routing/segment-keys.d.ts +95 -0
- package/dist/routing/segment-keys.d.ts.map +1 -0
- package/dist/routing/slot-placement.d.ts +48 -0
- package/dist/routing/slot-placement.d.ts.map +1 -0
- package/dist/routing/types.d.ts +0 -6
- package/dist/routing/types.d.ts.map +1 -1
- package/dist/routing/walkers.d.ts +6 -0
- package/dist/routing/walkers.d.ts.map +1 -1
- package/dist/schema-bridge.d.ts +60 -9
- package/dist/schema-bridge.d.ts.map +1 -1
- package/dist/search-params/define.d.ts +62 -14
- package/dist/search-params/define.d.ts.map +1 -1
- package/dist/search-params/index.d.ts +0 -1
- package/dist/search-params/index.d.ts.map +1 -1
- package/dist/search-params/index.js +221 -10
- package/dist/search-params/index.js.map +1 -1
- package/dist/search-params/parse-total.d.ts +70 -0
- package/dist/search-params/parse-total.d.ts.map +1 -0
- package/dist/search-params/wrappers.d.ts +26 -3
- package/dist/search-params/wrappers.d.ts.map +1 -1
- package/dist/server/access-gate.d.ts +19 -8
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/action-handler.d.ts.map +1 -1
- package/dist/server/actions.d.ts +6 -3
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +18 -1
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/build-manifest.d.ts +13 -1
- package/dist/server/build-manifest.d.ts.map +1 -1
- package/dist/server/chain-url-parts.d.ts +82 -0
- package/dist/server/chain-url-parts.d.ts.map +1 -0
- package/dist/server/children-interception.d.ts +49 -0
- package/dist/server/children-interception.d.ts.map +1 -0
- package/dist/server/compress.d.ts.map +1 -1
- package/dist/server/default-status-page.d.ts +45 -0
- package/dist/server/default-status-page.d.ts.map +1 -0
- package/dist/server/deny-boundary.d.ts +148 -15
- package/dist/server/deny-boundary.d.ts.map +1 -1
- package/dist/server/deny-renderer.d.ts +15 -4
- package/dist/server/deny-renderer.d.ts.map +1 -1
- package/dist/server/error-boundary-wrapper.d.ts +85 -15
- package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
- package/dist/server/head-response.d.ts +35 -0
- package/dist/server/head-response.d.ts.map +1 -0
- package/dist/server/index.d.ts +0 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/internal.d.ts +3 -1
- package/dist/server/internal.d.ts.map +1 -1
- package/dist/server/internal.js +712 -418
- package/dist/server/internal.js.map +1 -1
- package/dist/server/metadata-collector.d.ts +52 -0
- package/dist/server/metadata-collector.d.ts.map +1 -0
- package/dist/server/param-coercion.d.ts +22 -6
- package/dist/server/param-coercion.d.ts.map +1 -1
- package/dist/server/pipeline-helpers.d.ts +0 -18
- package/dist/server/pipeline-helpers.d.ts.map +1 -1
- package/dist/server/pipeline-interception.d.ts +59 -9
- package/dist/server/pipeline-interception.d.ts.map +1 -1
- package/dist/server/pipeline-outcome.d.ts.map +1 -1
- package/dist/server/pipeline-phases.d.ts.map +1 -1
- package/dist/server/pipeline.d.ts +11 -0
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/primitives.d.ts +23 -0
- package/dist/server/primitives.d.ts.map +1 -1
- package/dist/server/publish-params.d.ts +33 -0
- package/dist/server/publish-params.d.ts.map +1 -0
- package/dist/server/request-context.d.ts +48 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts +22 -3
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/route-handler.d.ts.map +1 -1
- package/dist/server/route-matcher.d.ts +13 -0
- package/dist/server/route-matcher.d.ts.map +1 -1
- package/dist/server/rsc-cache-key-guard.d.ts +78 -0
- package/dist/server/rsc-cache-key-guard.d.ts.map +1 -0
- package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
- package/dist/server/rsc-entry/deny-fallback.d.ts.map +1 -1
- package/dist/server/rsc-entry/error-renderer.d.ts +15 -3
- package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/helpers.d.ts +2 -17
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts +0 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
- package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-payload.d.ts +1 -2
- package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts +15 -2
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/skippable-prefix.d.ts +23 -0
- package/dist/server/skippable-prefix.d.ts.map +1 -0
- package/dist/server/slot-interception.d.ts +80 -0
- package/dist/server/slot-interception.d.ts.map +1 -0
- package/dist/server/slot-resolver.d.ts +70 -8
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/ssr-bridge-types.d.ts +17 -0
- package/dist/server/ssr-bridge-types.d.ts.map +1 -1
- package/dist/server/ssr-entry.d.ts +0 -1
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts +24 -13
- package/dist/server/ssr-wrappers.d.ts.map +1 -1
- package/dist/server/state-tree-diff.d.ts +6 -27
- package/dist/server/state-tree-diff.d.ts.map +1 -1
- package/dist/server/static-generator.d.ts +6 -0
- package/dist/server/static-generator.d.ts.map +1 -1
- package/dist/server/static-not-found.d.ts +52 -0
- package/dist/server/static-not-found.d.ts.map +1 -0
- package/dist/server/status-code-resolver.d.ts +8 -1
- package/dist/server/status-code-resolver.d.ts.map +1 -1
- package/dist/server/tree-builder.d.ts +28 -36
- package/dist/server/tree-builder.d.ts.map +1 -1
- package/dist/server/types.d.ts +12 -7
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/utils/element-type.d.ts +40 -0
- package/dist/server/utils/element-type.d.ts.map +1 -0
- package/dist/shared/als-slots.d.ts +41 -0
- package/dist/shared/als-slots.d.ts.map +1 -0
- package/dist/shared/base-path.d.ts +56 -0
- package/dist/shared/base-path.d.ts.map +1 -0
- package/dist/shared/param-value.d.ts +80 -0
- package/dist/shared/param-value.d.ts.map +1 -0
- package/dist/shared/payload-root.d.ts +108 -0
- package/dist/shared/payload-root.d.ts.map +1 -0
- package/dist/shared/rsc-cache-key.d.ts +163 -0
- package/dist/shared/rsc-cache-key.d.ts.map +1 -0
- package/dist/shared/rsc-error-envelope.d.ts +25 -0
- package/dist/shared/rsc-error-envelope.d.ts.map +1 -0
- package/dist/shared/rsc-manifest.d.ts +28 -0
- package/dist/shared/rsc-manifest.d.ts.map +1 -0
- package/dist/shared/rsc-media-type.d.ts +40 -0
- package/dist/shared/rsc-media-type.d.ts.map +1 -0
- package/dist/shared/rsc-payload-path.d.ts +42 -0
- package/dist/shared/rsc-payload-path.d.ts.map +1 -0
- package/dist/shared/segment-info.d.ts +59 -0
- package/dist/shared/segment-info.d.ts.map +1 -0
- package/dist/shared/slot-params.d.ts +51 -0
- package/dist/shared/slot-params.d.ts.map +1 -0
- package/dist/shared/static-platform-files.d.ts +71 -0
- package/dist/shared/static-platform-files.d.ts.map +1 -0
- package/docs/api/30-api-server.mdx +1 -1
- package/docs/api/31-api-client.mdx +4 -2
- package/docs/api/33-api-search-params.mdx +38 -16
- package/docs/api/35-api-typescript.mdx +3 -3
- package/docs/api/36-cli.mdx +34 -7
- package/docs/learn/00-introduction.mdx +1 -1
- package/docs/learn/02-pages-and-layouts.mdx +2 -2
- package/docs/learn/05-typed-params.mdx +8 -8
- package/docs/learn/07-typed-routes.mdx +12 -7
- package/docs/learn/11-error-handling.mdx +18 -0
- package/docs/learn/12-client-navigation.mdx +2 -2
- package/docs/learn/14-deploying.mdx +23 -0
- package/docs/more/01-advanced-routing.mdx +173 -3
- package/docs/more/03-coming-from-nextjs.mdx +2 -2
- package/docs/more/04-metadata-and-fonts.mdx +1 -1
- package/docs/more/50-ai-agent-instructions.mdx +6 -4
- package/package.json +9 -6
- package/src/adapters/build-output-helper.ts +116 -3
- package/src/adapters/cloudflare.ts +90 -12
- package/src/adapters/compress-module.ts +79 -1
- package/src/adapters/fs-identity.ts +156 -0
- package/src/adapters/nitro.ts +6 -6
- package/src/adapters/shared.ts +196 -21
- package/src/adapters/types.ts +13 -1
- package/src/cache/fast-hash.ts +5 -0
- package/src/cli-check.ts +458 -0
- package/src/cli.ts +59 -24
- package/src/client/browser-entry/action-dispatch.ts +11 -5
- package/src/client/browser-entry/hydrate.ts +40 -29
- package/src/client/browser-entry/index.ts +15 -6
- package/src/client/browser-entry/post-hydration.ts +10 -9
- package/src/client/browser-entry/router-init.ts +104 -48
- package/src/client/browser-entry/rsc-stream.ts +11 -2
- package/src/client/error-boundary.tsx +85 -16
- package/src/client/history.ts +13 -6
- package/src/client/index.ts +14 -3
- package/src/client/internal.ts +4 -3
- package/src/client/link.tsx +120 -72
- package/src/client/navigation-api.ts +3 -3
- package/src/client/navigation-commit.ts +197 -0
- package/src/client/navigation-context.ts +40 -67
- package/src/client/navigation-root.tsx +326 -101
- package/src/client/params-context.ts +192 -0
- package/src/client/router-effects.ts +231 -0
- package/src/client/router-lifecycle.ts +288 -0
- package/src/client/router-pipeline.ts +393 -0
- package/src/client/router-ref.ts +1 -1
- package/src/client/router-skew.ts +30 -0
- package/src/client/router-types.ts +230 -0
- package/src/client/router.ts +243 -707
- package/src/client/rsc-fetch.ts +183 -106
- package/src/client/segment-cache.ts +129 -44
- package/src/client/ssr-data.ts +6 -0
- package/src/client/stale-client.ts +191 -0
- package/src/client/state.ts +14 -1
- package/src/client/top-loader.tsx +2 -1
- package/src/client/unload-guard.ts +34 -2
- package/src/client/use-cookie.ts +9 -2
- package/src/client/use-query-states.ts +102 -39
- package/src/client/use-router.ts +1 -1
- package/src/client/use-segment-params.ts +41 -18
- package/src/cookies/define-cookie.ts +6 -1
- package/src/index.ts +25 -4
- package/src/plugin-context.ts +58 -0
- package/src/plugins/adapter-build.ts +4 -0
- package/src/plugins/build-manifest.ts +34 -13
- package/src/plugins/entries.ts +4 -0
- package/src/plugins/fonts.ts +11 -8
- package/src/plugins/request-dep/analysis.ts +447 -0
- package/src/plugins/request-dep/index.ts +376 -0
- package/src/plugins/request-dep/origin.ts +310 -0
- package/src/plugins/routing.ts +97 -102
- package/src/plugins/shims.ts +0 -1
- package/src/plugins/static-build.ts +391 -95
- package/src/routing/codegen-shared.ts +3 -79
- package/src/routing/codegen-types.ts +28 -31
- package/src/routing/codegen-write.ts +139 -0
- package/src/routing/codegen.ts +86 -172
- package/src/routing/collision-probe.ts +438 -0
- package/src/routing/collision-spaces.ts +281 -0
- package/src/routing/convention-lint.ts +139 -40
- package/src/routing/export-detect.ts +151 -7
- package/src/routing/interception.ts +896 -50
- package/src/routing/link-codegen.ts +32 -65
- package/src/routing/manifest-codegen.ts +6 -62
- package/src/routing/scanner.ts +117 -92
- package/src/routing/segment-classify.ts +57 -0
- package/src/routing/segment-keys.ts +146 -0
- package/src/routing/slot-placement.ts +97 -0
- package/src/routing/types.ts +0 -6
- package/src/routing/walkers.ts +8 -0
- package/src/schema-bridge.ts +180 -58
- package/src/search-params/define.ts +108 -66
- package/src/search-params/index.ts +0 -1
- package/src/search-params/parse-total.ts +78 -0
- package/src/search-params/wrappers.ts +60 -11
- package/src/server/access-gate.tsx +60 -40
- package/src/server/action-handler.ts +4 -5
- package/src/server/actions.ts +6 -3
- package/src/server/als-registry.ts +18 -1
- package/src/server/build-manifest.ts +14 -1
- package/src/server/chain-url-parts.ts +163 -0
- package/src/server/children-interception.ts +115 -0
- package/src/server/compress.ts +9 -1
- package/src/server/default-status-page.ts +127 -0
- package/src/server/deny-boundary.ts +269 -41
- package/src/server/deny-renderer.ts +111 -39
- package/src/server/error-boundary-wrapper.ts +166 -79
- package/src/server/head-response.ts +54 -0
- package/src/server/index.ts +1 -3
- package/src/server/internal.ts +2 -2
- package/src/server/metadata-collector.ts +115 -0
- package/src/server/param-coercion.ts +51 -69
- package/src/server/pipeline-helpers.ts +2 -47
- package/src/server/pipeline-interception.ts +81 -32
- package/src/server/pipeline-outcome.ts +4 -5
- package/src/server/pipeline-phases.ts +77 -25
- package/src/server/pipeline.ts +57 -10
- package/src/server/prebuilt-runtime.ts +4 -4
- package/src/server/primitives.ts +25 -0
- package/src/server/publish-params.ts +42 -0
- package/src/server/request-context.ts +97 -18
- package/src/server/route-element-builder.ts +241 -253
- package/src/server/route-handler.ts +8 -8
- package/src/server/route-matcher.ts +21 -9
- package/src/server/rsc-cache-key-guard.ts +164 -0
- package/src/server/rsc-entry/api-handler.ts +6 -8
- package/src/server/rsc-entry/deny-fallback.ts +3 -2
- package/src/server/rsc-entry/error-renderer.ts +94 -35
- package/src/server/rsc-entry/helpers.ts +33 -28
- package/src/server/rsc-entry/index.ts +36 -33
- package/src/server/rsc-entry/render-route.ts +18 -10
- package/src/server/rsc-entry/revalidate-renderer.ts +3 -2
- package/src/server/rsc-entry/rsc-payload.ts +113 -40
- package/src/server/rsc-entry/rsc-stream.ts +29 -5
- package/src/server/rsc-entry/ssr-renderer.ts +38 -22
- package/src/server/skippable-prefix.ts +92 -0
- package/src/server/slot-interception.ts +168 -0
- package/src/server/slot-resolver.ts +263 -158
- package/src/server/ssr-bridge-types.ts +18 -0
- package/src/server/ssr-entry.ts +20 -10
- package/src/server/ssr-wrappers.tsx +33 -32
- package/src/server/state-tree-diff.ts +14 -55
- package/src/server/static-generator.ts +68 -29
- package/src/server/static-not-found.ts +134 -0
- package/src/server/status-code-resolver.ts +28 -11
- package/src/server/tree-builder.ts +35 -218
- package/src/server/types.ts +12 -7
- package/src/server/utils/element-type.ts +72 -0
- package/src/shared/als-slots.ts +72 -0
- package/src/shared/base-path.ts +80 -0
- package/src/shared/param-value.ts +244 -0
- package/src/shared/payload-root.ts +151 -0
- package/src/shared/rsc-cache-key.ts +269 -0
- package/src/shared/rsc-error-envelope.ts +31 -0
- package/src/shared/rsc-manifest.ts +29 -0
- package/src/shared/rsc-media-type.ts +43 -0
- package/src/shared/rsc-payload-path.ts +45 -0
- package/src/shared/segment-info.ts +60 -0
- package/src/shared/slot-params.ts +111 -0
- package/src/shared/static-platform-files.ts +75 -0
- package/dist/_chunks/build-output-helper-DOGYFb_X.js +0 -196
- package/dist/_chunks/build-output-helper-DOGYFb_X.js.map +0 -1
- package/dist/_chunks/cache-api-B-lhk9p4.js.map +0 -1
- package/dist/_chunks/canonicalize-DQHyFClh.js.map +0 -1
- package/dist/_chunks/cli-schema-sync-BTWEKJXo.js +0 -668
- package/dist/_chunks/cli-schema-sync-BTWEKJXo.js.map +0 -1
- package/dist/_chunks/define-COtkxMRT.js +0 -191
- package/dist/_chunks/define-COtkxMRT.js.map +0 -1
- package/dist/_chunks/define-c4au4I9R.js +0 -82
- package/dist/_chunks/define-c4au4I9R.js.map +0 -1
- package/dist/_chunks/fast-hash-D6hIVt1Y.js.map +0 -1
- package/dist/_chunks/logger-AWfuX-KJ.js.map +0 -1
- package/dist/_chunks/navigation-root-bUDZLw74.js +0 -124
- package/dist/_chunks/navigation-root-bUDZLw74.js.map +0 -1
- package/dist/_chunks/plugin-context---kTF5v8.js.map +0 -1
- package/dist/_chunks/registry-DbJPKoBp.js +0 -20
- package/dist/_chunks/registry-DbJPKoBp.js.map +0 -1
- package/dist/_chunks/router-ref-CtmF-aPv.js.map +0 -1
- package/dist/_chunks/schema-bridge-DT_Tn0Xf.js +0 -119
- package/dist/_chunks/schema-bridge-DT_Tn0Xf.js.map +0 -1
- package/dist/_chunks/segment-classify-Byy425ng.js.map +0 -1
- package/dist/_chunks/segment-context-ZDnXDkbz.js +0 -34
- package/dist/_chunks/segment-context-ZDnXDkbz.js.map +0 -1
- package/dist/_chunks/ssr-data-BOWsq18U.js.map +0 -1
- package/dist/_chunks/use-query-states-DFvWd-EA.js.map +0 -1
- package/dist/_chunks/use-segment-params-D1CzlgBo.js +0 -151
- package/dist/_chunks/use-segment-params-D1CzlgBo.js.map +0 -1
- package/dist/_chunks/walkers-_6zKFlch.js +0 -1002
- package/dist/_chunks/walkers-_6zKFlch.js.map +0 -1
- package/dist/client/error-boundary.js.map +0 -1
- package/dist/plugins/request-dep.d.ts +0 -32
- package/dist/plugins/request-dep.d.ts.map +0 -1
- package/dist/search-params/registry.d.ts +0 -20
- package/dist/search-params/registry.d.ts.map +0 -1
- package/dist/segment-params/define.d.ts +0 -89
- package/dist/segment-params/define.d.ts.map +0 -1
- package/dist/segment-params/index.d.ts +0 -3
- package/dist/segment-params/index.d.ts.map +0 -1
- package/dist/segment-params/index.js +0 -2
- package/src/plugins/request-dep.ts +0 -499
- package/src/search-params/registry.ts +0 -31
- package/src/segment-params/define.ts +0 -249
- package/src/segment-params/index.ts +0 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-lifecycle.d.ts","sourceRoot":"","sources":["../../src/client/router-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,iEAAiE;AACjE,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,eAAe,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;IAC9C;;;OAGG;IACH,cAAc,EAAE,CAAC,cAAc,CAAC,EAAE,WAAW,KAAK,eAAe,CAAC;IAClE;;;OAGG;IACH,aAAa,EAAE,CACb,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,EAChD,cAAc,CAAC,EAAE,WAAW,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB;;;OAGG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAChD,gFAAgF;IAChF,mBAAmB,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAEtD,mDAAmD;IACnD,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,6DAA6D;IAC7D,aAAa,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACnC,0CAA0C;IAC1C,eAAe,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;CACvE;AAYD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,uBAAuB,GAAG,mBAAmB,CAqN5F"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Pipeline — URL in, tree in React's hands.
|
|
3
|
+
*
|
|
4
|
+
* Everything between "the user asked for this URL" and "React is holding the
|
|
5
|
+
* destination's tree": consult the prefetch cache or fetch, prepare the commit
|
|
6
|
+
* that makes the page current, and hand the result over inside a transition.
|
|
7
|
+
*
|
|
8
|
+
* `router.ts` keeps the *operations* — `navigate`, `refresh`, `handlePopState`,
|
|
9
|
+
* `prefetch`, `applyRevalidation` — and each of them is a call into here. The
|
|
10
|
+
* split is the same one `router-effects.ts` and `router-lifecycle.ts` made
|
|
11
|
+
* (design/18-build-system.md §"No file >500 lines").
|
|
12
|
+
*
|
|
13
|
+
* See design/19-client-navigation.md §"Partial Rendering" and §"Prefetching".
|
|
14
|
+
*/
|
|
15
|
+
import type { FetchResult } from './rsc-fetch.js';
|
|
16
|
+
import { type ParamsSource } from '../shared/payload-root.js';
|
|
17
|
+
import type { PrefetchCache, PrefetchKey } from './segment-cache.js';
|
|
18
|
+
import type { StateTree } from '../shared/segment-info.js';
|
|
19
|
+
import type { NavigationState } from './navigation-context.js';
|
|
20
|
+
import type { NavigationCommitter } from './navigation-commit.js';
|
|
21
|
+
import type { RouterDeps } from './router-types.js';
|
|
22
|
+
/** A fetched payload plus the state update that makes it the current page. */
|
|
23
|
+
export type NavigationPayload = FetchResult & {
|
|
24
|
+
navState: NavigationState;
|
|
25
|
+
commit: () => void;
|
|
26
|
+
};
|
|
27
|
+
/** Options for a single `performNavigationFetch` call. */
|
|
28
|
+
export interface NavigationFetchOptions {
|
|
29
|
+
replace: boolean;
|
|
30
|
+
commitUrl?: string;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
skipHistory?: boolean;
|
|
33
|
+
departingUrl?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface NavigationPipelineDeps extends Pick<NavigationCommitter, 'prepareNavigation' | 'currentStateTree'> {
|
|
36
|
+
deps: RouterDeps;
|
|
37
|
+
prefetchCache: PrefetchCache;
|
|
38
|
+
/** Record that this navigation's tree reached React (router-lifecycle.ts). */
|
|
39
|
+
markHandedOff: (owner: AbortController) => void;
|
|
40
|
+
/** React committed this navigation's tree (router-lifecycle.ts). */
|
|
41
|
+
forgetOlderHandoffs: (owner: AbortController) => void;
|
|
42
|
+
}
|
|
43
|
+
export interface NavigationPipeline {
|
|
44
|
+
/** Fetch (or replay a prefetch), then stage the commit. */
|
|
45
|
+
performNavigationFetch: (url: string, options: NavigationFetchOptions) => Promise<NavigationPayload>;
|
|
46
|
+
/** Hand a payload to React inside a transition, or render it directly in tests. */
|
|
47
|
+
renderViaTransition: (url: string, owner: AbortController, perform: () => Promise<NavigationPayload>) => Promise<void>;
|
|
48
|
+
/** Render a decoded payload into the DOM if a renderer is available. */
|
|
49
|
+
renderPayload: (payload: unknown, navState: NavigationState, params: ParamsSource) => void;
|
|
50
|
+
/** Resolve thenable payloads on the fallback (test) path. */
|
|
51
|
+
resolveForFallback: (payload: unknown) => Promise<unknown>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Normalize a departing URL to the pathname the server is told about.
|
|
55
|
+
*
|
|
56
|
+
* This is the value sent as `X-Timber-URL` *and* the source half of the
|
|
57
|
+
* prefetch cache key — one function so a prefetch and the click that consumes
|
|
58
|
+
* it can never disagree about what "where we came from" means (TIM-1265). The
|
|
59
|
+
* query is dropped deliberately: it would land in the `_rsc` digest, which is
|
|
60
|
+
* logged (TIM-1268), and nothing downstream reads it — slot-skip resolution
|
|
61
|
+
* and interception scope both compare pathnames.
|
|
62
|
+
*
|
|
63
|
+
* Absolute inputs parse against the base and ignore it, so one call handles
|
|
64
|
+
* both `location.href` and a bare pathname.
|
|
65
|
+
*/
|
|
66
|
+
export declare function departingPathname(raw: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* The prefetch cache key for a destination.
|
|
69
|
+
*
|
|
70
|
+
* Both halves of the cache are keyed through here — the hover that writes an
|
|
71
|
+
* entry (`router.ts`'s `prefetch()`) and the click that consumes it
|
|
72
|
+
* (`performNavigationFetch` below) — so the two cannot disagree about what
|
|
73
|
+
* identifies a payload. That is the whole point of the key: `from` scopes it
|
|
74
|
+
* to the page the link was on (TIM-1265) and `scope` to the tree that was
|
|
75
|
+
* mounted (TIM-1282), and an entry written under one reading of either would
|
|
76
|
+
* simply never be found under the other, silently costing every prefetch.
|
|
77
|
+
*
|
|
78
|
+
* `departingPathname` is applied here rather than by callers for the same
|
|
79
|
+
* reason: it is also what goes out as `X-Timber-URL`, so the key and the
|
|
80
|
+
* request describe the same departure point.
|
|
81
|
+
*/
|
|
82
|
+
export declare function prefetchKeyFor(url: string, departingUrl: string, stateTree: StateTree | undefined): PrefetchKey;
|
|
83
|
+
export declare function createNavigationPipeline({ deps, prefetchCache, currentStateTree, prepareNavigation, markHandedOff, forgetOlderHandoffs, }: NavigationPipelineDeps): NavigationPipeline;
|
|
84
|
+
//# sourceMappingURL=router-pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-pipeline.d.ts","sourceRoot":"","sources":["../../src/client/router-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,8EAA8E;AAC9E,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAC5C,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,0DAA0D;AAC1D,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAClD,mBAAmB,EACnB,mBAAmB,GAAG,kBAAkB,CACzC;IACC,IAAI,EAAE,UAAU,CAAC;IACjB,aAAa,EAAE,aAAa,CAAC;IAC7B,8EAA8E;IAC9E,aAAa,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAChD,oEAAoE;IACpE,mBAAmB,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CACvD;AAED,MAAM,WAAW,kBAAkB;IACjC,2DAA2D;IAC3D,sBAAsB,EAAE,CACtB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,sBAAsB,KAC5B,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChC,mFAAmF;IACnF,mBAAmB,EAAE,CACnB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,KACtC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,wEAAwE;IACxE,aAAa,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3F,6DAA6D;IAC7D,kBAAkB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,SAAS,GAAG,SAAS,GAC/B,WAAW,CAEb;AAwCD,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,GACpB,EAAE,sBAAsB,GAAG,kBAAkB,CA4O7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-ref.d.ts","sourceRoot":"","sources":["../../src/client/router-ref.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"router-ref.d.ts","sourceRoot":"","sources":["../../src/client/router-ref.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAE5D;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,cAAc,CAK1C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,cAAc,GAAG,IAAI,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router Skew Recording — turning a rejection into "this bundle is superseded".
|
|
3
|
+
*
|
|
4
|
+
* Detection lives in `stale-client.ts`; this is the one place the router (and
|
|
5
|
+
* anything else holding an RSC rejection) turns an error into that verdict.
|
|
6
|
+
* Recovery is not here: every path that gives up on client-side navigation —
|
|
7
|
+
* skew or not — leaves through `createSpaExits()` in `router-effects.ts`.
|
|
8
|
+
*
|
|
9
|
+
* See design/33-version-skew.md §"Recovery on the next navigation"
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Record a version skew if `error` is one, and report whether it was.
|
|
13
|
+
*
|
|
14
|
+
* `VersionSkewError` is the origin saying so outright; the reactive shapes are
|
|
15
|
+
* inferred from the error text and are a no-op in dev.
|
|
16
|
+
*
|
|
17
|
+
* Closes over nothing — anywhere an RSC payload can fail needs it, including
|
|
18
|
+
* places that have no router instance to hand.
|
|
19
|
+
*/
|
|
20
|
+
export declare function recordSkew(error: unknown): boolean;
|
|
21
|
+
//# sourceMappingURL=router-skew.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-skew.d.ts","sourceRoot":"","sources":["../../src/client/router-skew.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMlD"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router Types — the router's surface, stated once.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `router.ts` so the factory file is navigation logic rather than
|
|
5
|
+
* declarations (design/18-build-system.md §"No file >500 lines"), and because
|
|
6
|
+
* `rsc-fetch.ts` needs `RouterDeps` while `router.ts` needs `FetchResult`:
|
|
7
|
+
* with the types here, neither imports the other.
|
|
8
|
+
*
|
|
9
|
+
* See design/19-client-navigation.md for the architecture these describe.
|
|
10
|
+
*/
|
|
11
|
+
import type { NavigationState } from './navigation-context.js';
|
|
12
|
+
import type { ParamsSource } from '../shared/payload-root.js';
|
|
13
|
+
import type { SegmentInfo } from '../shared/segment-info.js';
|
|
14
|
+
import type { SegmentCache, PrefetchCache } from './segment-cache.js';
|
|
15
|
+
import type { HistoryStack } from './history.js';
|
|
16
|
+
import type { TransitionResult } from './navigation-root.js';
|
|
17
|
+
export interface NavigationOptions {
|
|
18
|
+
/** Set to false to prevent scroll-to-top on forward navigation */
|
|
19
|
+
scroll?: boolean;
|
|
20
|
+
/** Use replaceState instead of pushState (replaces current history entry) */
|
|
21
|
+
replace?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @internal AbortSignal from the Navigation API's NavigateEvent.
|
|
24
|
+
* When provided, the signal is linked to the router's per-navigation
|
|
25
|
+
* AbortController so in-flight RSC fetches are cancelled when a new
|
|
26
|
+
* navigation starts.
|
|
27
|
+
*/
|
|
28
|
+
_signal?: AbortSignal;
|
|
29
|
+
/**
|
|
30
|
+
* @internal Skip pushState/replaceState — the Navigation API has already
|
|
31
|
+
* updated the URL via event.intercept(). Used for external navigations
|
|
32
|
+
* intercepted by the navigate event handler.
|
|
33
|
+
*/
|
|
34
|
+
_skipHistory?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* @internal The URL the user is navigating FROM, captured before the
|
|
37
|
+
* Navigation API commits the destination. Sent as X-Timber-URL for
|
|
38
|
+
* slot skip comparison on the server (TIM-1232).
|
|
39
|
+
*/
|
|
40
|
+
_departingUrl?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Function that decodes an RSC Flight stream into a React element tree.
|
|
44
|
+
* In production: createFromFetch from @vitejs/plugin-rsc/browser.
|
|
45
|
+
* In tests: a mock that returns the raw payload.
|
|
46
|
+
*/
|
|
47
|
+
export type RscDecoder = (fetchPromise: Promise<Response>) => unknown;
|
|
48
|
+
/**
|
|
49
|
+
* Function that renders a decoded RSC element tree into the DOM.
|
|
50
|
+
* In production: reactRoot.render(element).
|
|
51
|
+
* In tests: a no-op or mock.
|
|
52
|
+
*
|
|
53
|
+
* Receives the current NavigationState explicitly — no temporal
|
|
54
|
+
* coupling with setNavigationState/getNavigationState. The renderer
|
|
55
|
+
* wraps the element in NavigationProvider with this state.
|
|
56
|
+
*/
|
|
57
|
+
export type RootRenderer = (element: unknown, navState: NavigationState, params: ParamsSource) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Platform dependencies injected for testability. In production these
|
|
60
|
+
* map to browser APIs; in tests they're replaced with mocks.
|
|
61
|
+
*/
|
|
62
|
+
export interface RouterDeps {
|
|
63
|
+
fetch: (url: string, init: RequestInit) => Promise<Response>;
|
|
64
|
+
pushState: (data: unknown, unused: string, url: string) => void;
|
|
65
|
+
replaceState: (data: unknown, unused: string, url: string) => void;
|
|
66
|
+
scrollTo: (x: number, y: number) => void;
|
|
67
|
+
getCurrentUrl: () => string;
|
|
68
|
+
getScrollY: () => number;
|
|
69
|
+
/** Decode RSC Flight stream into React elements. If not provided, raw response text is stored. */
|
|
70
|
+
decodeRsc?: RscDecoder;
|
|
71
|
+
/** Render decoded RSC tree into the DOM. If not provided, rendering is a no-op. */
|
|
72
|
+
renderRoot?: RootRenderer;
|
|
73
|
+
/**
|
|
74
|
+
* Schedule a callback after the next paint. In the browser, this is
|
|
75
|
+
* requestAnimationFrame + setTimeout(0) to run after React commits.
|
|
76
|
+
* In tests, this runs the callback synchronously.
|
|
77
|
+
*/
|
|
78
|
+
afterPaint?: (callback: () => void) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Hand a navigation's tree to React in a transition, so the departing page
|
|
81
|
+
* stays visible while the destination resolves. Pending state is not React
|
|
82
|
+
* state — it lives in this router's external store (`setPending`), which
|
|
83
|
+
* `TopLoader` and `usePendingNavigation()` subscribe to (TIM-1307).
|
|
84
|
+
*
|
|
85
|
+
* The `perform` callback receives a `wrapPayload` function to wrap the
|
|
86
|
+
* decoded RSC payload with NavigationProvider + NuqsAdapter before
|
|
87
|
+
* NavigationRoot sets it as the new element. The `wrapPayload` function
|
|
88
|
+
* receives the NavigationState explicitly — no temporal coupling with
|
|
89
|
+
* getNavigationState().
|
|
90
|
+
*
|
|
91
|
+
* If not provided (tests), the router falls back to renderRoot.
|
|
92
|
+
*/
|
|
93
|
+
navigateTransition?: (pendingUrl: string, perform: (wrapPayload: (payload: unknown, navState: NavigationState,
|
|
94
|
+
/**
|
|
95
|
+
* The params to publish over `payload`. On a partial navigation
|
|
96
|
+
* `payload` is the *retained* tree and these are the *incoming*
|
|
97
|
+
* route's — the two deliberately come from different payloads,
|
|
98
|
+
* which is the entire point of the client owning the provider
|
|
99
|
+
* (TIM-1297).
|
|
100
|
+
*/
|
|
101
|
+
params: ParamsSource, segmentUpdates?: Map<string, unknown>) => unknown) => Promise<TransitionResult<unknown>>) => Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Whether the Navigation API is active and handling traversals.
|
|
104
|
+
* When true, the popstate handler is a no-op — the Navigation API's
|
|
105
|
+
* navigate event covers back/forward button presses.
|
|
106
|
+
*/
|
|
107
|
+
navigationApiActive?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Called around pushState/replaceState to set a flag that prevents
|
|
110
|
+
* the Navigation API's navigate listener from double-handling
|
|
111
|
+
* router-initiated navigations.
|
|
112
|
+
*/
|
|
113
|
+
setRouterNavigating?: (value: boolean) => void;
|
|
114
|
+
/**
|
|
115
|
+
* Save scroll position via the Navigation API's per-entry state.
|
|
116
|
+
* When provided, used instead of history.replaceState for scroll storage.
|
|
117
|
+
*/
|
|
118
|
+
saveNavigationEntryScroll?: (scrollY: number) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Signal that a router-initiated navigation has completed. Resolves the
|
|
121
|
+
* deferred promise that ties the browser's native loading state to the
|
|
122
|
+
* navigation lifecycle. Called in the finally block of navigate/refresh,
|
|
123
|
+
* the same place `setPending(false)` clears the TopLoader.
|
|
124
|
+
*/
|
|
125
|
+
completeRouterNavigation?: () => void;
|
|
126
|
+
/**
|
|
127
|
+
* Get the current unwrapped RSC payload element. Used for partial
|
|
128
|
+
* navigation: the router re-wraps the same element with new
|
|
129
|
+
* NavigationProvider context so mounted SegmentOutlets are preserved.
|
|
130
|
+
*/
|
|
131
|
+
_getCurrentPayload?: () => unknown;
|
|
132
|
+
/**
|
|
133
|
+
* Initiate a navigation via the Navigation API (`navigation.navigate()`).
|
|
134
|
+
* Fires the navigate event BEFORE committing the URL, allowing Chrome
|
|
135
|
+
* to show its native loading indicator. Falls back to pushState when
|
|
136
|
+
* unavailable.
|
|
137
|
+
*/
|
|
138
|
+
navigationNavigate?: (url: string, replace: boolean) => void;
|
|
139
|
+
/**
|
|
140
|
+
* Scroll the element matching a URL #fragment into view. Returns true
|
|
141
|
+
* when a matching element was found and scrolled. When absent or false,
|
|
142
|
+
* the router falls back to scroll-to-top on forward navigation — same
|
|
143
|
+
* as a full page load with an unknown fragment landing at the top.
|
|
144
|
+
*/
|
|
145
|
+
scrollToHash?: (hash: string) => boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Whether the client segment cache is enabled. When false (the default),
|
|
148
|
+
* the router sends no segment/slot lists, so every navigation gets a full
|
|
149
|
+
* RSC payload.
|
|
150
|
+
*
|
|
151
|
+
* It does NOT gate the `treePaths` half of X-Timber-State-Tree. Those
|
|
152
|
+
* describe the tree currently mounted, and interception scoping needs them
|
|
153
|
+
* to open a modal on top of a modal — a routing behaviour, not a caching
|
|
154
|
+
* optimization, so it must not depend on a performance opt-in (TIM-1282).
|
|
155
|
+
*/
|
|
156
|
+
clientSegmentCache?: boolean;
|
|
157
|
+
}
|
|
158
|
+
export interface RouterInstance {
|
|
159
|
+
/** Navigate to a new URL (forward navigation) */
|
|
160
|
+
navigate(url: string, options?: NavigationOptions): Promise<void>;
|
|
161
|
+
/** Full re-render of the current URL — no state tree sent */
|
|
162
|
+
refresh(): Promise<void>;
|
|
163
|
+
/** Handle a popstate event (back/forward button). scrollY is read from history.state. */
|
|
164
|
+
handlePopState(url: string, scrollY?: number, externalSignal?: AbortSignal): Promise<void>;
|
|
165
|
+
/** Whether a navigation is currently in flight */
|
|
166
|
+
isPending(): boolean;
|
|
167
|
+
/** The URL currently being navigated to, or null if idle */
|
|
168
|
+
getPendingUrl(): string | null;
|
|
169
|
+
/** Subscribe to pending state changes */
|
|
170
|
+
onPendingChange(listener: (pending: boolean) => void): () => void;
|
|
171
|
+
/** Prefetch an RSC payload for a URL (used by Link hover) */
|
|
172
|
+
prefetch(url: string): void;
|
|
173
|
+
/**
|
|
174
|
+
* Apply a piggybacked revalidation payload from a server action response.
|
|
175
|
+
* Takes the decoded payload *root* — tree plus the params it published —
|
|
176
|
+
* and renders it without a server fetch.
|
|
177
|
+
* See design/08-forms-and-actions.md §"Single-Roundtrip Revalidation".
|
|
178
|
+
*/
|
|
179
|
+
applyRevalidation(payloadRoot: unknown): void;
|
|
180
|
+
/**
|
|
181
|
+
* Populate the segment cache from server-provided segment metadata.
|
|
182
|
+
* Called on initial hydration with segment info embedded in the HTML.
|
|
183
|
+
*/
|
|
184
|
+
initSegmentCache(segments: SegmentInfo[]): void;
|
|
185
|
+
/** The segment cache (exposed for tests and <Link> prefetch) */
|
|
186
|
+
segmentCache: SegmentCache;
|
|
187
|
+
/** The prefetch cache (exposed for tests and <Link> prefetch) */
|
|
188
|
+
prefetchCache: PrefetchCache;
|
|
189
|
+
/** The history stack (exposed for tests) */
|
|
190
|
+
historyStack: HistoryStack;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Router navigation phase — discriminated union replacing scattered
|
|
194
|
+
* `pending` + `pendingUrl` boolean flags.
|
|
195
|
+
*
|
|
196
|
+
* - `idle`: No navigation in flight. The committed params/pathname
|
|
197
|
+
* are current.
|
|
198
|
+
* - `navigating`: A fetch or render is in progress. `targetUrl` is
|
|
199
|
+
* the destination being navigated to.
|
|
200
|
+
*/
|
|
201
|
+
export type RouterPhase = {
|
|
202
|
+
phase: 'idle';
|
|
203
|
+
} | {
|
|
204
|
+
phase: 'navigating';
|
|
205
|
+
targetUrl: string;
|
|
206
|
+
};
|
|
207
|
+
//# sourceMappingURL=router-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-types.d.ts","sourceRoot":"","sources":["../../src/client/router-types.ts"],"names":[],"mappings":"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"}
|
package/dist/client/router.d.ts
CHANGED
|
@@ -1,188 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { SegmentInfo } from './segment-cache';
|
|
3
|
-
import { HistoryStack } from './history';
|
|
4
|
-
import { type NavigationState } from './navigation-context.js';
|
|
5
|
-
export interface NavigationOptions {
|
|
6
|
-
/** Set to false to prevent scroll-to-top on forward navigation */
|
|
7
|
-
scroll?: boolean;
|
|
8
|
-
/** Use replaceState instead of pushState (replaces current history entry) */
|
|
9
|
-
replace?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* @internal AbortSignal from the Navigation API's NavigateEvent.
|
|
12
|
-
* When provided, the signal is linked to the router's per-navigation
|
|
13
|
-
* AbortController so in-flight RSC fetches are cancelled when a new
|
|
14
|
-
* navigation starts.
|
|
15
|
-
*/
|
|
16
|
-
_signal?: AbortSignal;
|
|
17
|
-
/**
|
|
18
|
-
* @internal Skip pushState/replaceState — the Navigation API has already
|
|
19
|
-
* updated the URL via event.intercept(). Used for external navigations
|
|
20
|
-
* intercepted by the navigate event handler.
|
|
21
|
-
*/
|
|
22
|
-
_skipHistory?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* @internal The URL the user is navigating FROM, captured before the
|
|
25
|
-
* Navigation API commits the destination. Sent as X-Timber-URL for
|
|
26
|
-
* slot skip comparison on the server (TIM-1232).
|
|
27
|
-
*/
|
|
28
|
-
_departingUrl?: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Function that decodes an RSC Flight stream into a React element tree.
|
|
32
|
-
* In production: createFromFetch from @vitejs/plugin-rsc/browser.
|
|
33
|
-
* In tests: a mock that returns the raw payload.
|
|
34
|
-
*/
|
|
35
|
-
export type RscDecoder = (fetchPromise: Promise<Response>) => unknown;
|
|
36
|
-
/**
|
|
37
|
-
* Function that renders a decoded RSC element tree into the DOM.
|
|
38
|
-
* In production: reactRoot.render(element).
|
|
39
|
-
* In tests: a no-op or mock.
|
|
40
|
-
*
|
|
41
|
-
* Receives the current NavigationState explicitly — no temporal
|
|
42
|
-
* coupling with setNavigationState/getNavigationState. The renderer
|
|
43
|
-
* wraps the element in NavigationProvider with this state.
|
|
44
|
-
*/
|
|
45
|
-
export type RootRenderer = (element: unknown, navState: NavigationState) => void;
|
|
46
|
-
/**
|
|
47
|
-
* Platform dependencies injected for testability. In production these
|
|
48
|
-
* map to browser APIs; in tests they're replaced with mocks.
|
|
49
|
-
*/
|
|
50
|
-
export interface RouterDeps {
|
|
51
|
-
fetch: (url: string, init: RequestInit) => Promise<Response>;
|
|
52
|
-
pushState: (data: unknown, unused: string, url: string) => void;
|
|
53
|
-
replaceState: (data: unknown, unused: string, url: string) => void;
|
|
54
|
-
scrollTo: (x: number, y: number) => void;
|
|
55
|
-
getCurrentUrl: () => string;
|
|
56
|
-
getScrollY: () => number;
|
|
57
|
-
/** Decode RSC Flight stream into React elements. If not provided, raw response text is stored. */
|
|
58
|
-
decodeRsc?: RscDecoder;
|
|
59
|
-
/** Render decoded RSC tree into the DOM. If not provided, rendering is a no-op. */
|
|
60
|
-
renderRoot?: RootRenderer;
|
|
61
|
-
/**
|
|
62
|
-
* Schedule a callback after the next paint. In the browser, this is
|
|
63
|
-
* requestAnimationFrame + setTimeout(0) to run after React commits.
|
|
64
|
-
* In tests, this runs the callback synchronously.
|
|
65
|
-
*/
|
|
66
|
-
afterPaint?: (callback: () => void) => void;
|
|
67
|
-
/**
|
|
68
|
-
* Run a navigation inside a React transition with optimistic pending URL.
|
|
69
|
-
* The pending URL shows immediately (useOptimistic urgent update) and
|
|
70
|
-
* reverts when the transition commits (atomic with the new tree).
|
|
71
|
-
*
|
|
72
|
-
* The `perform` callback receives a `wrapPayload` function to wrap the
|
|
73
|
-
* decoded RSC payload with NavigationProvider + NuqsAdapter before
|
|
74
|
-
* NavigationRoot sets it as the new element. The `wrapPayload` function
|
|
75
|
-
* receives the NavigationState explicitly — no temporal coupling with
|
|
76
|
-
* getNavigationState().
|
|
77
|
-
*
|
|
78
|
-
* If not provided (tests), the router falls back to renderRoot.
|
|
79
|
-
*/
|
|
80
|
-
navigateTransition?: (pendingUrl: string, perform: (wrapPayload: (payload: unknown, navState: NavigationState, segmentUpdates?: Map<string, unknown>) => unknown) => Promise<{
|
|
81
|
-
element: unknown;
|
|
82
|
-
decodePromise: Promise<void> | null;
|
|
83
|
-
}>) => Promise<void>;
|
|
84
|
-
/**
|
|
85
|
-
* Whether the Navigation API is active and handling traversals.
|
|
86
|
-
* When true, the popstate handler is a no-op — the Navigation API's
|
|
87
|
-
* navigate event covers back/forward button presses.
|
|
88
|
-
*/
|
|
89
|
-
navigationApiActive?: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Called around pushState/replaceState to set a flag that prevents
|
|
92
|
-
* the Navigation API's navigate listener from double-handling
|
|
93
|
-
* router-initiated navigations.
|
|
94
|
-
*/
|
|
95
|
-
setRouterNavigating?: (value: boolean) => void;
|
|
96
|
-
/**
|
|
97
|
-
* Save scroll position via the Navigation API's per-entry state.
|
|
98
|
-
* When provided, used instead of history.replaceState for scroll storage.
|
|
99
|
-
*/
|
|
100
|
-
saveNavigationEntryScroll?: (scrollY: number) => void;
|
|
101
|
-
/**
|
|
102
|
-
* Signal that a router-initiated navigation has completed. Resolves the
|
|
103
|
-
* deferred promise that ties the browser's native loading state to the
|
|
104
|
-
* navigation lifecycle. Called in the finally block of navigate/refresh,
|
|
105
|
-
* aligned with when the TopLoader's pendingUrl clears.
|
|
106
|
-
*/
|
|
107
|
-
completeRouterNavigation?: () => void;
|
|
108
|
-
/**
|
|
109
|
-
* Get the current unwrapped RSC payload element. Used for partial
|
|
110
|
-
* navigation: the router re-wraps the same element with new
|
|
111
|
-
* NavigationProvider context so mounted SegmentOutlets are preserved.
|
|
112
|
-
*/
|
|
113
|
-
_getCurrentPayload?: () => unknown;
|
|
114
|
-
/**
|
|
115
|
-
* Initiate a navigation via the Navigation API (`navigation.navigate()`).
|
|
116
|
-
* Fires the navigate event BEFORE committing the URL, allowing Chrome
|
|
117
|
-
* to show its native loading indicator. Falls back to pushState when
|
|
118
|
-
* unavailable.
|
|
119
|
-
*/
|
|
120
|
-
navigationNavigate?: (url: string, replace: boolean) => void;
|
|
121
|
-
/**
|
|
122
|
-
* Scroll the element matching a URL #fragment into view. Returns true
|
|
123
|
-
* when a matching element was found and scrolled. When absent or false,
|
|
124
|
-
* the router falls back to scroll-to-top on forward navigation — same
|
|
125
|
-
* as a full page load with an unknown fragment landing at the top.
|
|
126
|
-
*/
|
|
127
|
-
scrollToHash?: (hash: string) => boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Whether the client segment cache is enabled. When false (the default),
|
|
130
|
-
* the router does not send X-Timber-State-Tree headers and does not
|
|
131
|
-
* populate the segment cache. Every navigation gets a full RSC payload.
|
|
132
|
-
*/
|
|
133
|
-
clientSegmentCache?: boolean;
|
|
134
|
-
}
|
|
135
|
-
export interface RouterInstance {
|
|
136
|
-
/** Navigate to a new URL (forward navigation) */
|
|
137
|
-
navigate(url: string, options?: NavigationOptions): Promise<void>;
|
|
138
|
-
/** Full re-render of the current URL — no state tree sent */
|
|
139
|
-
refresh(): Promise<void>;
|
|
140
|
-
/** Handle a popstate event (back/forward button). scrollY is read from history.state. */
|
|
141
|
-
handlePopState(url: string, scrollY?: number, externalSignal?: AbortSignal): Promise<void>;
|
|
142
|
-
/** Whether a navigation is currently in flight */
|
|
143
|
-
isPending(): boolean;
|
|
144
|
-
/** The URL currently being navigated to, or null if idle */
|
|
145
|
-
getPendingUrl(): string | null;
|
|
146
|
-
/** Subscribe to pending state changes */
|
|
147
|
-
onPendingChange(listener: (pending: boolean) => void): () => void;
|
|
148
|
-
/** Prefetch an RSC payload for a URL (used by Link hover) */
|
|
149
|
-
prefetch(url: string): void;
|
|
150
|
-
/**
|
|
151
|
-
* Apply a piggybacked revalidation payload from a server action response.
|
|
152
|
-
* Renders the element tree and updates head elements without a server fetch.
|
|
153
|
-
* See design/08-forms-and-actions.md §"Single-Roundtrip Revalidation".
|
|
154
|
-
*/
|
|
155
|
-
applyRevalidation(element: unknown): void;
|
|
156
|
-
/**
|
|
157
|
-
* Populate the segment cache from server-provided segment metadata.
|
|
158
|
-
* Called on initial hydration with segment info embedded in the HTML.
|
|
159
|
-
*/
|
|
160
|
-
initSegmentCache(segments: SegmentInfo[]): void;
|
|
161
|
-
/** The segment cache (exposed for tests and <Link> prefetch) */
|
|
162
|
-
segmentCache: SegmentCache;
|
|
163
|
-
/** The prefetch cache (exposed for tests and <Link> prefetch) */
|
|
164
|
-
prefetchCache: PrefetchCache;
|
|
165
|
-
/** The history stack (exposed for tests) */
|
|
166
|
-
historyStack: HistoryStack;
|
|
167
|
-
}
|
|
1
|
+
import type { RouterDeps, RouterInstance } from './router-types.js';
|
|
168
2
|
/**
|
|
169
3
|
* Create a router instance. In production, called once at app hydration
|
|
170
4
|
* with real browser APIs. In tests, called with mock dependencies.
|
|
171
5
|
*/
|
|
172
|
-
/**
|
|
173
|
-
* Router navigation phase — discriminated union replacing scattered
|
|
174
|
-
* `pending` + `pendingUrl` boolean flags.
|
|
175
|
-
*
|
|
176
|
-
* - `idle`: No navigation in flight. The committed params/pathname
|
|
177
|
-
* are current.
|
|
178
|
-
* - `navigating`: A fetch or render is in progress. `targetUrl` is
|
|
179
|
-
* the destination being navigated to.
|
|
180
|
-
*/
|
|
181
|
-
export type RouterPhase = {
|
|
182
|
-
phase: 'idle';
|
|
183
|
-
} | {
|
|
184
|
-
phase: 'navigating';
|
|
185
|
-
targetUrl: string;
|
|
186
|
-
};
|
|
187
6
|
export declare function createRouter(deps: RouterDeps): RouterInstance;
|
|
188
7
|
//# sourceMappingURL=router.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/client/router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/client/router.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAqB,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIvF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,CAoY7D"}
|