@timber-js/app 0.2.0-alpha.21 → 0.2.0-alpha.211
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/LICENSE +8 -0
- package/agent-skill.md +346 -0
- package/bin/timber.mjs +15 -1
- package/dist/_chunks/actions-Rjk4htmA.js +1199 -0
- package/dist/_chunks/actions-Rjk4htmA.js.map +1 -0
- package/dist/_chunks/als-registry-DaxkVjt5.js +45 -0
- package/dist/_chunks/als-registry-DaxkVjt5.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-RV_BRcF1.js +367 -0
- package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +1 -0
- package/dist/_chunks/cache-api-DGdYfNJn.js +1182 -0
- package/dist/_chunks/cache-api-DGdYfNJn.js.map +1 -0
- package/dist/_chunks/canonicalize-CgHoscYO.js +66 -0
- package/dist/_chunks/canonicalize-CgHoscYO.js.map +1 -0
- package/dist/_chunks/chains-DGX9zmg9.js +272 -0
- package/dist/_chunks/chains-DGX9zmg9.js.map +1 -0
- package/dist/_chunks/classify-QwG5rxKI.js +147 -0
- package/dist/_chunks/classify-QwG5rxKI.js.map +1 -0
- package/dist/_chunks/cli-check-ajNY3B2e.js +252 -0
- package/dist/_chunks/cli-check-ajNY3B2e.js.map +1 -0
- package/dist/_chunks/cli-context-By7k2xVo.js +70 -0
- package/dist/_chunks/cli-context-By7k2xVo.js.map +1 -0
- package/dist/_chunks/cli-schema-sync-D2eI8jEg.js +299 -0
- package/dist/_chunks/cli-schema-sync-D2eI8jEg.js.map +1 -0
- package/dist/_chunks/client-dep-entries-2HCF09no.js +66 -0
- package/dist/_chunks/client-dep-entries-2HCF09no.js.map +1 -0
- package/dist/_chunks/cloudflare-Byxl8FWP.js +1333 -0
- package/dist/_chunks/cloudflare-Byxl8FWP.js.map +1 -0
- package/dist/_chunks/codec-registry-oOUxugz3.js +21 -0
- package/dist/_chunks/codec-registry-oOUxugz3.js.map +1 -0
- package/dist/_chunks/codegen-Bps1sLKJ.js +432 -0
- package/dist/_chunks/codegen-Bps1sLKJ.js.map +1 -0
- package/dist/_chunks/convention-lint-DLmhGsRS.js +590 -0
- package/dist/_chunks/convention-lint-DLmhGsRS.js.map +1 -0
- package/dist/_chunks/dev-server-TFpEwm3H.js +2039 -0
- package/dist/_chunks/dev-server-TFpEwm3H.js.map +1 -0
- package/dist/_chunks/dist-DtrJyBbw.js +386 -0
- package/dist/_chunks/dist-DtrJyBbw.js.map +1 -0
- package/dist/_chunks/error-boundary-DsNScGRM.js +1024 -0
- package/dist/_chunks/error-boundary-DsNScGRM.js.map +1 -0
- package/dist/_chunks/fast-hash-C-tVYrLb.js +41 -0
- package/dist/_chunks/fast-hash-C-tVYrLb.js.map +1 -0
- package/dist/_chunks/format-BKclgVbk.js +14 -0
- package/dist/_chunks/format-BKclgVbk.js.map +1 -0
- package/dist/_chunks/fs-identity-BRKuL215.js +207 -0
- package/dist/_chunks/fs-identity-BRKuL215.js.map +1 -0
- package/dist/_chunks/graph-cache-CYiUS2aS.js +303 -0
- package/dist/_chunks/graph-cache-CYiUS2aS.js.map +1 -0
- package/dist/_chunks/href-validation-BIrxavIy.js +213 -0
- package/dist/_chunks/href-validation-BIrxavIy.js.map +1 -0
- package/dist/_chunks/json-lossy-check-CVuRs2hG.js +66 -0
- package/dist/_chunks/json-lossy-check-CVuRs2hG.js.map +1 -0
- package/dist/_chunks/live-graph-cNuWMYQI.js +151 -0
- package/dist/_chunks/live-graph-cNuWMYQI.js.map +1 -0
- package/dist/_chunks/logger-BP0LN6vP.js +662 -0
- package/dist/_chunks/logger-BP0LN6vP.js.map +1 -0
- package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js → metadata-routes-DSDjM_hJ.js} +71 -27
- package/dist/_chunks/metadata-routes-DSDjM_hJ.js.map +1 -0
- package/dist/_chunks/navigation-root-BQfo1-kG.js +126 -0
- package/dist/_chunks/navigation-root-BQfo1-kG.js.map +1 -0
- package/dist/_chunks/param-value-C8TNYchQ.js +66 -0
- package/dist/_chunks/param-value-C8TNYchQ.js.map +1 -0
- package/dist/_chunks/plugin-context-BPBPc3lL.js +345 -0
- package/dist/_chunks/plugin-context-BPBPc3lL.js.map +1 -0
- package/dist/_chunks/poison-rules-DoEhbqaY.js +110 -0
- package/dist/_chunks/poison-rules-DoEhbqaY.js.map +1 -0
- package/dist/_chunks/poison-scan-CfQ3unZR.js +99 -0
- package/dist/_chunks/poison-scan-CfQ3unZR.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/render-timeout-DOf_BBcO.js +46 -0
- package/dist/_chunks/render-timeout-DOf_BBcO.js.map +1 -0
- package/dist/_chunks/resolve-schema-CBR6Lm4i.js +50 -0
- package/dist/_chunks/resolve-schema-CBR6Lm4i.js.map +1 -0
- package/dist/_chunks/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/_chunks/rsc-cache-key-ClUiXQnK.js +243 -0
- package/dist/_chunks/rsc-cache-key-ClUiXQnK.js.map +1 -0
- package/dist/_chunks/rsc-media-type-DDc7duTD.js +61 -0
- package/dist/_chunks/rsc-media-type-DDc7duTD.js.map +1 -0
- package/dist/_chunks/rsc-payload-path-dffcs4jp.js +54 -0
- package/dist/_chunks/rsc-payload-path-dffcs4jp.js.map +1 -0
- package/dist/_chunks/scan-BoP17W3w.js +140 -0
- package/dist/_chunks/scan-BoP17W3w.js.map +1 -0
- package/dist/_chunks/scanner-DmqdxzbW.js +2056 -0
- package/dist/_chunks/scanner-DmqdxzbW.js.map +1 -0
- package/dist/_chunks/schema-bridge-C83xa9lT.js +199 -0
- package/dist/_chunks/schema-bridge-C83xa9lT.js.map +1 -0
- package/dist/_chunks/segment-classify-C539Pa2O.js +197 -0
- package/dist/_chunks/segment-classify-C539Pa2O.js.map +1 -0
- package/dist/_chunks/segment-context-xtPUGfdq.js +137 -0
- package/dist/_chunks/segment-context-xtPUGfdq.js.map +1 -0
- package/dist/_chunks/segment-keys-D5hu1hz4.js +62 -0
- package/dist/_chunks/segment-keys-D5hu1hz4.js.map +1 -0
- package/dist/_chunks/singleflight-BeVMMKi0.js +55 -0
- package/dist/_chunks/singleflight-BeVMMKi0.js.map +1 -0
- package/dist/_chunks/sizeof-BM1409x2.js +36 -0
- package/dist/_chunks/sizeof-BM1409x2.js.map +1 -0
- package/dist/_chunks/ssr-data-nA3I70_n.js +49 -0
- package/dist/_chunks/ssr-data-nA3I70_n.js.map +1 -0
- package/dist/_chunks/state-BhNGPsdi.js +50 -0
- package/dist/_chunks/state-BhNGPsdi.js.map +1 -0
- package/dist/_chunks/status-page-marker-BRX9Ib-d.js +564 -0
- package/dist/_chunks/status-page-marker-BRX9Ib-d.js.map +1 -0
- package/dist/_chunks/tree-match-6yihorhk.js +169 -0
- package/dist/_chunks/tree-match-6yihorhk.js.map +1 -0
- package/dist/_chunks/use-query-states-I3JMng6J.js +226 -0
- package/dist/_chunks/use-query-states-I3JMng6J.js.map +1 -0
- package/dist/_chunks/walkers-Czu2jXFq.js +144 -0
- package/dist/_chunks/walkers-Czu2jXFq.js.map +1 -0
- package/dist/_chunks/write-file-atomic-D1qWqHb4.js +32 -0
- package/dist/_chunks/write-file-atomic-D1qWqHb4.js.map +1 -0
- package/dist/adapters/build-output-helper.d.ts +72 -0
- package/dist/adapters/build-output-helper.d.ts.map +1 -0
- package/dist/adapters/canonicalize-module.d.ts +8 -0
- package/dist/adapters/canonicalize-module.d.ts.map +1 -0
- package/dist/adapters/cloudflare-dev.d.ts +109 -0
- package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
- package/dist/adapters/cloudflare-dev.js +74 -0
- package/dist/adapters/cloudflare-dev.js.map +1 -0
- package/dist/adapters/cloudflare-kv-cache.d.ts +65 -0
- package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
- package/dist/adapters/cloudflare-kv-cache.js +123 -0
- package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
- package/dist/adapters/cloudflare.d.ts +224 -24
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +2 -188
- package/dist/adapters/compress-module.d.ts +25 -4
- package/dist/adapters/compress-module.d.ts.map +1 -1
- package/dist/adapters/fs-identity.d.ts +63 -0
- package/dist/adapters/fs-identity.d.ts.map +1 -0
- package/dist/adapters/nitro-presets.d.ts +31 -0
- package/dist/adapters/nitro-presets.d.ts.map +1 -0
- package/dist/adapters/nitro-preview.d.ts +64 -0
- package/dist/adapters/nitro-preview.d.ts.map +1 -0
- package/dist/adapters/nitro.d.ts +54 -37
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +631 -359
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/shared.d.ts +67 -0
- package/dist/adapters/shared.d.ts.map +1 -0
- package/dist/adapters/types.d.ts +122 -16
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/adapters/types.js +0 -0
- package/dist/analyze/chains.d.ts +124 -0
- package/dist/analyze/chains.d.ts.map +1 -0
- package/dist/analyze/classify.d.ts +153 -0
- package/dist/analyze/classify.d.ts.map +1 -0
- package/dist/analyze/crawl-entry.d.ts +17 -0
- package/dist/analyze/crawl-entry.d.ts.map +1 -0
- package/dist/analyze/crawl-entry.js +314 -0
- package/dist/analyze/crawl-entry.js.map +1 -0
- package/dist/analyze/crawl.d.ts +134 -0
- package/dist/analyze/crawl.d.ts.map +1 -0
- package/dist/analyze/graph-cache.d.ts +104 -0
- package/dist/analyze/graph-cache.d.ts.map +1 -0
- package/dist/analyze/graph-command.d.ts +43 -0
- package/dist/analyze/graph-command.d.ts.map +1 -0
- package/dist/analyze/graph-command.js +472 -0
- package/dist/analyze/graph-command.js.map +1 -0
- package/dist/analyze/live-graph.d.ts +81 -0
- package/dist/analyze/live-graph.d.ts.map +1 -0
- package/dist/analyze/poison-rules.d.ts +72 -0
- package/dist/analyze/poison-rules.d.ts.map +1 -0
- package/dist/analyze/poison-scan.d.ts +48 -0
- package/dist/analyze/poison-scan.d.ts.map +1 -0
- package/dist/analyze/scan.d.ts +73 -0
- package/dist/analyze/scan.d.ts.map +1 -0
- package/dist/cache/cache-api.d.ts +48 -0
- package/dist/cache/cache-api.d.ts.map +1 -0
- package/dist/cache/fast-hash.d.ts +5 -0
- package/dist/cache/fast-hash.d.ts.map +1 -1
- package/dist/cache/handler-store.d.ts +33 -0
- package/dist/cache/handler-store.d.ts.map +1 -0
- package/dist/cache/index.d.ts +32 -9
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +3 -326
- package/dist/cache/invalidation-epoch.d.ts +43 -0
- package/dist/cache/invalidation-epoch.d.ts.map +1 -0
- package/dist/cache/json-lossy-check.d.ts +11 -0
- package/dist/cache/json-lossy-check.d.ts.map +1 -0
- package/dist/cache/redis-handler.d.ts +141 -9
- package/dist/cache/redis-handler.d.ts.map +1 -1
- package/dist/cache/singleflight.d.ts +21 -2
- package/dist/cache/singleflight.d.ts.map +1 -1
- package/dist/cache/sizeof.d.ts +22 -0
- package/dist/cache/sizeof.d.ts.map +1 -0
- package/dist/cache/stable-stringify.d.ts +9 -0
- package/dist/cache/stable-stringify.d.ts.map +1 -1
- package/dist/cache/store.d.ts +53 -0
- package/dist/cache/store.d.ts.map +1 -0
- package/dist/cache/stores/cloudflare-kv.d.ts +38 -0
- package/dist/cache/stores/cloudflare-kv.d.ts.map +1 -0
- package/dist/cache/stores/cloudflare-kv.js +29 -0
- package/dist/cache/stores/cloudflare-kv.js.map +1 -0
- package/dist/cache/stores/memory.d.ts +42 -0
- package/dist/cache/stores/memory.d.ts.map +1 -0
- package/dist/cache/stores/memory.js +90 -0
- package/dist/cache/stores/memory.js.map +1 -0
- package/dist/cache/stores/redis.d.ts +69 -0
- package/dist/cache/stores/redis.d.ts.map +1 -0
- package/dist/cache/stores/redis.js +35 -0
- package/dist/cache/stores/redis.js.map +1 -0
- package/dist/cache/stores/vercel.d.ts +36 -0
- package/dist/cache/stores/vercel.d.ts.map +1 -0
- package/dist/cache/stores/vercel.js +33 -0
- package/dist/cache/stores/vercel.js.map +1 -0
- package/dist/cache/tag-aware-handler.d.ts +52 -0
- package/dist/cache/tag-aware-handler.d.ts.map +1 -0
- package/dist/cache/timber-cache.d.ts +21 -11
- package/dist/cache/timber-cache.d.ts.map +1 -1
- package/dist/cdn/cloudflare-purge.d.ts +23 -0
- package/dist/cdn/cloudflare-purge.d.ts.map +1 -0
- package/dist/cdn/cloudflare-purge.js +30 -0
- package/dist/cdn/cloudflare-purge.js.map +1 -0
- package/dist/cdn/fastly-purge.d.ts +25 -0
- package/dist/cdn/fastly-purge.d.ts.map +1 -0
- package/dist/cdn/fastly-purge.js +33 -0
- package/dist/cdn/fastly-purge.js.map +1 -0
- package/dist/cdn/headers.d.ts +97 -0
- package/dist/cdn/headers.d.ts.map +1 -0
- package/dist/cdn/index.d.ts +5 -0
- package/dist/cdn/index.d.ts.map +1 -0
- package/dist/cdn/index.js +94 -0
- package/dist/cdn/index.js.map +1 -0
- package/dist/cdn/purge-store.d.ts +23 -0
- package/dist/cdn/purge-store.d.ts.map +1 -0
- package/dist/cdn/workers-cache-purge.d.ts +20 -0
- package/dist/cdn/workers-cache-purge.d.ts.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 +133 -0
- package/dist/cli-check.d.ts.map +1 -0
- package/dist/cli-context.d.ts +54 -0
- package/dist/cli-context.d.ts.map +1 -0
- package/dist/cli-schema-sync.d.ts +59 -0
- package/dist/cli-schema-sync.d.ts.map +1 -0
- package/dist/cli.d.ts +85 -13
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +224 -63
- package/dist/cli.js.map +1 -1
- package/dist/client/browser-dev.d.ts +42 -2
- package/dist/client/browser-dev.d.ts.map +1 -1
- package/dist/client/browser-entry/action-dispatch.d.ts +19 -0
- package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
- package/dist/client/browser-entry/action-queue.d.ts +63 -0
- package/dist/client/browser-entry/action-queue.d.ts.map +1 -0
- package/dist/client/browser-entry/hmr.d.ts +21 -0
- package/dist/client/browser-entry/hmr.d.ts.map +1 -0
- package/dist/client/browser-entry/hydrate.d.ts +53 -0
- package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
- package/dist/client/browser-entry/index.d.ts +30 -0
- package/dist/client/browser-entry/index.d.ts.map +1 -0
- package/dist/client/browser-entry/post-hydration.d.ts +26 -0
- package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
- package/dist/client/browser-entry/router-init.d.ts +41 -0
- package/dist/client/browser-entry/router-init.d.ts.map +1 -0
- package/dist/client/browser-entry/rsc-stream.d.ts +32 -0
- package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
- package/dist/client/browser-entry/scroll.d.ts +28 -0
- package/dist/client/browser-entry/scroll.d.ts.map +1 -0
- package/dist/client/deny-last-resort.d.ts +29 -0
- package/dist/client/deny-last-resort.d.ts.map +1 -0
- package/dist/client/error-boundary.d.ts +58 -9
- package/dist/client/error-boundary.d.ts.map +1 -1
- package/dist/client/error-boundary.js +2 -126
- package/dist/client/error-reconstituter.d.ts +55 -0
- package/dist/client/error-reconstituter.d.ts.map +1 -0
- package/dist/client/form.d.ts +16 -27
- package/dist/client/form.d.ts.map +1 -1
- package/dist/client/global-context.d.ts +15 -0
- package/dist/client/global-context.d.ts.map +1 -0
- package/dist/client/history.d.ts +50 -9
- package/dist/client/history.d.ts.map +1 -1
- package/dist/client/index.d.ts +20 -33
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +330 -1150
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +20 -0
- package/dist/client/internal.d.ts.map +1 -0
- package/dist/client/internal.js +792 -0
- package/dist/client/internal.js.map +1 -0
- package/dist/client/link.d.ts +85 -60
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/location-search.d.ts +12 -0
- package/dist/client/location-search.d.ts.map +1 -0
- package/dist/client/navigation-api.d.ts +133 -0
- package/dist/client/navigation-api.d.ts.map +1 -0
- package/dist/client/navigation-commit.d.ts +111 -0
- package/dist/client/navigation-commit.d.ts.map +1 -0
- package/dist/client/navigation-context.d.ts +54 -36
- package/dist/client/navigation-context.d.ts.map +1 -1
- package/dist/client/navigation-root.d.ts +106 -0
- package/dist/client/navigation-root.d.ts.map +1 -0
- package/dist/client/navigation-transition.d.ts +192 -0
- package/dist/client/navigation-transition.d.ts.map +1 -0
- package/dist/client/nuqs-adapter.d.ts +1 -1
- package/dist/client/nuqs-adapter.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/react-root.d.ts +45 -0
- package/dist/client/react-root.d.ts.map +1 -0
- package/dist/client/router-effects.d.ts +137 -0
- package/dist/client/router-effects.d.ts.map +1 -0
- package/dist/client/router-lifecycle.d.ts +98 -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 +2 -2
- 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 +334 -0
- package/dist/client/router-types.d.ts.map +1 -0
- package/dist/client/router-url.d.ts +24 -0
- package/dist/client/router-url.d.ts.map +1 -0
- package/dist/client/router.d.ts +1 -97
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/rsc-fetch.d.ts +110 -28
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +186 -25
- package/dist/client/segment-cache.d.ts.map +1 -1
- package/dist/client/segment-context.d.ts.map +1 -1
- package/dist/client/segment-outlet.d.ts +68 -0
- package/dist/client/segment-outlet.d.ts.map +1 -0
- package/dist/client/segment-update-context.d.ts +15 -0
- package/dist/client/segment-update-context.d.ts.map +1 -0
- package/dist/client/shallow-url.d.ts +10 -0
- package/dist/client/shallow-url.d.ts.map +1 -0
- package/dist/client/slot-content-cache-context.d.ts +35 -0
- package/dist/client/slot-content-cache-context.d.ts.map +1 -0
- package/dist/client/slot-context.d.ts +31 -0
- package/dist/client/slot-context.d.ts.map +1 -0
- package/dist/client/slot-outlet.d.ts +16 -0
- package/dist/client/slot-outlet.d.ts.map +1 -0
- package/dist/client/slot-provider.d.ts +25 -0
- package/dist/client/slot-provider.d.ts.map +1 -0
- package/dist/client/ssr-data.d.ts +26 -50
- 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 +21 -13
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/status-page-marker.d.ts +25 -0
- package/dist/client/status-page-marker.d.ts.map +1 -0
- package/dist/client/top-loader.d.ts +7 -6
- 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 +12 -0
- package/dist/client/use-cookie.d.ts.map +1 -1
- package/dist/client/use-link-status.d.ts +5 -5
- package/dist/client/use-link-status.d.ts.map +1 -1
- package/dist/client/use-pathname.d.ts +13 -11
- package/dist/client/use-pathname.d.ts.map +1 -1
- package/dist/client/use-pending-navigation.d.ts +23 -0
- package/dist/client/use-pending-navigation.d.ts.map +1 -0
- package/dist/client/use-query-states.d.ts +10 -4
- package/dist/client/use-query-states.d.ts.map +1 -1
- package/dist/client/use-router.d.ts +15 -8
- package/dist/client/use-router.d.ts.map +1 -1
- package/dist/client/use-search-params.d.ts +15 -8
- package/dist/client/use-search-params.d.ts.map +1 -1
- package/dist/client/use-segment-params.d.ts +55 -0
- package/dist/client/use-segment-params.d.ts.map +1 -0
- package/dist/codec.d.ts +69 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +76 -0
- package/dist/codec.js.map +1 -0
- package/dist/config-types.d.ts +323 -0
- package/dist/config-types.d.ts.map +1 -0
- package/dist/config-validation.d.ts +68 -0
- package/dist/config-validation.d.ts.map +1 -0
- package/dist/cookies/define-cookie.d.ts +58 -25
- package/dist/cookies/define-cookie.d.ts.map +1 -1
- package/dist/cookies/index.d.ts +3 -2
- package/dist/cookies/index.d.ts.map +1 -1
- package/dist/cookies/index.js +256 -36
- package/dist/cookies/index.js.map +1 -1
- package/dist/cookies/json-cookie.d.ts +64 -0
- package/dist/cookies/json-cookie.d.ts.map +1 -0
- package/dist/cookies/validation.d.ts +34 -0
- package/dist/cookies/validation.d.ts.map +1 -0
- package/dist/dev-tools/404-page.d.ts +50 -0
- package/dist/dev-tools/404-page.d.ts.map +1 -0
- package/dist/dev-tools/browser-logs.d.ts +40 -0
- package/dist/dev-tools/browser-logs.d.ts.map +1 -0
- package/dist/dev-tools/dev-page-shell.d.ts +95 -0
- package/dist/dev-tools/dev-page-shell.d.ts.map +1 -0
- package/dist/dev-tools/error-page.d.ts +32 -0
- package/dist/dev-tools/error-page.d.ts.map +1 -0
- package/dist/dev-tools/holding-server.d.ts +46 -0
- package/dist/dev-tools/holding-server.d.ts.map +1 -0
- package/dist/dev-tools/hydration-overlay.d.ts +11 -0
- package/dist/dev-tools/hydration-overlay.d.ts.map +1 -0
- package/dist/dev-tools/index.d.ts +31 -0
- package/dist/dev-tools/index.d.ts.map +1 -0
- package/dist/dev-tools/instrumentation.d.ts +74 -0
- package/dist/dev-tools/instrumentation.d.ts.map +1 -0
- package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
- package/dist/dev-tools/logger.d.ts.map +1 -0
- package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +17 -3
- package/dist/dev-tools/logs.d.ts.map +1 -0
- package/dist/{plugins/dev-error-overlay.d.ts → dev-tools/overlay.d.ts} +15 -25
- package/dist/dev-tools/overlay.d.ts.map +1 -0
- package/dist/dev-tools/stack-classifier.d.ts +34 -0
- package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
- package/dist/dev-tools/terminal.d.ts +28 -0
- package/dist/dev-tools/terminal.d.ts.map +1 -0
- package/dist/fonts/ast-walk.d.ts +68 -0
- package/dist/fonts/ast-walk.d.ts.map +1 -0
- package/dist/fonts/ast.d.ts +112 -8
- package/dist/fonts/ast.d.ts.map +1 -1
- package/dist/fonts/bundle.d.ts +50 -0
- package/dist/fonts/bundle.d.ts.map +1 -0
- package/dist/fonts/css.d.ts +1 -1
- package/dist/fonts/dev-middleware.d.ts +22 -0
- package/dist/fonts/dev-middleware.d.ts.map +1 -0
- package/dist/fonts/fallbacks.d.ts +0 -7
- package/dist/fonts/fallbacks.d.ts.map +1 -1
- package/dist/fonts/google.d.ts +5 -3
- package/dist/fonts/google.d.ts.map +1 -1
- package/dist/fonts/local.d.ts +5 -5
- package/dist/fonts/local.d.ts.map +1 -1
- package/dist/fonts/paths.d.ts +43 -0
- package/dist/fonts/paths.d.ts.map +1 -0
- package/dist/fonts/pipeline.d.ts +177 -0
- package/dist/fonts/pipeline.d.ts.map +1 -0
- package/dist/fonts/transform.d.ts +82 -0
- package/dist/fonts/transform.d.ts.map +1 -0
- package/dist/fonts/types.d.ts +47 -1
- package/dist/fonts/types.d.ts.map +1 -1
- package/dist/fonts/virtual-modules.d.ts +77 -0
- package/dist/fonts/virtual-modules.d.ts.map +1 -0
- package/dist/index.d.ts +35 -181
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8871 -14233
- package/dist/index.js.map +1 -1
- package/dist/params/codec-registry.d.ts +26 -0
- package/dist/params/codec-registry.d.ts.map +1 -0
- package/dist/params/define-schema.d.ts +81 -0
- package/dist/params/define-schema.d.ts.map +1 -0
- package/dist/params/index.d.ts +5 -0
- package/dist/params/index.d.ts.map +1 -0
- package/dist/params/index.js +34 -0
- package/dist/params/index.js.map +1 -0
- package/dist/params/resolve-schema.d.ts +34 -0
- package/dist/params/resolve-schema.d.ts.map +1 -0
- package/dist/plugin-context.d.ts +262 -0
- package/dist/plugin-context.d.ts.map +1 -0
- package/dist/plugins/build-manifest.d.ts +7 -3
- package/dist/plugins/build-manifest.d.ts.map +1 -1
- package/dist/plugins/build-report.d.ts +61 -11
- package/dist/plugins/build-report.d.ts.map +1 -1
- package/dist/plugins/cache.d.ts +64 -0
- package/dist/plugins/cache.d.ts.map +1 -0
- package/dist/plugins/callsite-ast.d.ts +117 -0
- package/dist/plugins/callsite-ast.d.ts.map +1 -0
- package/dist/plugins/callsite-jsx.d.ts +35 -0
- package/dist/plugins/callsite-jsx.d.ts.map +1 -0
- package/dist/plugins/chunks.d.ts +11 -4
- package/dist/plugins/chunks.d.ts.map +1 -1
- package/dist/plugins/client-chunks.d.ts +40 -0
- package/dist/plugins/client-chunks.d.ts.map +1 -0
- package/dist/plugins/client-dep-entries.d.ts +44 -0
- package/dist/plugins/client-dep-entries.d.ts.map +1 -0
- package/dist/plugins/cloudflare-wasm.d.ts +21 -0
- package/dist/plugins/cloudflare-wasm.d.ts.map +1 -0
- package/dist/plugins/content.d.ts +1 -1
- package/dist/plugins/content.d.ts.map +1 -1
- package/dist/plugins/dev-discovery.d.ts +123 -0
- package/dist/plugins/dev-discovery.d.ts.map +1 -0
- package/dist/plugins/dev-server.d.ts +24 -1
- package/dist/plugins/dev-server.d.ts.map +1 -1
- package/dist/plugins/entries.d.ts +34 -4
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/plugins/fonts.d.ts +35 -74
- package/dist/plugins/fonts.d.ts.map +1 -1
- package/dist/plugins/graph-endpoint.d.ts +112 -0
- package/dist/plugins/graph-endpoint.d.ts.map +1 -0
- package/dist/plugins/mdx.d.ts +18 -5
- package/dist/plugins/mdx.d.ts.map +1 -1
- package/dist/plugins/post-build.d.ts +110 -0
- package/dist/plugins/post-build.d.ts.map +1 -0
- package/dist/plugins/prebuilt-capture.d.ts +67 -0
- package/dist/plugins/prebuilt-capture.d.ts.map +1 -0
- package/dist/plugins/prebuilt-options-analysis.d.ts +40 -0
- package/dist/plugins/prebuilt-options-analysis.d.ts.map +1 -0
- package/dist/plugins/prebuilt.d.ts +98 -0
- package/dist/plugins/prebuilt.d.ts.map +1 -0
- package/dist/plugins/prerender-sugar.d.ts +39 -0
- package/dist/plugins/prerender-sugar.d.ts.map +1 -0
- package/dist/plugins/react-resolve.d.ts +49 -0
- package/dist/plugins/react-resolve.d.ts.map +1 -0
- 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 +1 -1
- package/dist/plugins/routing.d.ts.map +1 -1
- package/dist/plugins/rsc-assets-manifest.d.ts +33 -0
- package/dist/plugins/rsc-assets-manifest.d.ts.map +1 -0
- package/dist/plugins/server-bundle.d.ts.map +1 -1
- package/dist/plugins/shims.d.ts +29 -5
- package/dist/plugins/shims.d.ts.map +1 -1
- package/dist/plugins/static-build.d.ts +246 -26
- package/dist/plugins/static-build.d.ts.map +1 -1
- package/dist/routing/codegen-shared.d.ts +26 -0
- package/dist/routing/codegen-shared.d.ts.map +1 -0
- package/dist/routing/codegen-types.d.ts +61 -0
- package/dist/routing/codegen-types.d.ts.map +1 -0
- package/dist/routing/codegen-write.d.ts +42 -0
- package/dist/routing/codegen-write.d.ts.map +1 -0
- package/dist/routing/codegen.d.ts +8 -3
- 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 +55 -0
- package/dist/routing/convention-lint.d.ts.map +1 -0
- package/dist/routing/export-detect.d.ts +91 -0
- package/dist/routing/export-detect.d.ts.map +1 -0
- package/dist/routing/file-cache.d.ts +8 -0
- package/dist/routing/file-cache.d.ts.map +1 -0
- package/dist/routing/index.d.ts +13 -7
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +5 -2
- package/dist/routing/interception-overlap.d.ts +35 -0
- package/dist/routing/interception-overlap.d.ts.map +1 -0
- package/dist/routing/interception.d.ts +234 -10
- package/dist/routing/interception.d.ts.map +1 -1
- package/dist/routing/link-codegen.d.ts +105 -0
- package/dist/routing/link-codegen.d.ts.map +1 -0
- package/dist/routing/manifest-codegen.d.ts +26 -0
- package/dist/routing/manifest-codegen.d.ts.map +1 -0
- package/dist/routing/scanner.d.ts +14 -10
- package/dist/routing/scanner.d.ts.map +1 -1
- package/dist/routing/schema-validation.d.ts +35 -0
- package/dist/routing/schema-validation.d.ts.map +1 -0
- package/dist/routing/segment-classify.d.ts +114 -0
- package/dist/routing/segment-classify.d.ts.map +1 -0
- package/dist/routing/segment-codegen.d.ts +38 -0
- package/dist/routing/segment-codegen.d.ts.map +1 -0
- package/dist/routing/segment-keys.d.ts +118 -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 +81 -26
- package/dist/routing/types.d.ts.map +1 -1
- package/dist/routing/walkers.d.ts +57 -0
- package/dist/routing/walkers.d.ts.map +1 -0
- package/dist/rsc-runtime/rsc.d.ts +1 -1
- package/dist/rsc-runtime/rsc.d.ts.map +1 -1
- package/dist/rsc-runtime/ssr.d.ts +14 -0
- package/dist/rsc-runtime/ssr.d.ts.map +1 -1
- package/dist/rsc-runtime/transforms.d.ts +13 -0
- package/dist/rsc-runtime/transforms.d.ts.map +1 -0
- package/dist/schema-bridge.d.ts +145 -0
- package/dist/schema-bridge.d.ts.map +1 -0
- package/dist/search-params/define.d.ts +262 -0
- package/dist/search-params/define.d.ts.map +1 -0
- package/dist/search-params/index.d.ts +3 -7
- package/dist/search-params/index.d.ts.map +1 -1
- package/dist/search-params/index.js +179 -360
- package/dist/search-params/index.js.map +1 -1
- package/dist/search-params/parse-total.d.ts +81 -0
- package/dist/search-params/parse-total.d.ts.map +1 -0
- package/dist/search-params/serialize-equal.d.ts +9 -0
- package/dist/search-params/serialize-equal.d.ts.map +1 -0
- package/dist/search-params/wrappers.d.ts +76 -0
- package/dist/search-params/wrappers.d.ts.map +1 -0
- package/dist/server/access-gate.d.ts +98 -10
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/action-client.d.ts +44 -9
- package/dist/server/action-client.d.ts.map +1 -1
- package/dist/server/action-encryption.d.ts +76 -0
- package/dist/server/action-encryption.d.ts.map +1 -0
- package/dist/server/action-handler.d.ts +40 -5
- package/dist/server/action-handler.d.ts.map +1 -1
- package/dist/server/actions.d.ts +78 -40
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +166 -16
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/body-limits.d.ts.map +1 -1
- package/dist/server/build-manifest.d.ts +25 -30
- package/dist/server/build-manifest.d.ts.map +1 -1
- package/dist/server/canonicalize.d.ts +10 -0
- package/dist/server/canonicalize.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/coalesce-tick.d.ts +40 -0
- package/dist/server/coalesce-tick.d.ts.map +1 -0
- package/dist/server/compress.d.ts.map +1 -1
- package/dist/server/cookie-context.d.ts +149 -0
- package/dist/server/cookie-context.d.ts.map +1 -0
- package/dist/server/cookie-parsing.d.ts +65 -0
- package/dist/server/cookie-parsing.d.ts.map +1 -0
- package/dist/server/csp-nonce.d.ts +36 -0
- package/dist/server/csp-nonce.d.ts.map +1 -0
- package/dist/server/csrf.d.ts +58 -15
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/debug.d.ts +0 -1
- package/dist/server/debug.d.ts.map +1 -1
- package/dist/server/default-logger.d.ts +23 -0
- package/dist/server/default-logger.d.ts.map +1 -0
- 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 +257 -0
- package/dist/server/deny-boundary.d.ts.map +1 -0
- package/dist/server/deny-renderer.d.ts +21 -15
- package/dist/server/deny-renderer.d.ts.map +1 -1
- package/dist/server/early-hints-sender.d.ts.map +1 -1
- package/dist/server/early-hints.d.ts +14 -12
- package/dist/server/early-hints.d.ts.map +1 -1
- package/dist/server/error-boundary-wrapper.d.ts +102 -10
- package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
- package/dist/server/error-response-headers.d.ts +3 -0
- package/dist/server/error-response-headers.d.ts.map +1 -0
- package/dist/server/fallback-error.d.ts +19 -7
- package/dist/server/fallback-error.d.ts.map +1 -1
- package/dist/server/flight-injection-state.d.ts +66 -0
- package/dist/server/flight-injection-state.d.ts.map +1 -0
- package/dist/server/flight-scripts.d.ts +45 -0
- package/dist/server/flight-scripts.d.ts.map +1 -0
- package/dist/server/form-data.d.ts +41 -0
- package/dist/server/form-data.d.ts.map +1 -1
- package/dist/server/form-flash.d.ts +2 -2
- package/dist/server/head-response.d.ts +35 -0
- package/dist/server/head-response.d.ts.map +1 -0
- package/dist/server/html-injector-core.d.ts +257 -0
- package/dist/server/html-injector-core.d.ts.map +1 -0
- package/dist/server/html-injectors.d.ts +84 -42
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/index.d.ts +17 -54
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +195 -2922
- package/dist/server/index.js.map +1 -1
- package/dist/server/instrumentation.d.ts +11 -4
- package/dist/server/instrumentation.d.ts.map +1 -1
- package/dist/server/internal.d.ts +47 -0
- package/dist/server/internal.d.ts.map +1 -0
- package/dist/server/internal.js +4645 -0
- package/dist/server/internal.js.map +1 -0
- package/dist/server/json-status-response.d.ts +34 -0
- package/dist/server/json-status-response.d.ts.map +1 -0
- package/dist/server/logger.d.ts +78 -7
- package/dist/server/logger.d.ts.map +1 -1
- package/dist/server/metadata-collector.d.ts +73 -0
- package/dist/server/metadata-collector.d.ts.map +1 -0
- package/dist/server/metadata-platform.d.ts +2 -2
- package/dist/server/metadata-render.d.ts +2 -2
- package/dist/server/metadata-render.d.ts.map +1 -1
- package/dist/server/metadata-routes.d.ts +71 -11
- package/dist/server/metadata-routes.d.ts.map +1 -1
- package/dist/server/metadata-social.d.ts +2 -2
- package/dist/server/metadata.d.ts +10 -2
- package/dist/server/metadata.d.ts.map +1 -1
- package/dist/server/middleware-runner.d.ts +20 -5
- package/dist/server/middleware-runner.d.ts.map +1 -1
- package/dist/server/node-stream-transforms.d.ts +105 -0
- package/dist/server/node-stream-transforms.d.ts.map +1 -0
- package/dist/server/nuqs-ssr-provider.d.ts +7 -3
- package/dist/server/nuqs-ssr-provider.d.ts.map +1 -1
- package/dist/server/param-coercion.d.ts +83 -0
- package/dist/server/param-coercion.d.ts.map +1 -0
- package/dist/server/pipeline-helpers.d.ts +193 -0
- package/dist/server/pipeline-helpers.d.ts.map +1 -0
- package/dist/server/pipeline-interception.d.ts +70 -9
- package/dist/server/pipeline-interception.d.ts.map +1 -1
- package/dist/server/pipeline-metadata.d.ts +7 -1
- package/dist/server/pipeline-metadata.d.ts.map +1 -1
- package/dist/server/pipeline-outcome.d.ts +59 -0
- package/dist/server/pipeline-outcome.d.ts.map +1 -0
- package/dist/server/pipeline-phases.d.ts +70 -0
- package/dist/server/pipeline-phases.d.ts.map +1 -0
- package/dist/server/pipeline.d.ts +147 -23
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/port-resolution.d.ts +31 -0
- package/dist/server/port-resolution.d.ts.map +1 -0
- package/dist/server/prebuilt/cache-key.d.ts +63 -0
- package/dist/server/prebuilt/cache-key.d.ts.map +1 -0
- package/dist/server/prebuilt/capture-render.d.ts +25 -0
- package/dist/server/prebuilt/capture-render.d.ts.map +1 -0
- package/dist/server/prebuilt/capture-routes.d.ts +37 -0
- package/dist/server/prebuilt/capture-routes.d.ts.map +1 -0
- package/dist/server/prebuilt/capture-state.d.ts +101 -0
- package/dist/server/prebuilt/capture-state.d.ts.map +1 -0
- package/dist/server/prebuilt/key-discipline.d.ts +52 -0
- package/dist/server/prebuilt/key-discipline.d.ts.map +1 -0
- package/dist/server/prebuilt/lifetime.d.ts +38 -0
- package/dist/server/prebuilt/lifetime.d.ts.map +1 -0
- package/dist/server/prebuilt/manifest-tag-index.d.ts +27 -0
- package/dist/server/prebuilt/manifest-tag-index.d.ts.map +1 -0
- package/dist/server/prebuilt/overlay.d.ts +100 -0
- package/dist/server/prebuilt/overlay.d.ts.map +1 -0
- package/dist/server/prebuilt/payload-source.d.ts +79 -0
- package/dist/server/prebuilt/payload-source.d.ts.map +1 -0
- package/dist/server/prebuilt/slots.d.ts +106 -0
- package/dist/server/prebuilt/slots.d.ts.map +1 -0
- package/dist/server/prebuilt/synthetic-store.d.ts +67 -0
- package/dist/server/prebuilt/synthetic-store.d.ts.map +1 -0
- package/dist/server/prebuilt-builder.d.ts +121 -0
- package/dist/server/prebuilt-builder.d.ts.map +1 -0
- package/dist/server/prebuilt-runtime.d.ts +111 -0
- package/dist/server/prebuilt-runtime.d.ts.map +1 -0
- package/dist/server/primitives.d.ts +101 -90
- 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/react-cache-bridge.d.ts +59 -0
- package/dist/server/react-cache-bridge.d.ts.map +1 -0
- package/dist/server/react-cache-scope.d.ts +49 -0
- package/dist/server/react-cache-scope.d.ts.map +1 -0
- package/dist/server/render-timeout.d.ts +66 -0
- package/dist/server/render-timeout.d.ts.map +1 -0
- package/dist/server/render-utils.d.ts +35 -0
- package/dist/server/render-utils.d.ts.map +1 -0
- package/dist/server/request-context.d.ts +128 -103
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-dep.d.ts +15 -0
- package/dist/server/request-dep.d.ts.map +1 -0
- package/dist/server/response-cache-policy.d.ts +3 -0
- package/dist/server/response-cache-policy.d.ts.map +1 -0
- package/dist/server/route-element-builder.d.ts +57 -30
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/route-element-helpers.d.ts +12 -0
- package/dist/server/route-element-helpers.d.ts.map +1 -0
- package/dist/server/route-handler.d.ts +1 -1
- package/dist/server/route-handler.d.ts.map +1 -1
- package/dist/server/route-matcher.d.ts +55 -38
- package/dist/server/route-matcher.d.ts.map +1 -1
- package/dist/server/route-module-loader.d.ts +37 -0
- package/dist/server/route-module-loader.d.ts.map +1 -0
- 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/action-dispatcher.d.ts +67 -0
- package/dist/server/rsc-entry/action-dispatcher.d.ts.map +1 -0
- package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
- package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
- package/dist/server/rsc-entry/api-handler.d.ts +19 -3
- package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
- package/dist/server/rsc-entry/deny-fallback.d.ts +55 -0
- package/dist/server/rsc-entry/deny-fallback.d.ts.map +1 -0
- package/dist/server/rsc-entry/error-renderer.d.ts +35 -21
- package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/helpers.d.ts +14 -59
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts +30 -6
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts +50 -0
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
- package/dist/server/rsc-entry/render-signals.d.ts +65 -0
- package/dist/server/rsc-entry/render-signals.d.ts.map +1 -0
- package/dist/server/rsc-entry/revalidate-renderer.d.ts +98 -0
- package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -0
- package/dist/server/rsc-entry/rsc-payload.d.ts +30 -6
- package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts +12 -30
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts +6 -2
- package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +44 -7
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/rsc-error-envelope.d.ts +11 -0
- package/dist/server/rsc-error-envelope.d.ts.map +1 -0
- package/dist/server/safe-load.d.ts +39 -0
- package/dist/server/safe-load.d.ts.map +1 -0
- package/dist/server/sensitive-fields.d.ts +74 -0
- package/dist/server/sensitive-fields.d.ts.map +1 -0
- package/dist/server/signal-identity.d.ts +43 -0
- package/dist/server/signal-identity.d.ts.map +1 -0
- package/dist/server/sitemap-generator.d.ts +130 -0
- package/dist/server/sitemap-generator.d.ts.map +1 -0
- package/dist/server/sitemap-handler.d.ts +22 -0
- package/dist/server/sitemap-handler.d.ts.map +1 -0
- package/dist/server/skippable-prefix.d.ts +29 -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 +138 -7
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/slot-subtree-contain.d.ts +54 -0
- package/dist/server/slot-subtree-contain.d.ts.map +1 -0
- package/dist/server/ssr-bridge-types.d.ts +198 -0
- package/dist/server/ssr-bridge-types.d.ts.map +1 -0
- package/dist/server/ssr-entry.d.ts +8 -47
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-render.d.ts +60 -27
- package/dist/server/ssr-render.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts +93 -0
- package/dist/server/ssr-wrappers.d.ts.map +1 -0
- package/dist/server/state-tree-diff.d.ts +44 -9
- package/dist/server/state-tree-diff.d.ts.map +1 -1
- package/dist/server/static-generator.d.ts +112 -0
- package/dist/server/static-generator.d.ts.map +1 -0
- 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 +26 -15
- package/dist/server/status-code-resolver.d.ts.map +1 -1
- package/dist/server/stream-utils.d.ts +59 -0
- package/dist/server/stream-utils.d.ts.map +1 -0
- package/dist/server/tracing.d.ts +57 -26
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/server/tree-match.d.ts +59 -0
- package/dist/server/tree-match.d.ts.map +1 -0
- package/dist/server/types.d.ts +89 -8
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/utils/element-type.d.ts +50 -0
- package/dist/server/utils/element-type.d.ts.map +1 -0
- package/dist/server/utils/escape-html.d.ts +14 -0
- package/dist/server/utils/escape-html.d.ts.map +1 -0
- package/dist/server/version-skew.d.ts +61 -0
- package/dist/server/version-skew.d.ts.map +1 -0
- package/dist/server/workers-cache-bridge.d.ts +26 -0
- package/dist/server/workers-cache-bridge.d.ts.map +1 -0
- package/dist/shared/als-slots.d.ts +42 -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/csrf-reject.d.ts +16 -0
- package/dist/shared/csrf-reject.d.ts.map +1 -0
- package/dist/shared/error-digest.d.ts +28 -0
- package/dist/shared/error-digest.d.ts.map +1 -0
- package/dist/shared/href-validation.d.ts +49 -0
- package/dist/shared/href-validation.d.ts.map +1 -0
- package/dist/shared/merge-search-params.d.ts +22 -0
- package/dist/shared/merge-search-params.d.ts.map +1 -0
- package/dist/shared/param-value.d.ts +104 -0
- package/dist/shared/param-value.d.ts.map +1 -0
- package/dist/shared/payload-root.d.ts +110 -0
- package/dist/shared/payload-root.d.ts.map +1 -0
- package/dist/shared/redirect-type.d.ts +17 -0
- package/dist/shared/redirect-type.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 +16 -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 +52 -0
- package/dist/shared/rsc-media-type.d.ts.map +1 -0
- package/dist/shared/rsc-payload-path.d.ts +48 -0
- package/dist/shared/rsc-payload-path.d.ts.map +1 -0
- package/dist/shared/segment-info.d.ts +66 -0
- package/dist/shared/segment-info.d.ts.map +1 -0
- package/dist/shared/slot-params.d.ts +52 -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/dist/shared/status-reason-phrase.d.ts +26 -0
- package/dist/shared/status-reason-phrase.d.ts.map +1 -0
- package/dist/shims/font-google.d.ts +1 -1
- package/dist/shims/font-google.d.ts.map +1 -1
- package/dist/shims/font-google.js +42 -0
- package/dist/shims/font-google.js.map +1 -0
- package/dist/shims/font-local.d.ts +26 -0
- package/dist/shims/font-local.d.ts.map +1 -0
- package/dist/shims/font-local.js +20 -0
- package/dist/shims/font-local.js.map +1 -0
- package/dist/shims/headers.d.ts +53 -1
- package/dist/shims/headers.d.ts.map +1 -1
- package/dist/shims/image.d.ts +120 -120
- package/dist/shims/image.d.ts.map +1 -1
- package/dist/shims/navigation-client.d.ts +25 -12
- package/dist/shims/navigation-client.d.ts.map +1 -1
- package/dist/shims/navigation-rsc.d.ts +21 -0
- package/dist/shims/navigation-rsc.d.ts.map +1 -0
- package/dist/shims/navigation.d.ts +10 -5
- package/dist/shims/navigation.d.ts.map +1 -1
- package/dist/utils/state-machine.d.ts +80 -0
- package/dist/utils/state-machine.d.ts.map +1 -0
- package/dist/utils/write-file-atomic.d.ts +17 -0
- package/dist/utils/write-file-atomic.d.ts.map +1 -0
- package/docs/api/30-api-server.mdx +239 -0
- package/docs/api/31-api-client.mdx +170 -0
- package/docs/api/32-api-cache.mdx +339 -0
- package/docs/api/33-api-search-params.mdx +176 -0
- package/docs/api/34-api-config.mdx +359 -0
- package/docs/api/35-api-typescript.mdx +91 -0
- package/docs/api/36-cli.mdx +202 -0
- package/docs/learn/00-introduction.mdx +109 -0
- package/docs/learn/01-quick-start.mdx +94 -0
- package/docs/learn/02-pages-and-layouts.mdx +147 -0
- package/docs/learn/03-fetching-data.mdx +227 -0
- package/docs/learn/04-access-control.mdx +115 -0
- package/docs/learn/05-the-flush-point.mdx +175 -0
- package/docs/learn/06-typed-params.mdx +275 -0
- package/docs/learn/07-typed-routes.mdx +108 -0
- package/docs/learn/08-forms-and-actions.mdx +146 -0
- package/docs/learn/09-streaming.mdx +140 -0
- package/docs/learn/10-caching.mdx +270 -0
- package/docs/learn/11-middleware.mdx +164 -0
- package/docs/learn/12-error-handling.mdx +192 -0
- package/docs/learn/13-deploying.mdx +287 -0
- package/llms.txt +55 -0
- package/package.json +120 -29
- package/src/adapters/build-output-helper.ts +353 -0
- package/src/adapters/canonicalize-module.ts +29 -0
- package/src/adapters/cloudflare-dev.ts +183 -0
- package/src/adapters/cloudflare-kv-cache.ts +207 -0
- package/src/adapters/cloudflare.ts +809 -150
- package/src/adapters/compress-module.ts +110 -86
- package/src/adapters/fs-identity.ts +155 -0
- package/src/adapters/nitro-presets.ts +124 -0
- package/src/adapters/nitro-preview.ts +476 -0
- package/src/adapters/nitro.ts +317 -457
- package/src/adapters/raw-imports.d.ts +5 -0
- package/src/adapters/shared.ts +283 -0
- package/src/adapters/types.ts +127 -17
- package/src/adapters/wrangler.d.ts +7 -0
- package/src/analyze/chains.ts +411 -0
- package/src/analyze/classify.ts +259 -0
- package/src/analyze/crawl-entry.ts +68 -0
- package/src/analyze/crawl.ts +500 -0
- package/src/analyze/graph-cache.ts +331 -0
- package/src/analyze/graph-command.ts +762 -0
- package/src/analyze/live-graph.ts +232 -0
- package/src/analyze/poison-rules.ts +165 -0
- package/src/analyze/poison-scan.ts +159 -0
- package/src/analyze/scan.ts +149 -0
- package/src/cache/cache-api.ts +107 -0
- package/src/cache/fast-hash.ts +5 -0
- package/src/cache/handler-store.ts +76 -0
- package/src/cache/index.ts +115 -22
- package/src/cache/invalidation-epoch.ts +93 -0
- package/src/cache/json-lossy-check.ts +69 -0
- package/src/cache/redis-handler.ts +198 -20
- package/src/cache/singleflight.ts +72 -6
- package/src/cache/sizeof.ts +35 -0
- package/src/cache/stable-stringify.ts +65 -2
- package/src/cache/store.ts +71 -0
- package/src/cache/stores/cloudflare-kv.ts +52 -0
- package/src/cache/stores/memory.ts +125 -0
- package/src/cache/stores/redis.ts +97 -0
- package/src/cache/stores/vercel.ts +59 -0
- package/src/cache/tag-aware-handler.ts +254 -0
- package/src/cache/timber-cache.ts +165 -40
- package/src/cdn/cloudflare-purge.ts +50 -0
- package/src/cdn/fastly-purge.ts +63 -0
- package/src/cdn/headers.ts +153 -0
- package/src/cdn/index.ts +23 -0
- package/src/cdn/purge-store.ts +34 -0
- package/src/cdn/workers-cache-purge.ts +34 -0
- package/src/cli-check.ts +417 -0
- package/src/cli-context.ts +119 -0
- package/src/cli-schema-sync.ts +401 -0
- package/src/cli.ts +330 -78
- package/src/client/browser-dev.ts +192 -5
- package/src/client/browser-entry/action-dispatch.ts +237 -0
- package/src/client/browser-entry/action-queue.ts +152 -0
- package/src/client/browser-entry/hmr.ts +70 -0
- package/src/client/browser-entry/hydrate.ts +143 -0
- package/src/client/browser-entry/index.ts +120 -0
- package/src/client/browser-entry/post-hydration.ts +99 -0
- package/src/client/browser-entry/router-init.ts +406 -0
- package/src/client/browser-entry/rsc-stream.ts +145 -0
- package/src/client/browser-entry/scroll.ts +50 -0
- package/src/client/deny-last-resort.tsx +54 -0
- package/src/client/error-boundary.tsx +279 -61
- package/src/client/error-reconstituter.tsx +84 -0
- package/src/client/form.tsx +36 -32
- package/src/client/global-context.ts +31 -0
- package/src/client/history.ts +74 -11
- package/src/client/index.ts +89 -53
- package/src/client/internal.ts +54 -0
- package/src/client/link.tsx +468 -151
- package/src/client/location-search.ts +15 -0
- package/src/client/navigation-api.ts +380 -0
- package/src/client/navigation-commit.ts +318 -0
- package/src/client/navigation-context.ts +67 -134
- package/src/client/navigation-root.tsx +236 -0
- package/src/client/navigation-transition.ts +337 -0
- package/src/client/nuqs-adapter.tsx +21 -9
- package/src/client/params-context.ts +187 -0
- package/src/client/react-root.ts +82 -0
- package/src/client/router-effects.ts +235 -0
- package/src/client/router-lifecycle.ts +354 -0
- package/src/client/router-pipeline.ts +458 -0
- package/src/client/router-ref.ts +3 -3
- package/src/client/router-skew.ts +30 -0
- package/src/client/router-types.ts +370 -0
- package/src/client/router-url.ts +32 -0
- package/src/client/router.ts +491 -424
- package/src/client/rsc-fetch.ts +510 -109
- package/src/client/segment-cache.ts +362 -41
- package/src/client/segment-context.ts +7 -4
- package/src/client/segment-outlet.tsx +96 -0
- package/src/client/segment-update-context.ts +23 -0
- package/src/client/shallow-url.ts +22 -0
- package/src/client/slot-content-cache-context.ts +43 -0
- package/src/client/slot-context.ts +50 -0
- package/src/client/slot-outlet.tsx +22 -0
- package/src/client/slot-provider.tsx +32 -0
- package/src/client/ssr-data.ts +27 -67
- package/src/client/stale-client.ts +191 -0
- package/src/client/state.ts +31 -24
- package/src/client/status-page-marker.tsx +32 -0
- package/src/client/top-loader.tsx +13 -10
- package/src/client/unload-guard.ts +35 -3
- package/src/client/use-cookie.ts +70 -18
- package/src/client/use-link-status.ts +7 -7
- package/src/client/use-pathname.ts +22 -31
- package/src/client/use-pending-navigation.ts +40 -0
- package/src/client/use-query-states.ts +206 -36
- package/src/client/use-router.ts +31 -9
- package/src/client/use-search-params.ts +38 -49
- package/src/client/use-segment-params.ts +69 -0
- package/src/client/use-selected-layout-segment.ts +2 -2
- package/src/codec.ts +149 -0
- package/src/config-types.ts +323 -0
- package/src/config-validation.ts +464 -0
- package/src/cookies/define-cookie.ts +222 -53
- package/src/cookies/index.ts +13 -2
- package/src/cookies/json-cookie.ts +105 -0
- package/src/cookies/validation.ts +192 -0
- package/src/dev-tools/404-page.ts +286 -0
- package/src/dev-tools/browser-logs.ts +55 -0
- package/src/dev-tools/dev-page-shell.ts +278 -0
- package/src/dev-tools/error-page.ts +331 -0
- package/src/dev-tools/holding-server.ts +185 -0
- package/src/dev-tools/hydration-overlay.ts +158 -0
- package/src/dev-tools/index.ts +79 -0
- package/src/dev-tools/instrumentation.ts +261 -0
- package/src/{server/dev-logger.ts → dev-tools/logger.ts} +33 -51
- package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +122 -26
- package/src/{plugins/dev-error-overlay.ts → dev-tools/overlay.ts} +25 -80
- package/src/dev-tools/stack-classifier.ts +75 -0
- package/src/dev-tools/terminal.ts +182 -0
- package/src/fonts/ast-walk.ts +235 -0
- package/src/fonts/ast.ts +479 -128
- package/src/fonts/bundle.ts +138 -0
- package/src/fonts/css.ts +1 -1
- package/src/fonts/dev-middleware.ts +85 -0
- package/src/fonts/fallbacks.ts +0 -23
- package/src/fonts/google.ts +101 -19
- package/src/fonts/local.ts +12 -11
- package/src/fonts/paths.ts +58 -0
- package/src/fonts/pipeline.ts +348 -0
- package/src/fonts/transform.ts +311 -0
- package/src/fonts/types.ts +52 -1
- package/src/fonts/virtual-modules.ts +179 -0
- package/src/index.ts +513 -380
- package/src/params/codec-registry.ts +34 -0
- package/src/params/define-schema.ts +115 -0
- package/src/params/index.ts +17 -0
- package/src/params/resolve-schema.ts +84 -0
- package/src/plugin-context.ts +502 -0
- package/src/plugins/build-manifest.ts +204 -36
- package/src/plugins/build-report.ts +299 -87
- package/src/plugins/cache.ts +243 -0
- package/src/plugins/callsite-ast.ts +472 -0
- package/src/plugins/callsite-jsx.ts +243 -0
- package/src/plugins/chunks.ts +74 -5
- package/src/plugins/client-chunks.ts +185 -0
- package/src/plugins/client-dep-entries.ts +78 -0
- package/src/plugins/cloudflare-wasm.ts +141 -0
- package/src/plugins/content.ts +31 -2
- package/src/plugins/dev-discovery.ts +218 -0
- package/src/plugins/dev-server.ts +360 -97
- package/src/plugins/entries.ts +149 -16
- package/src/plugins/fonts.ts +260 -657
- package/src/plugins/graph-endpoint.ts +532 -0
- package/src/plugins/mdx.ts +108 -35
- package/src/plugins/post-build.ts +327 -0
- package/src/plugins/prebuilt-capture.ts +213 -0
- package/src/plugins/prebuilt-options-analysis.ts +175 -0
- package/src/plugins/prebuilt.ts +670 -0
- package/src/plugins/prerender-sugar.ts +316 -0
- package/src/plugins/react-resolve.ts +149 -0
- 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 +273 -277
- package/src/plugins/rsc-assets-manifest.ts +251 -0
- package/src/plugins/server-bundle.ts +99 -14
- package/src/plugins/shims.ts +260 -97
- package/src/plugins/static-build.ts +681 -71
- package/src/react-canary.d.ts +2 -0
- package/src/routing/codegen-shared.ts +39 -0
- package/src/routing/codegen-types.ts +62 -0
- package/src/routing/codegen-write.ts +163 -0
- package/src/routing/codegen.ts +349 -232
- package/src/routing/collision-probe.ts +438 -0
- package/src/routing/collision-spaces.ts +281 -0
- package/src/routing/convention-lint.ts +651 -0
- package/src/routing/export-detect.ts +536 -0
- package/src/routing/file-cache.ts +23 -0
- package/src/routing/index.ts +16 -7
- package/src/routing/interception-overlap.ts +141 -0
- package/src/routing/interception.ts +1044 -67
- package/src/routing/link-codegen.ts +280 -0
- package/src/routing/manifest-codegen.ts +232 -0
- package/src/routing/scanner.ts +417 -223
- package/src/routing/schema-validation.ts +155 -0
- package/src/routing/segment-classify.ts +280 -0
- package/src/routing/segment-codegen.ts +99 -0
- package/src/routing/segment-keys.ts +186 -0
- package/src/routing/slot-placement.ts +97 -0
- package/src/routing/types.ts +82 -26
- package/src/routing/walkers.ts +98 -0
- package/src/rsc-runtime/rsc.ts +9 -0
- package/src/rsc-runtime/ssr.ts +51 -0
- package/src/rsc-runtime/transforms.ts +13 -0
- package/src/rsc-runtime/vendor-types.d.ts +27 -0
- package/src/schema-bridge.ts +382 -0
- package/src/search-params/define.ts +677 -0
- package/src/search-params/index.ts +14 -20
- package/src/search-params/parse-total.ts +91 -0
- package/src/search-params/serialize-equal.ts +14 -0
- package/src/search-params/wrappers.ts +150 -0
- package/src/server/access-gate.tsx +195 -56
- package/src/server/action-client.ts +126 -33
- package/src/server/action-encryption.ts +144 -0
- package/src/server/action-handler.ts +457 -111
- package/src/server/actions.ts +172 -85
- package/src/server/als-registry.ts +224 -25
- package/src/server/body-limits.ts +10 -2
- package/src/server/build-manifest.ts +33 -57
- package/src/server/canonicalize.ts +6 -3
- package/src/server/chain-url-parts.ts +163 -0
- package/src/server/children-interception.ts +116 -0
- package/src/server/coalesce-tick.ts +75 -0
- package/src/server/compress.ts +43 -8
- package/src/server/cookie-context.ts +454 -0
- package/src/server/cookie-parsing.ts +163 -0
- package/src/server/csp-nonce.ts +58 -0
- package/src/server/csrf.ts +228 -35
- package/src/server/debug.ts +0 -1
- package/src/server/default-logger.ts +100 -0
- package/src/server/default-status-page.ts +88 -0
- package/src/server/deny-boundary.ts +527 -0
- package/src/server/deny-renderer.ts +201 -179
- package/src/server/early-hints-sender.ts +4 -3
- package/src/server/early-hints.ts +39 -29
- package/src/server/error-boundary-wrapper.ts +160 -44
- package/src/server/error-response-headers.ts +18 -0
- package/src/server/fallback-error.ts +88 -104
- package/src/server/flight-injection-state.ts +113 -0
- package/src/server/flight-scripts.ts +67 -0
- package/src/server/form-data.ts +124 -12
- package/src/server/form-flash.ts +3 -3
- package/src/server/head-response.ts +54 -0
- package/src/server/html-injector-core.ts +512 -0
- package/src/server/html-injectors.ts +270 -255
- package/src/server/index.ts +36 -192
- package/src/server/instrumentation.ts +11 -4
- package/src/server/internal.ts +168 -0
- package/src/server/json-status-response.ts +105 -0
- package/src/server/logger.ts +126 -38
- package/src/server/metadata-collector.ts +177 -0
- package/src/server/metadata-platform.ts +2 -2
- package/src/server/metadata-render.ts +30 -8
- package/src/server/metadata-routes.ts +220 -24
- package/src/server/metadata-social.ts +2 -2
- package/src/server/metadata.ts +23 -2
- package/src/server/middleware-runner.ts +32 -5
- package/src/server/node-stream-transforms.ts +323 -0
- package/src/server/nuqs-ssr-provider.tsx +8 -7
- package/src/server/param-coercion.ts +201 -0
- package/src/server/pipeline-helpers.ts +485 -0
- package/src/server/pipeline-interception.ts +241 -32
- package/src/server/pipeline-metadata.ts +15 -1
- package/src/server/pipeline-outcome.ts +290 -0
- package/src/server/pipeline-phases.ts +496 -0
- package/src/server/pipeline.ts +385 -427
- package/src/server/port-resolution.ts +53 -0
- package/src/server/prebuilt/cache-key.ts +299 -0
- package/src/server/prebuilt/capture-render.ts +118 -0
- package/src/server/prebuilt/capture-routes.ts +104 -0
- package/src/server/prebuilt/capture-state.ts +196 -0
- package/src/server/prebuilt/key-discipline.ts +122 -0
- package/src/server/prebuilt/lifetime.ts +151 -0
- package/src/server/prebuilt/manifest-tag-index.ts +46 -0
- package/src/server/prebuilt/overlay.ts +256 -0
- package/src/server/prebuilt/payload-source.ts +202 -0
- package/src/server/prebuilt/slots.ts +202 -0
- package/src/server/prebuilt/synthetic-store.ts +125 -0
- package/src/server/prebuilt-builder.ts +514 -0
- package/src/server/prebuilt-runtime.ts +813 -0
- package/src/server/primitives.ts +153 -171
- package/src/server/publish-params.ts +42 -0
- package/src/server/react-cache-bridge.ts +124 -0
- package/src/server/react-cache-scope.ts +104 -0
- package/src/server/render-timeout.ts +128 -0
- package/src/server/render-utils.ts +45 -0
- package/src/server/request-context.ts +269 -332
- package/src/server/request-dep.ts +37 -0
- package/src/server/response-cache-policy.ts +45 -0
- package/src/server/route-element-builder.ts +514 -355
- package/src/server/route-element-helpers.ts +37 -0
- package/src/server/route-handler.ts +67 -27
- package/src/server/route-matcher.ts +238 -267
- package/src/server/route-module-loader.ts +161 -0
- package/src/server/rsc-cache-key-guard.ts +122 -0
- package/src/server/rsc-entry/action-dispatcher.ts +142 -0
- package/src/server/rsc-entry/action-middleware-runner.ts +130 -0
- package/src/server/rsc-entry/api-handler.ts +49 -81
- package/src/server/rsc-entry/deny-fallback.ts +151 -0
- package/src/server/rsc-entry/error-renderer.ts +301 -113
- package/src/server/rsc-entry/helpers.ts +90 -115
- package/src/server/rsc-entry/index.ts +370 -350
- package/src/server/rsc-entry/render-route.ts +229 -0
- package/src/server/rsc-entry/render-signals.ts +108 -0
- package/src/server/rsc-entry/revalidate-renderer.ts +349 -0
- package/src/server/rsc-entry/rsc-payload.ts +192 -72
- package/src/server/rsc-entry/rsc-stream.ts +128 -131
- package/src/server/rsc-entry/ssr-bridge.ts +19 -6
- package/src/server/rsc-entry/ssr-renderer.ts +300 -137
- package/src/server/rsc-error-envelope.ts +18 -0
- package/src/server/rsc-prop-warnings.ts +1 -1
- package/src/server/safe-load.ts +53 -0
- package/src/server/sensitive-fields.ts +230 -0
- package/src/server/server-only-guard-noop.js +3 -0
- package/src/server/server-timing.ts +1 -1
- package/src/server/signal-identity.ts +112 -0
- package/src/server/sitemap-generator.ts +337 -0
- package/src/server/sitemap-handler.ts +157 -0
- package/src/server/skippable-prefix.ts +172 -0
- package/src/server/slot-interception.ts +168 -0
- package/src/server/slot-resolver.ts +707 -300
- package/src/server/slot-subtree-contain.ts +273 -0
- package/src/server/ssr-bridge-types.ts +201 -0
- package/src/server/ssr-entry.ts +225 -104
- package/src/server/ssr-render.ts +354 -91
- package/src/server/ssr-wrappers.tsx +162 -0
- package/src/server/state-tree-diff.ts +85 -30
- package/src/server/static-generator.ts +680 -0
- package/src/server/static-not-found.ts +134 -0
- package/src/server/status-code-resolver.ts +107 -148
- package/src/server/stream-utils.ts +343 -0
- package/src/server/tracing.ts +163 -68
- package/src/server/tree-match.ts +494 -0
- package/src/server/types.ts +96 -11
- package/src/server/utils/element-type.ts +88 -0
- package/src/server/utils/escape-html.ts +20 -0
- package/src/server/version-skew.ts +104 -0
- package/src/server/waituntil-bridge.ts +1 -1
- package/src/server/workers-cache-bridge.ts +33 -0
- package/src/shared/als-slots.ts +74 -0
- package/src/shared/base-path.ts +80 -0
- package/src/shared/csrf-reject.ts +15 -0
- package/src/shared/error-digest.ts +46 -0
- package/src/shared/href-validation.ts +159 -0
- package/src/shared/merge-search-params.ts +55 -0
- package/src/shared/param-value.ts +281 -0
- package/src/shared/payload-root.ts +153 -0
- package/src/shared/redirect-type.ts +17 -0
- package/src/shared/rsc-cache-key.ts +269 -0
- package/src/shared/rsc-error-envelope.ts +16 -0
- package/src/shared/rsc-manifest.ts +29 -0
- package/src/shared/rsc-media-type.ts +59 -0
- package/src/shared/rsc-payload-path.ts +52 -0
- package/src/shared/segment-info.ts +67 -0
- package/src/shared/slot-params.ts +109 -0
- package/src/shared/static-platform-files.ts +75 -0
- package/src/shared/status-reason-phrase.ts +61 -0
- package/src/shims/font-google.ts +1 -1
- package/src/shims/font-local.ts +34 -0
- package/src/shims/headers.ts +122 -1
- package/src/shims/navigation-client.ts +36 -32
- package/src/shims/navigation-rsc.ts +47 -0
- package/src/shims/navigation.ts +10 -7
- package/src/utils/state-machine.ts +111 -0
- package/src/utils/write-file-atomic.ts +32 -0
- package/dist/_chunks/als-registry-B7DbZ2hS.js +0 -41
- package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
- package/dist/_chunks/debug-B3Gypr3D.js +0 -108
- package/dist/_chunks/debug-B3Gypr3D.js.map +0 -1
- package/dist/_chunks/format-RyoGQL74.js +0 -164
- package/dist/_chunks/format-RyoGQL74.js.map +0 -1
- package/dist/_chunks/interception-BOoWmLUA.js +0 -676
- package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
- package/dist/_chunks/metadata-routes-Cjmvi3rQ.js.map +0 -1
- package/dist/_chunks/request-context-BQUC8PHn.js +0 -330
- package/dist/_chunks/request-context-BQUC8PHn.js.map +0 -1
- package/dist/_chunks/ssr-data-MjmprTmO.js +0 -88
- package/dist/_chunks/ssr-data-MjmprTmO.js.map +0 -1
- package/dist/_chunks/tracing-CemImE6h.js +0 -187
- package/dist/_chunks/tracing-CemImE6h.js.map +0 -1
- package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
- package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
- package/dist/_chunks/use-query-states-D5KaffOK.js +0 -109
- package/dist/_chunks/use-query-states-D5KaffOK.js.map +0 -1
- package/dist/adapters/cloudflare.js.map +0 -1
- package/dist/cache/index.js.map +0 -1
- package/dist/cache/register-cached-function.d.ts +0 -17
- package/dist/cache/register-cached-function.d.ts.map +0 -1
- package/dist/client/browser-entry.d.ts +0 -21
- package/dist/client/browser-entry.d.ts.map +0 -1
- package/dist/client/error-boundary.js.map +0 -1
- package/dist/client/head.d.ts +0 -16
- package/dist/client/head.d.ts.map +0 -1
- package/dist/client/link-status-provider.d.ts +0 -11
- package/dist/client/link-status-provider.d.ts.map +0 -1
- package/dist/client/segment-merger.d.ts +0 -119
- package/dist/client/segment-merger.d.ts.map +0 -1
- package/dist/client/stale-reload.d.ts +0 -44
- package/dist/client/stale-reload.d.ts.map +0 -1
- package/dist/client/transition-root.d.ts +0 -74
- package/dist/client/transition-root.d.ts.map +0 -1
- package/dist/client/types.d.ts +0 -14
- package/dist/client/types.d.ts.map +0 -1
- package/dist/client/use-navigation-pending.d.ts +0 -26
- package/dist/client/use-navigation-pending.d.ts.map +0 -1
- package/dist/client/use-params.d.ts +0 -92
- package/dist/client/use-params.d.ts.map +0 -1
- package/dist/content/index.d.ts +0 -11
- package/dist/content/index.d.ts.map +0 -1
- package/dist/content/index.js +0 -2
- package/dist/plugins/adapter-build.d.ts +0 -18
- package/dist/plugins/adapter-build.d.ts.map +0 -1
- package/dist/plugins/cache-transform.d.ts +0 -36
- package/dist/plugins/cache-transform.d.ts.map +0 -1
- package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
- package/dist/plugins/dev-logs.d.ts.map +0 -1
- package/dist/plugins/dynamic-transform.d.ts +0 -72
- package/dist/plugins/dynamic-transform.d.ts.map +0 -1
- package/dist/plugins/server-action-exports.d.ts +0 -26
- package/dist/plugins/server-action-exports.d.ts.map +0 -1
- package/dist/routing/status-file-lint.d.ts +0 -33
- package/dist/routing/status-file-lint.d.ts.map +0 -1
- package/dist/search-params/analyze.d.ts +0 -54
- package/dist/search-params/analyze.d.ts.map +0 -1
- package/dist/search-params/builtin-codecs.d.ts +0 -105
- package/dist/search-params/builtin-codecs.d.ts.map +0 -1
- package/dist/search-params/codecs.d.ts +0 -53
- package/dist/search-params/codecs.d.ts.map +0 -1
- package/dist/search-params/create.d.ts +0 -106
- package/dist/search-params/create.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/server/asset-headers.d.ts +0 -42
- package/dist/server/asset-headers.d.ts.map +0 -1
- package/dist/server/client-module-map.d.ts +0 -47
- package/dist/server/client-module-map.d.ts.map +0 -1
- package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
- package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
- package/dist/server/dev-logger.d.ts.map +0 -1
- package/dist/server/dev-span-processor.d.ts +0 -29
- package/dist/server/dev-span-processor.d.ts.map +0 -1
- package/dist/server/dev-warnings.d.ts +0 -129
- package/dist/server/dev-warnings.d.ts.map +0 -1
- package/dist/server/flush.d.ts +0 -74
- package/dist/server/flush.d.ts.map +0 -1
- package/dist/server/manifest-status-resolver.d.ts +0 -58
- package/dist/server/manifest-status-resolver.d.ts.map +0 -1
- package/dist/server/prerender.d.ts +0 -77
- package/dist/server/prerender.d.ts.map +0 -1
- package/dist/server/tree-builder.d.ts +0 -126
- package/dist/server/tree-builder.d.ts.map +0 -1
- package/dist/utils/directive-parser.d.ts +0 -70
- package/dist/utils/directive-parser.d.ts.map +0 -1
- package/src/cache/register-cached-function.ts +0 -103
- package/src/client/browser-entry.ts +0 -678
- package/src/client/head.ts +0 -61
- package/src/client/link-status-provider.tsx +0 -30
- package/src/client/segment-merger.ts +0 -339
- package/src/client/stale-reload.ts +0 -87
- package/src/client/transition-root.tsx +0 -166
- package/src/client/types.ts +0 -21
- package/src/client/use-navigation-pending.ts +0 -38
- package/src/client/use-params.ts +0 -141
- package/src/content/index.ts +0 -13
- package/src/plugins/adapter-build.ts +0 -118
- package/src/plugins/cache-transform.ts +0 -199
- package/src/plugins/dynamic-transform.ts +0 -161
- package/src/plugins/server-action-exports.ts +0 -220
- package/src/routing/status-file-lint.ts +0 -112
- package/src/search-params/analyze.ts +0 -192
- package/src/search-params/builtin-codecs.ts +0 -228
- package/src/search-params/codecs.ts +0 -153
- package/src/search-params/create.ts +0 -321
- package/src/search-params/registry.ts +0 -31
- package/src/server/asset-headers.ts +0 -81
- package/src/server/client-module-map.ts +0 -58
- package/src/server/dev-fetch-instrumentation.ts +0 -96
- package/src/server/dev-span-processor.ts +0 -78
- package/src/server/dev-warnings.ts +0 -283
- package/src/server/flush.ts +0 -182
- package/src/server/manifest-status-resolver.ts +0 -215
- package/src/server/prerender.ts +0 -139
- package/src/server/tree-builder.ts +0 -382
- package/src/shims/server-only-noop.js +0 -6
- package/src/utils/directive-parser.ts +0 -529
|
@@ -0,0 +1,1199 @@
|
|
|
1
|
+
import { r as canonicalize } from "./canonicalize-CgHoscYO.js";
|
|
2
|
+
import { a as requestContextAls, i as reactCacheScopeAls, o as revalidationAls } from "./als-registry-DaxkVjt5.js";
|
|
3
|
+
import { C as isRedirectSignal, F as withSpan, S as isDenySignal, T as isDevMode, b as REDIRECT_BRAND, w as isDebug, y as DENY_BRAND } from "./logger-BP0LN6vP.js";
|
|
4
|
+
import { n as _setGetSegmentParamsFn, t as _setGetSearchParamsFn } from "./als-slots-BEEIPKYm.js";
|
|
5
|
+
import { r as appVisibleSearch } from "./rsc-cache-key-ClUiXQnK.js";
|
|
6
|
+
import { a as mergePreservedSearchParams, o as resolveSegmentParams, r as validateExternalRedirectUrl, t as assertRelativeRedirectPath } from "./href-validation-BIrxavIy.js";
|
|
7
|
+
import { a as assertValidCookieOptions, i as assertValidCookieName, n as parseSetCookie$1, o as assertValidCookieValue, r as stringifySetCookie, t as parseCookie } from "./dist-DtrJyBbw.js";
|
|
8
|
+
import { t as cache, x as getWaitUntil } from "./cache-api-DGdYfNJn.js";
|
|
9
|
+
//#region src/server/react-cache-scope.ts
|
|
10
|
+
/**
|
|
11
|
+
* React.cache scopes — opening, resuming, and leaving the per-request
|
|
12
|
+
* `React.cache` scope that `react-cache-bridge.ts` makes Flight read.
|
|
13
|
+
*
|
|
14
|
+
* Kept apart from the bridge so request-context and cookie code can use
|
|
15
|
+
* it without importing `react`. See design/spike-TIM-1529-react-cache-bridge.md.
|
|
16
|
+
*/
|
|
17
|
+
/** A new, empty `React.cache` scope. */
|
|
18
|
+
function createReactCacheScope() {
|
|
19
|
+
return /* @__PURE__ */ new Map();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Run `fn` in a `React.cache` scope — a fresh one unless `scope` is given.
|
|
23
|
+
* Every `React.cache` call made from `fn` — synchronously, in its async
|
|
24
|
+
* continuations, and in any Flight render it starts — shares one memo table.
|
|
25
|
+
*
|
|
26
|
+
* Opened by `runWithRequestContext`, so each request context gets its own
|
|
27
|
+
* scope. Pass `scope` to resume one across two ALS runs: the post-action
|
|
28
|
+
* revalidation opens a fresh scope for the target route's middleware and
|
|
29
|
+
* renders the revalidated tree in that same scope later.
|
|
30
|
+
*/
|
|
31
|
+
function runWithReactCacheScope(fn, scope = createReactCacheScope()) {
|
|
32
|
+
return reactCacheScopeAls.run(scope, fn);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Run `fn` with no timber scope, so `React.cache` behaves as stock React:
|
|
36
|
+
* no dedupe outside a render, Flight's own per-render cache inside one.
|
|
37
|
+
*
|
|
38
|
+
* Used for server action bodies — an action reads, writes cookies, and
|
|
39
|
+
* mutates, so memoized reads would go stale mid-action (the same choice
|
|
40
|
+
* Next.js makes) — and for renders whose output outlives the request
|
|
41
|
+
* (`cache.component` capture), which must not bake request-memoized values
|
|
42
|
+
* into a cross-request cache entry.
|
|
43
|
+
*/
|
|
44
|
+
function runOutsideReactCacheScope(fn) {
|
|
45
|
+
return reactCacheScopeAls.exit(fn);
|
|
46
|
+
}
|
|
47
|
+
var cookieReads = /* @__PURE__ */ new WeakMap();
|
|
48
|
+
var warnedScopes = /* @__PURE__ */ new WeakSet();
|
|
49
|
+
/**
|
|
50
|
+
* Dev-only: record that cookie `name` (or {@link ANY_COOKIE}) was read
|
|
51
|
+
* while `React.cache` held values in this request — the read may have
|
|
52
|
+
* happened inside a cached function.
|
|
53
|
+
*/
|
|
54
|
+
function noteCookieReadForReactCache(name) {
|
|
55
|
+
if (!isDevMode()) return;
|
|
56
|
+
const scope = reactCacheScopeAls.getStore();
|
|
57
|
+
if (!scope || scope.size === 0) return;
|
|
58
|
+
let reads = cookieReads.get(scope);
|
|
59
|
+
if (!reads) {
|
|
60
|
+
reads = /* @__PURE__ */ new Set();
|
|
61
|
+
cookieReads.set(scope, reads);
|
|
62
|
+
}
|
|
63
|
+
reads.add(name);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Dev-only: warn (once per request) when a cookie recorded by
|
|
67
|
+
* {@link noteCookieReadForReactCache} is written. `name` is the written
|
|
68
|
+
* cookie, or {@link ANY_COOKIE} for `clear()`. Dev-only because reads are
|
|
69
|
+
* only recorded in dev.
|
|
70
|
+
*/
|
|
71
|
+
function warnIfCachedCookieIsWritten(name) {
|
|
72
|
+
const scope = reactCacheScopeAls.getStore();
|
|
73
|
+
if (!scope || warnedScopes.has(scope)) return;
|
|
74
|
+
const reads = cookieReads.get(scope);
|
|
75
|
+
if (!reads) return;
|
|
76
|
+
if (!(name === "*" ? reads.size > 0 : reads.has(name) || reads.has("*"))) return;
|
|
77
|
+
warnedScopes.add(scope);
|
|
78
|
+
const which = name === "*" ? "Cookies were cleared" : `Cookie "${name}" was written`;
|
|
79
|
+
console.warn(`[timber] ${which} after being read while React.cache held values for this request. A cached function that read it keeps returning the old result — pass the cookie value in as an argument (e.g. getUser(sessionToken)) so a change is a new cache key.`);
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/server/request-context.ts
|
|
83
|
+
/**
|
|
84
|
+
* Returns a read-only view of the current request's headers.
|
|
85
|
+
*
|
|
86
|
+
* Available in middleware, access checks, server components, and server actions.
|
|
87
|
+
* Throws if called outside a request context (security principle #2: no global fallback).
|
|
88
|
+
*/
|
|
89
|
+
function getHeaders() {
|
|
90
|
+
const store = requestContextAls.getStore();
|
|
91
|
+
if (!store) throw new Error("[timber] getHeaders() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
|
|
92
|
+
return store.headers;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Returns the value of a single request header, or undefined if absent.
|
|
96
|
+
*
|
|
97
|
+
* Thin wrapper over `getHeaders().get(name)` for the common case where
|
|
98
|
+
* you need exactly one header.
|
|
99
|
+
*
|
|
100
|
+
* @internal — not part of the public API. Use `getHeaders().get(name)` instead.
|
|
101
|
+
*/
|
|
102
|
+
function getHeader(name) {
|
|
103
|
+
return getHeaders().get(name) ?? void 0;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Returns the current request's raw URLSearchParams.
|
|
107
|
+
*
|
|
108
|
+
* @internal — not part of the public API. Use `defineSearchParams().get()` instead.
|
|
109
|
+
*/
|
|
110
|
+
function getSearchParams() {
|
|
111
|
+
const store = requestContextAls.getStore();
|
|
112
|
+
if (!store) throw new Error("[timber] getSearchParams() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
|
|
113
|
+
return store.searchParams;
|
|
114
|
+
}
|
|
115
|
+
_setGetSearchParamsFn(getSearchParams);
|
|
116
|
+
_setGetSegmentParamsFn(getSegmentParams);
|
|
117
|
+
/**
|
|
118
|
+
* Returns the current request's coerced segment params.
|
|
119
|
+
*
|
|
120
|
+
* The optional `segmentPath` argument exists only for TypeScript narrowing —
|
|
121
|
+
* it does not affect the runtime return value. Pass a segment path
|
|
122
|
+
* (e.g. `'/(browse)/[artistSlug]/[year]'`) to narrow the return type to the
|
|
123
|
+
* exact params shape for that segment.
|
|
124
|
+
*
|
|
125
|
+
* Without an argument, returns all coerced params with optional types.
|
|
126
|
+
*
|
|
127
|
+
* See design/41-global-params.md §Function Signatures
|
|
128
|
+
*/
|
|
129
|
+
function getSegmentParams(segmentPath) {
|
|
130
|
+
const store = requestContextAls.getStore();
|
|
131
|
+
if (!store) throw new Error("[timber] getSegmentParams() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
|
|
132
|
+
if (!store.segmentParams) throw new Error("[timber] getSegmentParams() called before route matching completed. Segment params are not available until after the route is matched.");
|
|
133
|
+
const slotResolved = resolveSegmentParams(store.segmentParams, store.slotParams, segmentPath);
|
|
134
|
+
if (slotResolved !== store.segmentParams) return slotResolved;
|
|
135
|
+
if (segmentPath && isDebug() && store.matchedSegmentPath) {
|
|
136
|
+
const expected = extractDynamicSegments(segmentPath);
|
|
137
|
+
const actual = extractDynamicSegments(store.matchedSegmentPath);
|
|
138
|
+
const missing = expected.filter((s) => !actual.includes(s));
|
|
139
|
+
if (missing.length > 0) console.warn(`[timber] getSegmentParams('${segmentPath}') called but current segment is '${store.matchedSegmentPath}'\n Missing params: ${missing.join(", ")}\n These will be undefined at runtime despite the type annotation.`);
|
|
140
|
+
}
|
|
141
|
+
return store.segmentParams;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Set the segment params on the current request context.
|
|
145
|
+
* Called by the pipeline after route matching and param coercion.
|
|
146
|
+
*
|
|
147
|
+
* @internal — framework use only
|
|
148
|
+
*/
|
|
149
|
+
function setSegmentParams(params) {
|
|
150
|
+
const store = requestContextAls.getStore();
|
|
151
|
+
if (!store) throw new Error("[timber] setSegmentParams() called outside of a request context.");
|
|
152
|
+
store.segmentParams = params;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Store the matched segment path (e.g. '/(browse)/[artistSlug]/[year]') for
|
|
156
|
+
* dev-mode validation in getSegmentParams().
|
|
157
|
+
*
|
|
158
|
+
* @internal — framework use only
|
|
159
|
+
*/
|
|
160
|
+
function setMatchedSegmentPath(segmentPath) {
|
|
161
|
+
const store = requestContextAls.getStore();
|
|
162
|
+
if (!store) return;
|
|
163
|
+
store.matchedSegmentPath = segmentPath;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Extract dynamic segment names from a route pattern.
|
|
167
|
+
* '/[artistSlug]/[year]' → ['artistSlug', 'year']
|
|
168
|
+
* '/docs/[...slug]' → ['slug']
|
|
169
|
+
*/
|
|
170
|
+
function extractDynamicSegments(route) {
|
|
171
|
+
const segments = [];
|
|
172
|
+
const re = /\[{1,2}\.{0,3}(\w+)\]{1,2}/g;
|
|
173
|
+
let m;
|
|
174
|
+
while ((m = re.exec(route)) !== null) segments.push(m[1]);
|
|
175
|
+
return segments;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Returns the raw search string from the current request URL (e.g. "?foo=bar").
|
|
179
|
+
* Synchronous — safe for use in `redirect()` which throws synchronously.
|
|
180
|
+
*
|
|
181
|
+
* Returns empty string if called outside a request context (non-throwing for
|
|
182
|
+
* use in redirect's optional preserveSearchParams path).
|
|
183
|
+
*
|
|
184
|
+
* @internal — used by redirect() for preserveSearchParams support.
|
|
185
|
+
*/
|
|
186
|
+
function getRequestSearchString() {
|
|
187
|
+
return requestContextAls.getStore()?.searchString ?? "";
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Run a callback within a request context. Used by the pipeline to establish
|
|
191
|
+
* per-request ALS scope so that `getHeaders()` and `getCookies()` work.
|
|
192
|
+
*
|
|
193
|
+
* When `options.cookies` is given, the context's `parsedCookies` map is a
|
|
194
|
+
* copy of it and the raw `cookieHeader` is left empty, so
|
|
195
|
+
* `parseCookieHeader` never runs for that request. Re-entry callers pass the
|
|
196
|
+
* action's post-mutation cookie state this way (TIM-868).
|
|
197
|
+
*
|
|
198
|
+
* Each request context also opens its own `React.cache` scope, shared by
|
|
199
|
+
* everything that runs inside it — proxy.ts, middleware.ts, route handlers,
|
|
200
|
+
* and the render (design/02-rendering-pipeline.md §"Cache Scoping Model").
|
|
201
|
+
*
|
|
202
|
+
* @param req - The incoming Request object.
|
|
203
|
+
* @param fn - The function to run within the request context.
|
|
204
|
+
*/
|
|
205
|
+
function runWithRequestContext(req, fn, { reactCacheScope, cookies } = {}) {
|
|
206
|
+
const originalCopy = new Headers(req.headers);
|
|
207
|
+
const appVisible = appVisibleSearch(new URL(req.url));
|
|
208
|
+
const seed = cookies ? new Map(cookies) : void 0;
|
|
209
|
+
const store = {
|
|
210
|
+
request: req,
|
|
211
|
+
headers: freezeHeaders(req.headers),
|
|
212
|
+
originalHeaders: originalCopy,
|
|
213
|
+
cookieHeader: seed ? "" : req.headers.get("cookie") ?? "",
|
|
214
|
+
parsedCookies: seed,
|
|
215
|
+
searchParams: appVisible.params,
|
|
216
|
+
searchString: appVisible.search,
|
|
217
|
+
cookieJar: /* @__PURE__ */ new Map(),
|
|
218
|
+
flushed: false,
|
|
219
|
+
mutableContext: false
|
|
220
|
+
};
|
|
221
|
+
return requestContextAls.run(store, () => runWithReactCacheScope(fn, reactCacheScope));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Enable cookie mutation for the current context. Called by the framework
|
|
225
|
+
* when entering middleware.ts, server actions, or route.ts handlers.
|
|
226
|
+
*
|
|
227
|
+
* See design/29-cookies.md §"Context Tracking"
|
|
228
|
+
*/
|
|
229
|
+
function setMutableCookieContext(mutable) {
|
|
230
|
+
const store = requestContextAls.getStore();
|
|
231
|
+
if (store) store.mutableContext = mutable;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Mark the response as flushed (headers committed). After this point,
|
|
235
|
+
* cookie mutations log a warning instead of throwing.
|
|
236
|
+
*
|
|
237
|
+
* See design/29-cookies.md §"Streaming Constraint: Post-Flush Cookie Warning"
|
|
238
|
+
*/
|
|
239
|
+
function markResponseFlushed() {
|
|
240
|
+
const store = requestContextAls.getStore();
|
|
241
|
+
if (store) store.flushed = true;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Apply middleware-injected request headers to the current request context.
|
|
245
|
+
*
|
|
246
|
+
* Called by the pipeline after middleware.ts runs. Merges overlay headers
|
|
247
|
+
* on top of the original request headers so downstream code (access.ts,
|
|
248
|
+
* server components, server actions) sees them via `getHeaders()`.
|
|
249
|
+
*
|
|
250
|
+
* The original request headers are never mutated — a new frozen Headers
|
|
251
|
+
* object is created with the overlay applied on top.
|
|
252
|
+
*
|
|
253
|
+
* See design/07-routing.md §"Request Header Injection"
|
|
254
|
+
*/
|
|
255
|
+
function applyRequestHeaderOverlay(overlay) {
|
|
256
|
+
const store = requestContextAls.getStore();
|
|
257
|
+
if (!store) throw new Error("[timber] applyRequestHeaderOverlay() called outside of a request context.");
|
|
258
|
+
let hasOverlay = false;
|
|
259
|
+
overlay.forEach(() => {
|
|
260
|
+
hasOverlay = true;
|
|
261
|
+
});
|
|
262
|
+
if (!hasOverlay) return;
|
|
263
|
+
const merged = new Headers(store.originalHeaders);
|
|
264
|
+
overlay.forEach((value, key) => {
|
|
265
|
+
merged.set(key, value);
|
|
266
|
+
});
|
|
267
|
+
store.headers = freezeHeaders(merged);
|
|
268
|
+
}
|
|
269
|
+
var MUTATING_METHODS = /* @__PURE__ */ new Set([
|
|
270
|
+
"set",
|
|
271
|
+
"append",
|
|
272
|
+
"delete"
|
|
273
|
+
]);
|
|
274
|
+
/**
|
|
275
|
+
* Wrap a Headers object in a Proxy that throws on mutating methods.
|
|
276
|
+
* Object.freeze doesn't work on Headers (native internal slots), so we
|
|
277
|
+
* intercept property access and reject set/append/delete at runtime.
|
|
278
|
+
*
|
|
279
|
+
* Read methods (get, has, entries, etc.) must be bound to the underlying
|
|
280
|
+
* Headers instance because they access private #headersList slots.
|
|
281
|
+
*/
|
|
282
|
+
function freezeHeaders(source) {
|
|
283
|
+
const copy = new Headers(source);
|
|
284
|
+
return new Proxy(copy, { get(target, prop) {
|
|
285
|
+
if (typeof prop === "string" && MUTATING_METHODS.has(prop)) return () => {
|
|
286
|
+
throw new Error(`[timber] getHeaders() returns a read-only Headers object. Calling .${prop}() is not allowed. Use ctx.requestHeaders in middleware to inject headers for downstream components.`);
|
|
287
|
+
};
|
|
288
|
+
const value = Reflect.get(target, prop);
|
|
289
|
+
if (typeof value === "function") return value.bind(target);
|
|
290
|
+
return value;
|
|
291
|
+
} });
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/server/cookie-parsing.ts
|
|
295
|
+
/**
|
|
296
|
+
* Cookie parsing and serialization helpers — pure string ↔ structure
|
|
297
|
+
* functions with no ALS dependency. Split out of `cookie-context.ts`
|
|
298
|
+
* (TIM-853) so the API surface and the wire-format codecs can each be
|
|
299
|
+
* read on their own.
|
|
300
|
+
*
|
|
301
|
+
* The functions in this module are total over arbitrary input. They
|
|
302
|
+
* never throw and never call `assertValid*` (the security validators
|
|
303
|
+
* live in the API surface — `cookie-context.ts` invokes them at every
|
|
304
|
+
* jar entry point so the smuggling-primitive invariant from TIM-868
|
|
305
|
+
* is enforced regardless of which path produced the bytes).
|
|
306
|
+
*
|
|
307
|
+
* Delegates to the `cookie` package (RFC 6265, dependency-free,
|
|
308
|
+
* browser-safe) for wire codecs. Adapts at the boundary to preserve
|
|
309
|
+
* timber's Map-based API and never-throw contract.
|
|
310
|
+
*/
|
|
311
|
+
/**
|
|
312
|
+
* Parse a Cookie header string into a Map of name → value pairs.
|
|
313
|
+
* Follows RFC 6265 §4.2.1: cookies are semicolon-separated key=value pairs.
|
|
314
|
+
*
|
|
315
|
+
* Values are auto-decoded with `decodeURIComponent` so they round-trip
|
|
316
|
+
* losslessly with `getCookies().set()` (which auto-encodes). Malformed
|
|
317
|
+
* `%`-escapes from third-party cookies fall back to the raw byte sequence
|
|
318
|
+
* — the parser must be total over arbitrary inbound headers, including
|
|
319
|
+
* non-conforming values from other servers, browser extensions, etc.
|
|
320
|
+
*/
|
|
321
|
+
function parseCookieHeader(header) {
|
|
322
|
+
const map = /* @__PURE__ */ new Map();
|
|
323
|
+
if (!header) return map;
|
|
324
|
+
const parsed = parseCookie(header);
|
|
325
|
+
for (const name in parsed) {
|
|
326
|
+
const value = parsed[name];
|
|
327
|
+
if (value !== void 0) map.set(name, value);
|
|
328
|
+
}
|
|
329
|
+
return map;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Decode a single cookie value with `decodeURIComponent`, falling back to
|
|
333
|
+
* the raw byte sequence if the input contains a malformed `%`-escape.
|
|
334
|
+
*
|
|
335
|
+
* Used by both `parseCookieHeader` (incoming Cookie: header) and the
|
|
336
|
+
* `setRaw` forwarding path (outgoing Set-Cookie from upstream services).
|
|
337
|
+
* Total — never throws.
|
|
338
|
+
*
|
|
339
|
+
* cookie's internal decode has identical semantics but is not exported,
|
|
340
|
+
* so we keep this standalone helper.
|
|
341
|
+
*/
|
|
342
|
+
function safeDecodeCookieValue(raw) {
|
|
343
|
+
try {
|
|
344
|
+
return decodeURIComponent(raw);
|
|
345
|
+
} catch {
|
|
346
|
+
return raw;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Serialize a CookieEntry into a Set-Cookie header value.
|
|
351
|
+
*
|
|
352
|
+
* Total — never throws. If the cookie package's serializer rejects
|
|
353
|
+
* the input (e.g. non-integer maxAge, forbidden chars in name/value),
|
|
354
|
+
* falls back to a minimal hand-rolled serialization so the response
|
|
355
|
+
* path is never interrupted by a codec error.
|
|
356
|
+
*/
|
|
357
|
+
function serializeCookieEntry(entry) {
|
|
358
|
+
try {
|
|
359
|
+
return stringifySetCookie({
|
|
360
|
+
name: entry.name,
|
|
361
|
+
value: entry.value,
|
|
362
|
+
domain: entry.options.domain,
|
|
363
|
+
path: entry.options.path,
|
|
364
|
+
expires: entry.options.expires,
|
|
365
|
+
maxAge: entry.options.maxAge,
|
|
366
|
+
httpOnly: entry.options.httpOnly,
|
|
367
|
+
secure: entry.options.secure,
|
|
368
|
+
sameSite: entry.options.sameSite,
|
|
369
|
+
partitioned: entry.options.partitioned
|
|
370
|
+
}, { encode: (v) => v });
|
|
371
|
+
} catch {
|
|
372
|
+
return serializeCookieEntryFallback(entry);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function serializeCookieEntryFallback(entry) {
|
|
376
|
+
const parts = [`${entry.name}=${entry.value}`];
|
|
377
|
+
const opts = entry.options;
|
|
378
|
+
if (opts.domain) parts.push(`Domain=${opts.domain}`);
|
|
379
|
+
if (opts.path) parts.push(`Path=${opts.path}`);
|
|
380
|
+
if (opts.expires) parts.push(`Expires=${opts.expires.toUTCString()}`);
|
|
381
|
+
if (opts.maxAge !== void 0) parts.push(`Max-Age=${opts.maxAge}`);
|
|
382
|
+
if (opts.httpOnly) parts.push("HttpOnly");
|
|
383
|
+
if (opts.secure) parts.push("Secure");
|
|
384
|
+
if (opts.sameSite) parts.push(`SameSite=${opts.sameSite.charAt(0).toUpperCase()}${opts.sameSite.slice(1)}`);
|
|
385
|
+
if (opts.partitioned) parts.push("Partitioned");
|
|
386
|
+
return parts.join("; ");
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Parse a raw `Set-Cookie` header string into name, value, and options.
|
|
390
|
+
* Handles all standard attributes: Path, Domain, Max-Age, Expires,
|
|
391
|
+
* SameSite, Secure, HttpOnly, Partitioned.
|
|
392
|
+
*
|
|
393
|
+
* Does NOT apply DEFAULT_COOKIE_OPTIONS — the caller decides whether
|
|
394
|
+
* to merge defaults (e.g. `set()` does, but `setRaw()` should preserve
|
|
395
|
+
* the original header's intent).
|
|
396
|
+
*/
|
|
397
|
+
function parseSetCookie(header) {
|
|
398
|
+
const parsed = parseSetCookie$1(header, { decode: (v) => v });
|
|
399
|
+
if (!parsed.name) return null;
|
|
400
|
+
const options = {};
|
|
401
|
+
if (parsed.path !== void 0) options.path = parsed.path || "/";
|
|
402
|
+
if (parsed.domain !== void 0) options.domain = parsed.domain;
|
|
403
|
+
if (parsed.maxAge !== void 0 && Number.isFinite(parsed.maxAge)) options.maxAge = parsed.maxAge;
|
|
404
|
+
if (parsed.expires !== void 0) options.expires = parsed.expires;
|
|
405
|
+
if (parsed.sameSite !== void 0 && parsed.sameSite !== true) {
|
|
406
|
+
const sameSite = parsed.sameSite.toLowerCase();
|
|
407
|
+
if (sameSite === "strict" || sameSite === "lax" || sameSite === "none") options.sameSite = sameSite;
|
|
408
|
+
}
|
|
409
|
+
if (parsed.secure) options.secure = true;
|
|
410
|
+
if (parsed.httpOnly) options.httpOnly = true;
|
|
411
|
+
if (parsed.partitioned) options.partitioned = true;
|
|
412
|
+
return {
|
|
413
|
+
name: parsed.name,
|
|
414
|
+
value: parsed.value ?? "",
|
|
415
|
+
options
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
//#endregion
|
|
419
|
+
//#region src/server/cookie-context.ts
|
|
420
|
+
/**
|
|
421
|
+
* Cookie Context — per-request cookie API and on-the-wire helpers.
|
|
422
|
+
*
|
|
423
|
+
* Split out of `request-context.ts` (TIM-853) so the cookie subsystem
|
|
424
|
+
* — encoding contract, options grammar, parser, serializer, and RYW map
|
|
425
|
+
* — lives in one file. The headers/scope/params APIs
|
|
426
|
+
* stay in `request-context.ts` and call into this module via the
|
|
427
|
+
* exported helpers.
|
|
428
|
+
*
|
|
429
|
+
* See design/29-cookies.md for the encoding contract and read-your-own-
|
|
430
|
+
* writes semantics. See ONGOING_SECURITY.md H-3 (TIM-868) for the
|
|
431
|
+
* smuggling primitive that the encoding contract closes.
|
|
432
|
+
*/
|
|
433
|
+
/**
|
|
434
|
+
* Returns a cookie accessor for the current request.
|
|
435
|
+
*
|
|
436
|
+
* Available in middleware, access checks, server components, and server actions.
|
|
437
|
+
* Throws if called outside a request context (security principle #2: no global fallback).
|
|
438
|
+
*
|
|
439
|
+
* Read methods (.get, .has, .getAll) are always available and reflect
|
|
440
|
+
* read-your-own-writes from .set() calls in the same request.
|
|
441
|
+
*
|
|
442
|
+
* Mutation methods (.set, .delete, .clear) are only available in mutable
|
|
443
|
+
* contexts (middleware.ts, server actions, route.ts handlers). Calling them
|
|
444
|
+
* in read-only contexts (access.ts, server components) throws.
|
|
445
|
+
*
|
|
446
|
+
* This is the escape hatch for direct cookie jar operations. For typed
|
|
447
|
+
* cookie access, use `defineCookie()` instead.
|
|
448
|
+
*
|
|
449
|
+
* See design/29-cookies.md
|
|
450
|
+
*/
|
|
451
|
+
function getCookieJar() {
|
|
452
|
+
const store = requestContextAls.getStore();
|
|
453
|
+
if (!store) throw new Error("[timber] getCookieJar() called outside of a request context. It can only be used in middleware, access checks, server components, and server actions.");
|
|
454
|
+
if (!store.parsedCookies) store.parsedCookies = parseCookieHeader(store.cookieHeader);
|
|
455
|
+
const map = store.parsedCookies;
|
|
456
|
+
return {
|
|
457
|
+
get(name) {
|
|
458
|
+
noteCookieReadForReactCache(name);
|
|
459
|
+
return map.get(name);
|
|
460
|
+
},
|
|
461
|
+
has(name) {
|
|
462
|
+
noteCookieReadForReactCache(name);
|
|
463
|
+
return map.has(name);
|
|
464
|
+
},
|
|
465
|
+
getAll() {
|
|
466
|
+
noteCookieReadForReactCache("*");
|
|
467
|
+
return Array.from(map.entries()).map(([name, value]) => ({
|
|
468
|
+
name,
|
|
469
|
+
value
|
|
470
|
+
}));
|
|
471
|
+
},
|
|
472
|
+
get size() {
|
|
473
|
+
noteCookieReadForReactCache("*");
|
|
474
|
+
return map.size;
|
|
475
|
+
},
|
|
476
|
+
set(name, value, options) {
|
|
477
|
+
assertMutable(store, "set");
|
|
478
|
+
assertValidCookieName(name);
|
|
479
|
+
if (typeof value !== "string") throw new Error(`[timber] getCookieJar().set(${JSON.stringify(name)}, …): value must be a string, got ${typeof value}.\n To store a JSON-serializable value, use defineCookie + jsonCookieCodec:\n\n import { defineCookie, jsonCookieCodec } from '@timber-js/app/cookies';\n\n export const ${name}Cookie = defineCookie(${JSON.stringify(name)}, {\n codec: jsonCookieCodec(),\n });\n\n ${name}Cookie.set(value);\n\n See design/29-cookies.md §"Typed Cookies with Schema Validation".`);
|
|
480
|
+
const raw = options?.raw === true;
|
|
481
|
+
const wireValue = raw ? value : encodeURIComponent(value);
|
|
482
|
+
if (raw) assertValidCookieValue(name, wireValue);
|
|
483
|
+
if (store.flushed) {
|
|
484
|
+
if (isDebug()) console.warn(`[timber] warn: getCookieJar().set('${name}') called after response headers were committed.\n The cookie will NOT be sent. Move cookie mutations to middleware.ts, a server action,\n or a route.ts handler.`);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
const { raw: _raw, ...attributeOptions } = options ?? {};
|
|
488
|
+
const opts = {
|
|
489
|
+
...DEFAULT_COOKIE_OPTIONS,
|
|
490
|
+
...attributeOptions
|
|
491
|
+
};
|
|
492
|
+
assertValidCookieOptions(opts);
|
|
493
|
+
store.cookieJar.set(name, {
|
|
494
|
+
name,
|
|
495
|
+
value: wireValue,
|
|
496
|
+
options: opts
|
|
497
|
+
});
|
|
498
|
+
map.set(name, raw ? wireValue : value);
|
|
499
|
+
warnIfCachedCookieIsWritten(name);
|
|
500
|
+
},
|
|
501
|
+
setFromHeaders(headers) {
|
|
502
|
+
assertMutable(store, "setFromHeaders");
|
|
503
|
+
if (store.flushed) {
|
|
504
|
+
console.warn("[timber] warn: getCookieJar().setFromHeaders() called after response headers were committed.\n The cookies will NOT be sent. Move cookie mutations to middleware.ts, a server action,\n or a route.ts handler.");
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
for (const raw of headers.getSetCookie()) {
|
|
508
|
+
const parsed = parseSetCookie(raw);
|
|
509
|
+
if (parsed) setRaw(store, map, parsed.name, parsed.value, parsed.options);
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
delete(name, options) {
|
|
513
|
+
assertMutable(store, "delete");
|
|
514
|
+
assertValidCookieName(name);
|
|
515
|
+
if (store.flushed) {
|
|
516
|
+
if (isDebug()) console.warn(`[timber] warn: getCookieJar().delete('${name}') called after response headers were committed.\n The cookie will NOT be deleted. Move cookie mutations to middleware.ts, a server action,\n or a route.ts handler.`);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
const opts = {
|
|
520
|
+
...DEFAULT_COOKIE_OPTIONS,
|
|
521
|
+
...options,
|
|
522
|
+
maxAge: 0,
|
|
523
|
+
expires: /* @__PURE__ */ new Date(0)
|
|
524
|
+
};
|
|
525
|
+
assertValidCookieOptions(opts);
|
|
526
|
+
store.cookieJar.set(name, {
|
|
527
|
+
name,
|
|
528
|
+
value: "",
|
|
529
|
+
options: opts
|
|
530
|
+
});
|
|
531
|
+
map.delete(name);
|
|
532
|
+
warnIfCachedCookieIsWritten(name);
|
|
533
|
+
},
|
|
534
|
+
clear() {
|
|
535
|
+
assertMutable(store, "clear");
|
|
536
|
+
if (store.flushed) return;
|
|
537
|
+
for (const name of Array.from(map.keys())) store.cookieJar.set(name, {
|
|
538
|
+
name,
|
|
539
|
+
value: "",
|
|
540
|
+
options: {
|
|
541
|
+
...DEFAULT_COOKIE_OPTIONS,
|
|
542
|
+
maxAge: 0,
|
|
543
|
+
expires: /* @__PURE__ */ new Date(0)
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
map.clear();
|
|
547
|
+
warnIfCachedCookieIsWritten("*");
|
|
548
|
+
},
|
|
549
|
+
toString() {
|
|
550
|
+
noteCookieReadForReactCache("*");
|
|
551
|
+
return Array.from(map.entries()).map(([name, value]) => `${name}=${encodeURIComponent(value)}`).join("; ");
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Returns the value of a single cookie, or undefined if absent.
|
|
557
|
+
*
|
|
558
|
+
* @internal — not part of the public API. Use `defineCookie().get()` or `getCookieJar().get()` instead.
|
|
559
|
+
*/
|
|
560
|
+
function getCookie(name) {
|
|
561
|
+
return getCookieJar().get(name);
|
|
562
|
+
}
|
|
563
|
+
var DEFAULT_COOKIE_OPTIONS = {
|
|
564
|
+
path: "/",
|
|
565
|
+
httpOnly: true,
|
|
566
|
+
secure: true,
|
|
567
|
+
sameSite: "lax"
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* Collect all Set-Cookie headers from the cookie jar.
|
|
571
|
+
* Called by the framework at flush time to apply cookies to the response.
|
|
572
|
+
*
|
|
573
|
+
* Returns an array of serialized Set-Cookie header values.
|
|
574
|
+
*/
|
|
575
|
+
function getSetCookieHeaders() {
|
|
576
|
+
const store = requestContextAls.getStore();
|
|
577
|
+
if (!store) return [];
|
|
578
|
+
return Array.from(store.cookieJar.values()).map(serializeCookieEntry);
|
|
579
|
+
}
|
|
580
|
+
/** Throw if cookie mutation is attempted in a read-only context. */
|
|
581
|
+
function assertMutable(store, method) {
|
|
582
|
+
if (!store.mutableContext) throw new Error(`[timber] getCookieJar().${method}() cannot be called in this context.\n Set cookies in middleware.ts, server actions, or route.ts handlers.`);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Write a cookie to the jar WITHOUT merging DEFAULT_COOKIE_OPTIONS.
|
|
586
|
+
* Used by setFromHeaders to preserve the original header's attributes exactly.
|
|
587
|
+
*
|
|
588
|
+
* For deletion cookies (maxAge=0), the jar entry is still created so the
|
|
589
|
+
* Set-Cookie header is emitted, but the cookie is NOT added to the read map
|
|
590
|
+
* (it would be misleading — the cookie is being deleted).
|
|
591
|
+
*/
|
|
592
|
+
function setRaw(store, readMap, name, value, options) {
|
|
593
|
+
assertValidCookieName(name);
|
|
594
|
+
assertValidCookieValue(name, value);
|
|
595
|
+
assertValidCookieOptions(options);
|
|
596
|
+
store.cookieJar.set(name, {
|
|
597
|
+
name,
|
|
598
|
+
value,
|
|
599
|
+
options
|
|
600
|
+
});
|
|
601
|
+
warnIfCachedCookieIsWritten(name);
|
|
602
|
+
if (options.maxAge === 0) readMap.delete(name);
|
|
603
|
+
else readMap.set(name, safeDecodeCookieValue(value));
|
|
604
|
+
}
|
|
605
|
+
//#endregion
|
|
606
|
+
//#region src/server/primitives.ts
|
|
607
|
+
/**
|
|
608
|
+
* Check if a value is JSON-serializable without data loss.
|
|
609
|
+
* Returns a description of the first non-serializable value found, or null if OK.
|
|
610
|
+
*
|
|
611
|
+
* @internal Exported for testing only.
|
|
612
|
+
*/
|
|
613
|
+
function findNonSerializable(value, path = "data") {
|
|
614
|
+
if (value === null || value === void 0) return null;
|
|
615
|
+
switch (typeof value) {
|
|
616
|
+
case "string":
|
|
617
|
+
case "number":
|
|
618
|
+
case "boolean": return null;
|
|
619
|
+
case "bigint": return `${path} contains a BigInt — BigInt throws in JSON.stringify`;
|
|
620
|
+
case "function": return `${path} is a function — functions are not JSON-serializable`;
|
|
621
|
+
case "symbol": return `${path} is a symbol — symbols are not JSON-serializable`;
|
|
622
|
+
case "object": break;
|
|
623
|
+
default: return `${path} has unsupported type "${typeof value}"`;
|
|
624
|
+
}
|
|
625
|
+
if (value instanceof Date) return `${path} is a Date — Dates silently coerce to strings in JSON.stringify`;
|
|
626
|
+
if (value instanceof Map) return `${path} is a Map — Maps serialize as {} in JSON.stringify (data loss)`;
|
|
627
|
+
if (value instanceof Set) return `${path} is a Set — Sets serialize as {} in JSON.stringify (data loss)`;
|
|
628
|
+
if (value instanceof RegExp) return `${path} is a RegExp — RegExps serialize as {} in JSON.stringify`;
|
|
629
|
+
if (value instanceof Error) return `${path} is an Error — Errors serialize as {} in JSON.stringify`;
|
|
630
|
+
if (Array.isArray(value)) {
|
|
631
|
+
for (let i = 0; i < value.length; i++) {
|
|
632
|
+
const result = findNonSerializable(value[i], `${path}[${i}]`);
|
|
633
|
+
if (result) return result;
|
|
634
|
+
}
|
|
635
|
+
return null;
|
|
636
|
+
}
|
|
637
|
+
const proto = Object.getPrototypeOf(value);
|
|
638
|
+
if (proto === null) return `${path} is a null-prototype object — React Flight rejects null prototypes`;
|
|
639
|
+
if (proto !== Object.prototype) return `${path} is a ${value.constructor?.name ?? "unknown"} instance — class instances may lose data in JSON.stringify`;
|
|
640
|
+
for (const key of Object.keys(value)) {
|
|
641
|
+
const result = findNonSerializable(value[key], `${path}.${key}`);
|
|
642
|
+
if (result) return result;
|
|
643
|
+
}
|
|
644
|
+
return null;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Emit a dev-mode warning if data is not JSON-serializable.
|
|
648
|
+
* No-op in production.
|
|
649
|
+
*/
|
|
650
|
+
function warnIfNotSerializable(data, callerName) {
|
|
651
|
+
if (!isDebug()) return;
|
|
652
|
+
if (data === void 0) return;
|
|
653
|
+
const issue = findNonSerializable(data);
|
|
654
|
+
if (issue) console.warn(`[timber] ${callerName}: ${issue}. Data passed to deny() must be JSON-serializable because the post-flush path uses JSON.stringify, not React Flight.`);
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Render-phase signal thrown by `deny()`. Caught by the framework to produce
|
|
658
|
+
* the correct HTTP status code (segment context) or graceful degradation (slot context).
|
|
659
|
+
*
|
|
660
|
+
* Detect with `isDenySignal()`, never `instanceof` — see "Signal branding" in signal-identity.ts.
|
|
661
|
+
*/
|
|
662
|
+
var DenySignal = class extends Error {
|
|
663
|
+
[DENY_BRAND] = true;
|
|
664
|
+
status;
|
|
665
|
+
data;
|
|
666
|
+
/**
|
|
667
|
+
* Ordered list of segment keys that own matching deny pages for this
|
|
668
|
+
* signal, best match first. Present = addressed (a boundary should
|
|
669
|
+
* render it); absent = unplaced (the re-render fallback serves it).
|
|
670
|
+
*
|
|
671
|
+
* In-tree hoists stamp a single-element list (`[entry.ownerKey]`) —
|
|
672
|
+
* identical to the pre-TIM-1450 `ownerKey`. Late addressing (TIM-1450)
|
|
673
|
+
* stamps the full candidate list so the client can find the first
|
|
674
|
+
* *reachable* owner via its ancestry context, eliminating the
|
|
675
|
+
* owner-below-throw-site escape.
|
|
676
|
+
*
|
|
677
|
+
* See design/04-authorization.md §"Where a Deny Page Renders", TIM-1356.
|
|
678
|
+
*/
|
|
679
|
+
owners;
|
|
680
|
+
/**
|
|
681
|
+
* When true, the pipeline must respond with `rscErrorEnvelope` so the
|
|
682
|
+
* client hard-navigates instead of attempting to render a deny page
|
|
683
|
+
* from the RSC payload. Set by AccessGate when a skipped segment
|
|
684
|
+
* denies — rendering the deny page in-tree would appear inside the
|
|
685
|
+
* client's cached layout chrome (TIM-1074). See TIM-1363.
|
|
686
|
+
*/
|
|
687
|
+
_hardNavigate;
|
|
688
|
+
constructor(status, data) {
|
|
689
|
+
super(`Access denied with status ${status}`);
|
|
690
|
+
this.name = "DenySignal";
|
|
691
|
+
this.status = status;
|
|
692
|
+
this.data = data;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Extract the file that called deny() from the stack trace.
|
|
696
|
+
* Returns a short path (e.g. "app/auth/access.ts") or undefined if
|
|
697
|
+
* the stack can't be parsed. Dev-only — used for dev log output.
|
|
698
|
+
*/
|
|
699
|
+
get sourceFile() {
|
|
700
|
+
if (!this.stack) return void 0;
|
|
701
|
+
const frames = this.stack.split("\n");
|
|
702
|
+
for (let i = 2; i < frames.length; i++) {
|
|
703
|
+
const frame = frames[i];
|
|
704
|
+
if (!frame) continue;
|
|
705
|
+
if (frame.includes("primitives.ts") || frame.includes("node_modules")) continue;
|
|
706
|
+
const match = frame.match(/\(([^)]+?)(?::\d+:\d+)\)/) ?? frame.match(/at\s+([^\s]+?)(?::\d+:\d+)/);
|
|
707
|
+
if (match?.[1]) {
|
|
708
|
+
const full = match[1];
|
|
709
|
+
const appIdx = full.indexOf("/app/");
|
|
710
|
+
return appIdx >= 0 ? full.slice(appIdx + 1) : full;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
/**
|
|
716
|
+
* Universal denial/error primitive. Throws a `DenySignal` that the framework catches.
|
|
717
|
+
*
|
|
718
|
+
* - In segment context (outside Suspense): produces HTTP status code
|
|
719
|
+
* - In slot context: graceful degradation → denied.tsx → default.tsx → null
|
|
720
|
+
* - Inside Suspense (hold window): promoted to pre-flush behavior
|
|
721
|
+
* - Inside Suspense (after flush): error boundary + noindex meta
|
|
722
|
+
*
|
|
723
|
+
* ```ts
|
|
724
|
+
* deny() // 403 (default)
|
|
725
|
+
* deny(404) // 404
|
|
726
|
+
* deny(503, { message: 'Maintenance' }) // server-only log message
|
|
727
|
+
* deny(404, { dangerouslyPassData: { resourceId: params.id } }) // explicit client opt-in
|
|
728
|
+
* ```
|
|
729
|
+
*
|
|
730
|
+
* Accepts any 4xx or 5xx status code — it is also how a page renders a 5xx
|
|
731
|
+
* status file with data. An unplanned throw needs no primitive: it renders
|
|
732
|
+
* the error page with a 500.
|
|
733
|
+
*
|
|
734
|
+
* @param status - HTTP status code (4xx or 5xx). Default: 403.
|
|
735
|
+
* @param options - Optional message and/or data to pass to the client.
|
|
736
|
+
*/
|
|
737
|
+
function deny(status, options) {
|
|
738
|
+
const resolvedStatus = status ?? 403;
|
|
739
|
+
const resolvedData = options?.dangerouslyPassData;
|
|
740
|
+
if (resolvedStatus < 400 || resolvedStatus > 599) throw new Error(`deny() requires a 4xx or 5xx status code, got ${resolvedStatus}.`);
|
|
741
|
+
warnIfNotSerializable(resolvedData, "deny()");
|
|
742
|
+
throw new DenySignal(resolvedStatus, resolvedData);
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Render-phase signal thrown by `redirect()` and `redirectExternal()`.
|
|
746
|
+
* Caught by the framework to produce a 3xx response or client-side navigation.
|
|
747
|
+
*
|
|
748
|
+
* Detect with `isRedirectSignal()`, never `instanceof` — see "Signal branding" in signal-identity.ts.
|
|
749
|
+
*/
|
|
750
|
+
var RedirectSignal = class extends Error {
|
|
751
|
+
[REDIRECT_BRAND] = true;
|
|
752
|
+
location;
|
|
753
|
+
status;
|
|
754
|
+
constructor(location, status) {
|
|
755
|
+
super(`Redirect to ${location}`);
|
|
756
|
+
this.name = "RedirectSignal";
|
|
757
|
+
this.location = location;
|
|
758
|
+
this.status = status;
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
/**
|
|
762
|
+
* Redirect to a relative path. Rejects absolute and protocol-relative URLs.
|
|
763
|
+
* Use `redirectExternal()` for external redirects with an allow-list.
|
|
764
|
+
*
|
|
765
|
+
* @param path - Relative path (e.g. '/login', 'settings', '/login?returnTo=/dash')
|
|
766
|
+
* @param statusOrOptions - HTTP status code (3xx, default 302) or options object.
|
|
767
|
+
*
|
|
768
|
+
* @example
|
|
769
|
+
* // Simple redirect
|
|
770
|
+
* redirect('/login');
|
|
771
|
+
*
|
|
772
|
+
* // With status code
|
|
773
|
+
* redirect('/login', 301);
|
|
774
|
+
*
|
|
775
|
+
* // With preserved search params
|
|
776
|
+
* redirect(`/docs/${version}/${slug}`, { preserveSearchParams: ['foo'] });
|
|
777
|
+
*/
|
|
778
|
+
function redirect(path, statusOrOptions) {
|
|
779
|
+
let status;
|
|
780
|
+
let preserveSearchParams;
|
|
781
|
+
if (typeof statusOrOptions === "number") status = statusOrOptions;
|
|
782
|
+
else if (statusOrOptions) {
|
|
783
|
+
status = statusOrOptions.status ?? (statusOrOptions.permanent ? 308 : 302);
|
|
784
|
+
preserveSearchParams = statusOrOptions.preserveSearchParams;
|
|
785
|
+
} else status = 302;
|
|
786
|
+
if (status < 300 || status > 399) throw new Error(`redirect() requires a 3xx status code, got ${status}.`);
|
|
787
|
+
assertRelativeRedirectPath(path);
|
|
788
|
+
let resolvedPath = path;
|
|
789
|
+
if (preserveSearchParams) {
|
|
790
|
+
const currentSearch = getRequestSearchString();
|
|
791
|
+
resolvedPath = mergePreservedSearchParams(path, currentSearch, preserveSearchParams);
|
|
792
|
+
}
|
|
793
|
+
throw new RedirectSignal(resolvedPath, status);
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Redirect to an external URL. The origin must be in the provided allow-list.
|
|
797
|
+
*
|
|
798
|
+
* Only http: and https: schemes are permitted. The allow-list is matched
|
|
799
|
+
* against full origins (scheme + host + port), not bare hostnames.
|
|
800
|
+
*
|
|
801
|
+
* @param url - Absolute URL to redirect to.
|
|
802
|
+
* @param allowList - Array of allowed origins (e.g. ['https://example.com', 'https://auth.example.com']).
|
|
803
|
+
* @param status - HTTP redirect status code (3xx). Defaults to 302.
|
|
804
|
+
*/
|
|
805
|
+
function redirectExternal(url, allowList, status = 302) {
|
|
806
|
+
if (status < 300 || status > 399) throw new Error(`redirectExternal() requires a 3xx status code, got ${status}.`);
|
|
807
|
+
throw new RedirectSignal(validateExternalRedirectUrl(url, allowList), status);
|
|
808
|
+
}
|
|
809
|
+
var _waitUntilWarned = false;
|
|
810
|
+
/**
|
|
811
|
+
* Register a promise to be kept alive after the response is sent.
|
|
812
|
+
* Maps to `ctx.waitUntil()` on Cloudflare Workers and similar platforms.
|
|
813
|
+
*
|
|
814
|
+
* The platform adapter installs a per-request waitUntil function via ALS
|
|
815
|
+
* (see waituntil-bridge.ts). If no ALS handler is available, a warning
|
|
816
|
+
* is logged once and the promise is left to resolve (or reject) without
|
|
817
|
+
* being tracked.
|
|
818
|
+
*
|
|
819
|
+
* @param promise - The background work to keep alive.
|
|
820
|
+
*/
|
|
821
|
+
function waitUntil(promise) {
|
|
822
|
+
const alsFn = getWaitUntil();
|
|
823
|
+
if (alsFn) {
|
|
824
|
+
alsFn(promise);
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
if (!_waitUntilWarned) {
|
|
828
|
+
_waitUntilWarned = true;
|
|
829
|
+
console.warn("[timber] waitUntil() is not supported by the current adapter. Background work will not be tracked. This warning is shown once.");
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region src/server/form-data.ts
|
|
834
|
+
/**
|
|
835
|
+
* FormData preprocessing — schema-agnostic conversion of FormData to typed objects.
|
|
836
|
+
*
|
|
837
|
+
* FormData is all strings. Schema validation expects typed values. This module
|
|
838
|
+
* bridges the gap with intelligent coercion that runs *before* schema validation.
|
|
839
|
+
*
|
|
840
|
+
* Inspired by zod-form-data, but schema-agnostic — works with any Standard Schema
|
|
841
|
+
* library (Zod, Valibot, ArkType).
|
|
842
|
+
*
|
|
843
|
+
* See design/08-forms-and-actions.md §"parseFormData() and coerce helpers"
|
|
844
|
+
*/
|
|
845
|
+
/**
|
|
846
|
+
* Convert FormData into a plain object with intelligent coercion.
|
|
847
|
+
*
|
|
848
|
+
* Handles:
|
|
849
|
+
* - **Duplicate keys → arrays**: `tags=js&tags=ts` → `{ tags: ["js", "ts"] }`
|
|
850
|
+
* - **Nested dot-paths**: `user.name=Alice` → `{ user: { name: "Alice" } }`
|
|
851
|
+
* - **Empty strings → undefined**: Enables `.optional()` semantics in schemas
|
|
852
|
+
* - **Empty Files → undefined**: File inputs with no selection become `undefined`
|
|
853
|
+
* - **Strips `$ACTION_*` fields**: React's internal hidden fields are excluded
|
|
854
|
+
*/
|
|
855
|
+
function parseFormData(formData) {
|
|
856
|
+
const flat = {};
|
|
857
|
+
for (const key of new Set(formData.keys())) {
|
|
858
|
+
if (key.startsWith("$ACTION_")) continue;
|
|
859
|
+
if (DANGEROUS_KEYS.has(key)) continue;
|
|
860
|
+
const processed = formData.getAll(key).map(normalizeValue);
|
|
861
|
+
if (processed.length === 1) flat[key] = processed[0];
|
|
862
|
+
else flat[key] = processed.filter((v) => v !== void 0 && v !== "");
|
|
863
|
+
}
|
|
864
|
+
return expandDotPaths(flat);
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Normalize a single FormData entry value.
|
|
868
|
+
* - Empty File objects (no selection) → undefined
|
|
869
|
+
* - Strings pass through as-is (empty strings stay as empty strings so
|
|
870
|
+
* schema validators like `z.string().min(1, 'Required')` can produce
|
|
871
|
+
* their custom error messages instead of a generic type mismatch)
|
|
872
|
+
* - Everything else passes through as-is
|
|
873
|
+
*/
|
|
874
|
+
function normalizeValue(value) {
|
|
875
|
+
if (value instanceof File && value.size === 0 && value.name === "") return;
|
|
876
|
+
return value;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Expand dot-notation keys into nested objects.
|
|
880
|
+
* `{ "user.name": "Alice", "user.age": "30" }` → `{ user: { name: "Alice", age: "30" } }`
|
|
881
|
+
*
|
|
882
|
+
* Keys without dots are left as-is. Bracket notation (e.g. `items[0]`) is NOT
|
|
883
|
+
* supported — use dot notation (`items.0`) instead.
|
|
884
|
+
*/
|
|
885
|
+
function expandDotPaths(flat) {
|
|
886
|
+
const result = {};
|
|
887
|
+
let hasDotPaths = false;
|
|
888
|
+
for (const key of Object.keys(flat)) if (key.includes(".")) {
|
|
889
|
+
hasDotPaths = true;
|
|
890
|
+
break;
|
|
891
|
+
}
|
|
892
|
+
if (!hasDotPaths) return flat;
|
|
893
|
+
for (const [key, value] of Object.entries(flat)) {
|
|
894
|
+
const parts = key.split(".");
|
|
895
|
+
if (parts.some((p) => DANGEROUS_KEYS.has(p))) continue;
|
|
896
|
+
if (parts.length === 1) {
|
|
897
|
+
result[parts[0]] = value;
|
|
898
|
+
continue;
|
|
899
|
+
}
|
|
900
|
+
let current = result;
|
|
901
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
902
|
+
const part = parts[i];
|
|
903
|
+
if (current[part] === void 0 || current[part] === null) current[part] = {};
|
|
904
|
+
if (typeof current[part] !== "object" || current[part] instanceof File) current[part] = {};
|
|
905
|
+
current = current[part];
|
|
906
|
+
}
|
|
907
|
+
current[parts[parts.length - 1]] = value;
|
|
908
|
+
}
|
|
909
|
+
return result;
|
|
910
|
+
}
|
|
911
|
+
var DANGEROUS_KEYS = /* @__PURE__ */ new Set(["__proto__"]);
|
|
912
|
+
/**
|
|
913
|
+
* Schema-agnostic coercion primitives for common FormData patterns.
|
|
914
|
+
*
|
|
915
|
+
* These are plain transform functions — they compose with any schema library's
|
|
916
|
+
* `transform`/`preprocess` pipeline:
|
|
917
|
+
*
|
|
918
|
+
* ```ts
|
|
919
|
+
* // Zod
|
|
920
|
+
* z.preprocess(coerce.number, z.number())
|
|
921
|
+
* // Valibot
|
|
922
|
+
* v.pipe(v.unknown(), v.transform(coerce.number), v.number())
|
|
923
|
+
* ```
|
|
924
|
+
*/
|
|
925
|
+
var coerce = {
|
|
926
|
+
/**
|
|
927
|
+
* Coerce an empty string to undefined for optional text fields.
|
|
928
|
+
* Use with `.optional()` schemas where an empty input means "not provided".
|
|
929
|
+
*
|
|
930
|
+
* ```ts
|
|
931
|
+
* // Zod
|
|
932
|
+
* z.unknown().transform(coerce.text).pipe(z.string().optional())
|
|
933
|
+
* // Valibot
|
|
934
|
+
* v.pipe(v.unknown(), v.transform(coerce.text), v.optional(v.string()))
|
|
935
|
+
* ```
|
|
936
|
+
*/
|
|
937
|
+
text(value) {
|
|
938
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
939
|
+
if (typeof value === "string") return value;
|
|
940
|
+
},
|
|
941
|
+
/**
|
|
942
|
+
* Coerce a string to a number.
|
|
943
|
+
* - `"42"` → `42`
|
|
944
|
+
* - `"3.14"` → `3.14`
|
|
945
|
+
* - `""` / `undefined` / `null` → `undefined`
|
|
946
|
+
* - Non-numeric strings → `undefined` (schema validation will catch this)
|
|
947
|
+
*/
|
|
948
|
+
number(value) {
|
|
949
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
950
|
+
if (typeof value === "number") return value;
|
|
951
|
+
if (typeof value !== "string") return void 0;
|
|
952
|
+
const num = Number(value);
|
|
953
|
+
if (Number.isNaN(num)) return void 0;
|
|
954
|
+
return num;
|
|
955
|
+
},
|
|
956
|
+
/**
|
|
957
|
+
* Coerce a checkbox value to a boolean.
|
|
958
|
+
* HTML checkboxes submit "on" when checked and are absent when unchecked.
|
|
959
|
+
* - `"on"` / any truthy string → `true`
|
|
960
|
+
* - `undefined` / `null` / `""` → `false`
|
|
961
|
+
*/
|
|
962
|
+
checkbox(value) {
|
|
963
|
+
if (value === void 0 || value === null || value === "") return false;
|
|
964
|
+
if (typeof value === "boolean") return value;
|
|
965
|
+
return typeof value === "string" && value.length > 0;
|
|
966
|
+
},
|
|
967
|
+
/**
|
|
968
|
+
* Parse a JSON string into an object.
|
|
969
|
+
* - Valid JSON string → parsed object
|
|
970
|
+
* - `""` / `undefined` / `null` → `undefined`
|
|
971
|
+
* - Invalid JSON → `undefined` (schema validation will catch this)
|
|
972
|
+
*/
|
|
973
|
+
json(value) {
|
|
974
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
975
|
+
if (typeof value !== "string") return value;
|
|
976
|
+
try {
|
|
977
|
+
return JSON.parse(value);
|
|
978
|
+
} catch {
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
/**
|
|
983
|
+
* Coerce a date string to a Date object.
|
|
984
|
+
* Handles `<input type="date">` (`"2024-01-15"`), `<input type="datetime-local">`
|
|
985
|
+
* (`"2024-01-15T10:30"`), and full ISO 8601 strings.
|
|
986
|
+
* - Valid date string → `Date`
|
|
987
|
+
* - `""` / `undefined` / `null` → `undefined`
|
|
988
|
+
* - Invalid date strings → `undefined` (schema validation will catch this)
|
|
989
|
+
* - Impossible dates that `new Date()` silently normalizes (e.g. Feb 31) → `undefined`
|
|
990
|
+
*/
|
|
991
|
+
date(value) {
|
|
992
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
993
|
+
if (value instanceof Date) return value;
|
|
994
|
+
if (typeof value !== "string") return void 0;
|
|
995
|
+
const date = new Date(value);
|
|
996
|
+
if (Number.isNaN(date.getTime())) return void 0;
|
|
997
|
+
const ymdMatch = value.match(/^(\d{4})-(\d{2})-(\d{2})/);
|
|
998
|
+
if (ymdMatch) {
|
|
999
|
+
const inputYear = Number(ymdMatch[1]);
|
|
1000
|
+
const inputMonth = Number(ymdMatch[2]);
|
|
1001
|
+
const inputDay = Number(ymdMatch[3]);
|
|
1002
|
+
const isUTC = value.length === 10 || value.endsWith("Z");
|
|
1003
|
+
const parsedYear = isUTC ? date.getUTCFullYear() : date.getFullYear();
|
|
1004
|
+
const parsedMonth = isUTC ? date.getUTCMonth() + 1 : date.getMonth() + 1;
|
|
1005
|
+
const parsedDay = isUTC ? date.getUTCDate() : date.getDate();
|
|
1006
|
+
if (inputYear !== parsedYear || inputMonth !== parsedMonth || inputDay !== parsedDay) return;
|
|
1007
|
+
}
|
|
1008
|
+
return date;
|
|
1009
|
+
},
|
|
1010
|
+
/**
|
|
1011
|
+
* Create a File coercion function with optional size and mime type validation.
|
|
1012
|
+
* Returns the File if valid, `undefined` otherwise.
|
|
1013
|
+
*
|
|
1014
|
+
* ```ts
|
|
1015
|
+
* // Basic — just checks it's a real File
|
|
1016
|
+
* z.preprocess(coerce.file(), z.instanceof(File))
|
|
1017
|
+
*
|
|
1018
|
+
* // With constraints
|
|
1019
|
+
* z.preprocess(
|
|
1020
|
+
* coerce.file({ maxSize: 5 * 1024 * 1024, accept: ['image/png', 'image/jpeg'] }),
|
|
1021
|
+
* z.instanceof(File)
|
|
1022
|
+
* )
|
|
1023
|
+
* ```
|
|
1024
|
+
*/
|
|
1025
|
+
file(options) {
|
|
1026
|
+
return (value) => {
|
|
1027
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
1028
|
+
if (!(value instanceof File)) return void 0;
|
|
1029
|
+
if (value.size === 0 && value.name === "") return void 0;
|
|
1030
|
+
if (options?.maxSize !== void 0 && value.size > options.maxSize) return;
|
|
1031
|
+
if (options?.accept !== void 0 && !options.accept.includes(value.type)) return;
|
|
1032
|
+
return value;
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
//#endregion
|
|
1037
|
+
//#region src/server/actions.ts
|
|
1038
|
+
/**
|
|
1039
|
+
* Server action primitives: revalidatePath, revalidateTag, and the action handler.
|
|
1040
|
+
*
|
|
1041
|
+
* - revalidatePath(path) re-renders the route at that path and returns the RSC
|
|
1042
|
+
* flight payload for inline reconciliation. Server actions only.
|
|
1043
|
+
* - revalidateTag(tag) invalidates timber.cache entries by tag. Callable from
|
|
1044
|
+
* any server code: deferred to the end of the action inside one, immediate
|
|
1045
|
+
* anywhere else.
|
|
1046
|
+
*
|
|
1047
|
+
* The action handler processes incoming action requests, validates CSRF,
|
|
1048
|
+
* enforces body limits, executes the action, and returns the response
|
|
1049
|
+
* (with piggybacked RSC payload if revalidatePath was called).
|
|
1050
|
+
*
|
|
1051
|
+
* See design/08-forms-and-actions.md
|
|
1052
|
+
*/
|
|
1053
|
+
/**
|
|
1054
|
+
* Thrown by a `RevalidateRenderer` that decided not to render: the path
|
|
1055
|
+
* was rejected, its params failed coercion, or its middleware answered
|
|
1056
|
+
* with a `Response` that cannot become an element tree. `executeAction`
|
|
1057
|
+
* drops the revalidation — the action result is still delivered, with no
|
|
1058
|
+
* `_tree` piggybacked — and, because the drop was a decision, does not
|
|
1059
|
+
* return it as an error to report. Identified by `instanceof`, so the
|
|
1060
|
+
* message text never reaches clients.
|
|
1061
|
+
*/
|
|
1062
|
+
var RevalidationDropped = class extends Error {
|
|
1063
|
+
constructor(message) {
|
|
1064
|
+
super(message);
|
|
1065
|
+
this.name = "RevalidationDropped";
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
/**
|
|
1069
|
+
* Re-render the route at `path` and include the RSC flight payload in the
|
|
1070
|
+
* action response. The client reconciles inline — no separate fetch needed.
|
|
1071
|
+
*
|
|
1072
|
+
* Only callable inside a server action: it attaches a render to the action
|
|
1073
|
+
* response, and nothing else has one. To refresh cached data from a
|
|
1074
|
+
* `route.ts` handler, a webhook, or a job, use `revalidateTag()` or
|
|
1075
|
+
* `cache.invalidate()`.
|
|
1076
|
+
*
|
|
1077
|
+
* @param path - The path to re-render (e.g. '/dashboard', '/todos').
|
|
1078
|
+
*/
|
|
1079
|
+
function revalidatePath(path) {
|
|
1080
|
+
const state = revalidationAls.getStore();
|
|
1081
|
+
if (!state || state.closed) throw new Error("revalidatePath() can only be called inside a server action: it re-renders the route into the action response, and there is no action response here. To refresh cached data from a route handler or other server code, call revalidateTag() or cache.invalidate() for the tags the route reads.");
|
|
1082
|
+
if (!state.paths.includes(path)) state.paths.push(path);
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Invalidate all timber.cache entries tagged with `tag`, and tombstone the
|
|
1086
|
+
* pre-rendered component seeds that carry it.
|
|
1087
|
+
* Does not return a payload — the next request for an invalidated entry re-executes.
|
|
1088
|
+
*
|
|
1089
|
+
* Callable from any server code. Inside a server action the invalidation is
|
|
1090
|
+
* deferred until the action body returns, so a `revalidatePath()` render in
|
|
1091
|
+
* the same action reads fresh data; the returned promise resolves at once.
|
|
1092
|
+
* Anywhere else — a `route.ts` webhook, a job, or background work an action
|
|
1093
|
+
* started that runs after the action body returned — it is
|
|
1094
|
+
* `cache.invalidate({ tag })`, and the promise settles when the invalidation
|
|
1095
|
+
* has. Await it before responding.
|
|
1096
|
+
*
|
|
1097
|
+
* @param tag - The cache tag to invalidate (e.g. 'products', 'user:123').
|
|
1098
|
+
*/
|
|
1099
|
+
function revalidateTag(tag) {
|
|
1100
|
+
const state = revalidationAls.getStore();
|
|
1101
|
+
if (!state || state.closed) return cache.invalidate({ tag });
|
|
1102
|
+
if (!state.tags.includes(tag)) state.tags.push(tag);
|
|
1103
|
+
return Promise.resolve();
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Execute a server action and process revalidation.
|
|
1107
|
+
*
|
|
1108
|
+
* 1. Sets up revalidation state
|
|
1109
|
+
* 2. Calls the action function
|
|
1110
|
+
* 3. Processes revalidateTag calls (invalidates cache entries)
|
|
1111
|
+
* 4. Processes revalidatePath calls (re-renders and captures RSC payload)
|
|
1112
|
+
* 5. Returns the action result + optional RSC payload
|
|
1113
|
+
*
|
|
1114
|
+
* @param actionFn - The server action function to execute.
|
|
1115
|
+
* @param args - Arguments to pass to the action.
|
|
1116
|
+
* @param config - Handler configuration (cache handler, renderer).
|
|
1117
|
+
*/
|
|
1118
|
+
async function executeAction(actionFn, args, config = {}, spanMeta) {
|
|
1119
|
+
const state = {
|
|
1120
|
+
paths: [],
|
|
1121
|
+
tags: []
|
|
1122
|
+
};
|
|
1123
|
+
const revalidationErrors = [];
|
|
1124
|
+
let actionResult;
|
|
1125
|
+
let redirectTo;
|
|
1126
|
+
let redirectStatus;
|
|
1127
|
+
await revalidationAls.run(state, async () => {
|
|
1128
|
+
try {
|
|
1129
|
+
actionResult = await withSpan("timber.action", {
|
|
1130
|
+
...spanMeta?.actionFile ? { "timber.action_file": spanMeta.actionFile } : {},
|
|
1131
|
+
...spanMeta?.actionName ? { "timber.action_name": spanMeta.actionName } : {}
|
|
1132
|
+
}, () => actionFn(...args));
|
|
1133
|
+
} catch (error) {
|
|
1134
|
+
if (isRedirectSignal(error)) {
|
|
1135
|
+
redirectTo = error.location;
|
|
1136
|
+
redirectStatus = error.status;
|
|
1137
|
+
} else throw error;
|
|
1138
|
+
} finally {
|
|
1139
|
+
state.closed = true;
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
if (state.tags.length > 0) {
|
|
1143
|
+
const results = await Promise.allSettled(state.tags.map((tag) => cache.invalidate({ tag })));
|
|
1144
|
+
for (const r of results) if (r.status === "rejected") {
|
|
1145
|
+
console.error("[timber] revalidateTag invalidation failed:", r.reason);
|
|
1146
|
+
revalidationErrors.push(r.reason);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
let revalidation;
|
|
1150
|
+
const { requestPathname, requestSearch } = config;
|
|
1151
|
+
const isCurrentPage = (path) => !requestPathname || revalidationPathMatches(path, requestPathname, requestSearch);
|
|
1152
|
+
const path = state.paths.find(isCurrentPage);
|
|
1153
|
+
const onlyOtherPagesNamed = state.paths.length > 0 && path === void 0;
|
|
1154
|
+
if (path !== void 0 && config.renderer) try {
|
|
1155
|
+
revalidation = await config.renderer(path);
|
|
1156
|
+
} catch (renderError) {
|
|
1157
|
+
if (isRedirectSignal(renderError)) {
|
|
1158
|
+
redirectTo = renderError.location;
|
|
1159
|
+
redirectStatus = renderError.status;
|
|
1160
|
+
} else if (isDenySignal(renderError)) console.error(`[timber] revalidatePath dropped — target middleware denied (status ${renderError.status})`);
|
|
1161
|
+
else if (renderError instanceof RevalidationDropped) console.error(`[timber] ${renderError.message}`);
|
|
1162
|
+
else {
|
|
1163
|
+
console.error("[timber] revalidatePath render failed:", renderError);
|
|
1164
|
+
revalidationErrors.push(renderError);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
return {
|
|
1168
|
+
actionResult,
|
|
1169
|
+
revalidation,
|
|
1170
|
+
onlyOtherPagesNamed,
|
|
1171
|
+
revalidationErrors,
|
|
1172
|
+
...redirectTo ? {
|
|
1173
|
+
redirectTo,
|
|
1174
|
+
redirectStatus
|
|
1175
|
+
} : {}
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Check if a `revalidatePath(path)` argument matches the request pathname.
|
|
1180
|
+
* Canonicalizes the revalidated path the same way the renderer does so
|
|
1181
|
+
* equivalent paths compare equal. Returns true when the paths match or
|
|
1182
|
+
* when comparison is inconclusive (validation failure → render to be safe).
|
|
1183
|
+
*/
|
|
1184
|
+
function revalidationPathMatches(revalidatedPath, requestPathname, requestSearch) {
|
|
1185
|
+
const hashIdx = revalidatedPath.indexOf("#");
|
|
1186
|
+
const noFragment = hashIdx >= 0 ? revalidatedPath.slice(0, hashIdx) : revalidatedPath;
|
|
1187
|
+
const queryIdx = noFragment.indexOf("?");
|
|
1188
|
+
const pathnameOnly = queryIdx >= 0 ? noFragment.slice(0, queryIdx) : noFragment;
|
|
1189
|
+
const search = queryIdx >= 0 ? noFragment.slice(queryIdx) : "";
|
|
1190
|
+
const canonical = canonicalize(pathnameOnly, true);
|
|
1191
|
+
if (!canonical.ok) return true;
|
|
1192
|
+
if (canonical.pathname !== requestPathname) return false;
|
|
1193
|
+
if (search && search !== (requestSearch ?? "")) return false;
|
|
1194
|
+
return true;
|
|
1195
|
+
}
|
|
1196
|
+
//#endregion
|
|
1197
|
+
export { setMutableCookieContext as C, setMatchedSegmentPath as S, runOutsideReactCacheScope as T, getHeaders as _, parseFormData as a, markResponseFlushed as b, deny as c, waitUntil as d, getCookie as f, getHeader as g, applyRequestHeaderOverlay as h, coerce as i, redirect as l, getSetCookieHeaders as m, revalidatePath as n, DenySignal as o, getCookieJar as p, revalidateTag as r, RedirectSignal as s, executeAction as t, redirectExternal as u, getSearchParams as v, setSegmentParams as w, runWithRequestContext as x, getSegmentParams as y };
|
|
1198
|
+
|
|
1199
|
+
//# sourceMappingURL=actions-Rjk4htmA.js.map
|