@timber-js/app 0.2.0-alpha.207 → 0.2.0-alpha.209
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{primitives-DLAnvsrk.js → actions-BerlqoXA.js} +640 -410
- package/dist/_chunks/actions-BerlqoXA.js.map +1 -0
- package/dist/_chunks/{als-registry-C6kcfprT.js → als-registry-DaxkVjt5.js} +6 -2
- package/dist/_chunks/als-registry-DaxkVjt5.js.map +1 -0
- package/dist/_chunks/{build-manifest-DTmSGLRz.js → build-manifest-DWppEdLB.js} +2 -51
- package/dist/_chunks/build-manifest-DWppEdLB.js.map +1 -0
- package/dist/_chunks/{build-output-helper-9dqCv1pZ.js → build-output-helper-RV_BRcF1.js} +50 -53
- package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +1 -0
- package/dist/_chunks/{cache-api-CUD9Ezaq.js → cache-api-CR23J_NC.js} +64 -32
- package/dist/_chunks/cache-api-CR23J_NC.js.map +1 -0
- package/dist/_chunks/{chains-B4bgOl2g.js → chains-CpFg56UB.js} +2 -2
- package/dist/_chunks/{chains-B4bgOl2g.js.map → chains-CpFg56UB.js.map} +1 -1
- package/dist/_chunks/{cli-check-G8o30ldg.js → cli-check-C6Ev6wBO.js} +11 -52
- package/dist/_chunks/cli-check-C6Ev6wBO.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--LZKs8Zn.js → cli-schema-sync-CbT2AUUI.js} +3 -3
- package/dist/_chunks/{cli-schema-sync--LZKs8Zn.js.map → cli-schema-sync-CbT2AUUI.js.map} +1 -1
- package/dist/_chunks/{cloudflare-BFb__LYG.js → cloudflare-Byxl8FWP.js} +96 -53
- package/dist/_chunks/{cloudflare-BFb__LYG.js.map → cloudflare-Byxl8FWP.js.map} +1 -1
- package/dist/_chunks/{convention-lint-5KzoMg_A.js → convention-lint-jKTwKwPe.js} +21 -6
- package/dist/_chunks/convention-lint-jKTwKwPe.js.map +1 -0
- package/dist/_chunks/{dev-server-BzBxgYAV.js → dev-server-C4WZdB7L.js} +15 -167
- package/dist/_chunks/dev-server-C4WZdB7L.js.map +1 -0
- package/dist/_chunks/{error-boundary-BndF-3Td.js → error-boundary-tA7kVfs4.js} +84 -104
- package/dist/_chunks/error-boundary-tA7kVfs4.js.map +1 -0
- package/dist/_chunks/{fs-identity-D7vb6GdI.js → fs-identity-BRKuL215.js} +3 -4
- package/dist/_chunks/fs-identity-BRKuL215.js.map +1 -0
- package/dist/_chunks/{graph-cache-CP4GEmf9.js → graph-cache-CYiUS2aS.js} +4 -5
- package/dist/_chunks/graph-cache-CYiUS2aS.js.map +1 -0
- package/dist/_chunks/{json-lossy-check-ClNvBM_3.js → json-lossy-check-ip0Qi0MT.js} +6 -3
- package/dist/_chunks/json-lossy-check-ip0Qi0MT.js.map +1 -0
- package/dist/_chunks/{live-graph-Bm5WTvcr.js → live-graph-Dv-JJCZw.js} +3 -3
- package/dist/_chunks/{live-graph-Bm5WTvcr.js.map → live-graph-Dv-JJCZw.js.map} +1 -1
- package/dist/_chunks/{logger-k2DQ4EUf.js → logger-DiDt5ppH.js} +192 -51
- package/dist/_chunks/logger-DiDt5ppH.js.map +1 -0
- package/dist/_chunks/{navigation-root-mHSK9psY.js → navigation-root-BQfo1-kG.js} +2 -2
- package/dist/_chunks/{navigation-root-mHSK9psY.js.map → navigation-root-BQfo1-kG.js.map} +1 -1
- package/dist/_chunks/{plugin-context-8idfR3UZ.js → plugin-context-BPBPc3lL.js} +28 -4
- package/dist/_chunks/plugin-context-BPBPc3lL.js.map +1 -0
- package/dist/_chunks/{poison-scan-DG5eI2_z.js → poison-scan-CpeT6_OJ.js} +2 -2
- package/dist/_chunks/{poison-scan-DG5eI2_z.js.map → poison-scan-CpeT6_OJ.js.map} +1 -1
- package/dist/_chunks/render-timeout-DOf_BBcO.js +46 -0
- package/dist/_chunks/render-timeout-DOf_BBcO.js.map +1 -0
- package/dist/_chunks/{rsc-payload-path-B_LBodc2.js → rsc-payload-path-dffcs4jp.js} +9 -3
- package/dist/_chunks/{rsc-payload-path-B_LBodc2.js.map → rsc-payload-path-dffcs4jp.js.map} +1 -1
- package/dist/_chunks/{scanner-BQ5sPIJ7.js → scanner-Bw0oq1HB.js} +2 -2
- package/dist/_chunks/{scanner-BQ5sPIJ7.js.map → scanner-Bw0oq1HB.js.map} +1 -1
- package/dist/_chunks/{navigation-context-D0TU0Jog.js → segment-context-xtPUGfdq.js} +36 -34
- package/dist/_chunks/segment-context-xtPUGfdq.js.map +1 -0
- package/dist/_chunks/{singleflight-2lUWfcAk.js → singleflight-BeVMMKi0.js} +4 -3
- package/dist/_chunks/{singleflight-2lUWfcAk.js.map → singleflight-BeVMMKi0.js.map} +1 -1
- package/dist/_chunks/{sizeof-lXffQ1Vr.js → sizeof-UwzwB1uM.js} +3 -2
- package/dist/_chunks/sizeof-UwzwB1uM.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-FippDgxN.js → state-BhNGPsdi.js} +6 -8
- package/dist/_chunks/state-BhNGPsdi.js.map +1 -0
- package/dist/_chunks/{status-page-marker-DwQBrLBz.js → status-page-marker-gaihi0KZ.js} +140 -28
- package/dist/_chunks/status-page-marker-gaihi0KZ.js.map +1 -0
- package/dist/_chunks/{walkers-CN2N_bA-.js → walkers-BXExhzzk.js} +2 -2
- package/dist/_chunks/{walkers-CN2N_bA-.js.map → walkers-BXExhzzk.js.map} +1 -1
- 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 +7 -7
- package/dist/adapters/build-output-helper.d.ts.map +1 -1
- package/dist/adapters/canonicalize-module.d.ts +8 -0
- package/dist/adapters/canonicalize-module.d.ts.map +1 -0
- package/dist/adapters/cloudflare-dev.js +1 -1
- package/dist/adapters/cloudflare-kv-cache.js +2 -2
- package/dist/adapters/cloudflare.d.ts +30 -8
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +2 -2
- package/dist/adapters/compress-module.d.ts +8 -0
- package/dist/adapters/compress-module.d.ts.map +1 -1
- package/dist/adapters/fs-identity.d.ts +2 -3
- package/dist/adapters/fs-identity.d.ts.map +1 -1
- package/dist/adapters/nitro-presets.d.ts +0 -6
- package/dist/adapters/nitro-presets.d.ts.map +1 -1
- package/dist/adapters/nitro-preview.d.ts +43 -11
- package/dist/adapters/nitro-preview.d.ts.map +1 -1
- package/dist/adapters/nitro.d.ts +1 -13
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +291 -176
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/shared.d.ts +7 -2
- package/dist/adapters/shared.d.ts.map +1 -1
- package/dist/adapters/types.d.ts +105 -21
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/adapters/types.js +0 -0
- package/dist/analyze/crawl-entry.js +3 -3
- package/dist/analyze/graph-cache.d.ts.map +1 -1
- package/dist/analyze/graph-command.js +4 -4
- package/dist/cache/index.js +2 -2
- package/dist/cache/json-lossy-check.d.ts.map +1 -1
- package/dist/cache/singleflight.d.ts.map +1 -1
- package/dist/cache/sizeof.d.ts.map +1 -1
- package/dist/cache/stores/memory.js +1 -1
- package/dist/cache/tag-aware-handler.d.ts.map +1 -1
- package/dist/cdn/workers-cache-purge.js +1 -1
- package/dist/cli-check.d.ts +7 -37
- package/dist/cli-check.d.ts.map +1 -1
- package/dist/cli-context.d.ts +54 -0
- package/dist/cli-context.d.ts.map +1 -0
- package/dist/cli.d.ts +9 -9
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +20 -24
- package/dist/cli.js.map +1 -1
- package/dist/client/browser-dev.d.ts +1 -1
- package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -1
- package/dist/client/browser-entry/hydrate.d.ts +19 -29
- package/dist/client/browser-entry/hydrate.d.ts.map +1 -1
- package/dist/client/browser-entry/index.d.ts +7 -7
- package/dist/client/browser-entry/post-hydration.d.ts +6 -9
- package/dist/client/browser-entry/post-hydration.d.ts.map +1 -1
- package/dist/client/browser-entry/router-init.d.ts +6 -11
- package/dist/client/browser-entry/router-init.d.ts.map +1 -1
- package/dist/client/error-boundary.d.ts +4 -3
- package/dist/client/error-boundary.d.ts.map +1 -1
- package/dist/client/error-boundary.js +1 -1
- package/dist/client/error-reconstituter.d.ts +3 -9
- package/dist/client/error-reconstituter.d.ts.map +1 -1
- package/dist/client/history.d.ts +20 -11
- package/dist/client/history.d.ts.map +1 -1
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +5 -6
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +3 -3
- package/dist/client/internal.d.ts.map +1 -1
- package/dist/client/internal.js +95 -108
- package/dist/client/internal.js.map +1 -1
- package/dist/client/navigation-commit.d.ts +20 -7
- package/dist/client/navigation-commit.d.ts.map +1 -1
- package/dist/client/navigation-context.d.ts +3 -5
- package/dist/client/navigation-context.d.ts.map +1 -1
- package/dist/client/react-root.d.ts +3 -2
- package/dist/client/react-root.d.ts.map +1 -1
- package/dist/client/router-pipeline.d.ts +3 -8
- package/dist/client/router-pipeline.d.ts.map +1 -1
- package/dist/client/router-types.d.ts +45 -39
- package/dist/client/router-types.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/client/rsc-fetch.d.ts +8 -4
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +44 -4
- package/dist/client/segment-cache.d.ts.map +1 -1
- package/dist/client/ssr-data.d.ts +18 -64
- package/dist/client/ssr-data.d.ts.map +1 -1
- package/dist/client/state.d.ts +2 -5
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/use-pathname.d.ts +1 -1
- package/dist/config-types.d.ts +2 -1
- package/dist/config-types.d.ts.map +1 -1
- package/dist/config-validation.d.ts.map +1 -1
- package/dist/cookies/index.js +1 -1
- package/dist/dev-tools/dev-page-shell.d.ts +17 -0
- package/dist/dev-tools/dev-page-shell.d.ts.map +1 -1
- package/dist/dev-tools/index.d.ts +1 -1
- package/dist/dev-tools/index.d.ts.map +1 -1
- package/dist/dev-tools/instrumentation.d.ts +17 -2
- package/dist/dev-tools/instrumentation.d.ts.map +1 -1
- package/dist/dev-tools/overlay.d.ts +6 -27
- package/dist/dev-tools/overlay.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +632 -373
- package/dist/index.js.map +1 -1
- package/dist/plugin-context.d.ts +26 -40
- package/dist/plugin-context.d.ts.map +1 -1
- package/dist/plugins/build-manifest.d.ts.map +1 -1
- package/dist/plugins/build-report.d.ts +15 -2
- package/dist/plugins/build-report.d.ts.map +1 -1
- package/dist/plugins/dev-server.d.ts.map +1 -1
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/plugins/fonts.d.ts +19 -1
- package/dist/plugins/fonts.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 +11 -4
- package/dist/plugins/prebuilt-capture.d.ts.map +1 -1
- package/dist/plugins/prebuilt.d.ts +17 -1
- package/dist/plugins/prebuilt.d.ts.map +1 -1
- package/dist/plugins/prerender-sugar.d.ts.map +1 -1
- package/dist/plugins/react-resolve.d.ts +49 -0
- package/dist/plugins/react-resolve.d.ts.map +1 -0
- package/dist/plugins/rsc-assets-manifest.d.ts +33 -0
- package/dist/plugins/rsc-assets-manifest.d.ts.map +1 -0
- package/dist/plugins/shims.d.ts.map +1 -1
- package/dist/plugins/static-build.d.ts +32 -9
- package/dist/plugins/static-build.d.ts.map +1 -1
- package/dist/routing/codegen-write.d.ts +0 -9
- package/dist/routing/codegen-write.d.ts.map +1 -1
- package/dist/routing/index.js +2 -2
- package/dist/routing/segment-codegen.d.ts.map +1 -1
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/action-handler.d.ts +5 -4
- package/dist/server/action-handler.d.ts.map +1 -1
- package/dist/server/actions.d.ts +46 -7
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +58 -5
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/children-interception.d.ts.map +1 -1
- package/dist/server/cookie-context.d.ts +2 -23
- package/dist/server/cookie-context.d.ts.map +1 -1
- package/dist/server/csp-nonce.d.ts +0 -9
- package/dist/server/csp-nonce.d.ts.map +1 -1
- package/dist/server/csrf.d.ts +27 -4
- 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 +2 -1
- package/dist/server/default-logger.d.ts.map +1 -1
- package/dist/server/deny-boundary.d.ts +12 -6
- package/dist/server/deny-boundary.d.ts.map +1 -1
- package/dist/server/deny-renderer.d.ts +2 -2
- package/dist/server/deny-renderer.d.ts.map +1 -1
- package/dist/server/error-boundary-wrapper.d.ts +7 -3
- package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
- package/dist/server/fallback-error.d.ts +9 -2
- package/dist/server/fallback-error.d.ts.map +1 -1
- package/dist/server/head-response.d.ts +4 -4
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/index.d.ts +0 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/instrumentation.d.ts +10 -3
- package/dist/server/instrumentation.d.ts.map +1 -1
- package/dist/server/internal.d.ts +1 -4
- package/dist/server/internal.d.ts.map +1 -1
- package/dist/server/internal.js +961 -581
- package/dist/server/internal.js.map +1 -1
- 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 +26 -0
- package/dist/server/logger.d.ts.map +1 -1
- package/dist/server/param-coercion.d.ts +11 -6
- package/dist/server/param-coercion.d.ts.map +1 -1
- package/dist/server/pipeline-helpers.d.ts +95 -7
- package/dist/server/pipeline-helpers.d.ts.map +1 -1
- package/dist/server/pipeline-interception.d.ts +11 -0
- package/dist/server/pipeline-interception.d.ts.map +1 -1
- package/dist/server/pipeline-outcome.d.ts +11 -1
- package/dist/server/pipeline-outcome.d.ts.map +1 -1
- package/dist/server/pipeline-phases.d.ts +2 -2
- package/dist/server/pipeline-phases.d.ts.map +1 -1
- package/dist/server/pipeline.d.ts +23 -35
- package/dist/server/pipeline.d.ts.map +1 -1
- 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 +79 -35
- package/dist/server/prebuilt/capture-state.d.ts.map +1 -1
- package/dist/server/prebuilt/lifetime.d.ts +38 -0
- package/dist/server/prebuilt/lifetime.d.ts.map +1 -0
- package/dist/server/prebuilt/slots.d.ts +7 -0
- package/dist/server/prebuilt/slots.d.ts.map +1 -1
- package/dist/server/prebuilt/synthetic-store.d.ts.map +1 -1
- package/dist/server/prebuilt-builder.d.ts.map +1 -1
- package/dist/server/prebuilt-runtime.d.ts.map +1 -1
- package/dist/server/primitives.d.ts +6 -81
- package/dist/server/primitives.d.ts.map +1 -1
- 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 +15 -0
- package/dist/server/render-timeout.d.ts.map +1 -1
- package/dist/server/render-utils.d.ts +9 -0
- package/dist/server/render-utils.d.ts.map +1 -1
- package/dist/server/request-context.d.ts +26 -5
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/route-handler.d.ts.map +1 -1
- package/dist/server/route-matcher.d.ts +7 -0
- package/dist/server/route-matcher.d.ts.map +1 -1
- package/dist/server/rsc-entry/action-middleware-runner.d.ts +22 -22
- package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -1
- package/dist/server/rsc-entry/api-handler.d.ts +7 -0
- package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
- package/dist/server/rsc-entry/deny-fallback.d.ts +32 -6
- package/dist/server/rsc-entry/deny-fallback.d.ts.map +1 -1
- package/dist/server/rsc-entry/error-renderer.d.ts +11 -18
- package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/helpers.d.ts +0 -1
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts +5 -15
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts +5 -6
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
- 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 +6 -16
- package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-payload.d.ts +7 -3
- package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts +8 -53
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts +2 -2
- package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +9 -4
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +1 -1
- package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -1
- package/dist/server/signal-identity.d.ts +43 -0
- package/dist/server/signal-identity.d.ts.map +1 -0
- package/dist/server/slot-resolver.d.ts +4 -3
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/slot-subtree-contain.d.ts.map +1 -1
- package/dist/server/ssr-bridge-types.d.ts +91 -53
- package/dist/server/ssr-bridge-types.d.ts.map +1 -1
- package/dist/server/ssr-entry.d.ts +8 -5
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-render.d.ts +26 -40
- package/dist/server/ssr-render.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts +1 -1
- package/dist/server/static-generator.d.ts.map +1 -1
- package/dist/server/stream-utils.d.ts +12 -0
- package/dist/server/stream-utils.d.ts.map +1 -1
- package/dist/server/tracing.d.ts +12 -16
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/server/types.d.ts +1 -1
- package/dist/server/version-skew.d.ts +3 -3
- 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/payload-root.d.ts +11 -10
- package/dist/shared/payload-root.d.ts.map +1 -1
- package/dist/shared/rsc-payload-path.d.ts +6 -0
- package/dist/shared/rsc-payload-path.d.ts.map +1 -1
- 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 +17 -14
- package/docs/api/32-api-cache.mdx +51 -23
- package/docs/api/34-api-config.mdx +34 -6
- package/docs/api/36-cli.mdx +11 -1
- package/docs/learn/03-fetching-data.mdx +17 -1
- package/docs/learn/04-access-control.mdx +1 -1
- package/docs/learn/10-caching.mdx +29 -11
- package/docs/learn/11-middleware.mdx +8 -2
- package/docs/learn/12-error-handling.mdx +6 -1
- package/package.json +7 -3
- package/src/adapters/build-output-helper.ts +55 -53
- package/src/adapters/canonicalize-module.ts +29 -0
- package/src/adapters/cloudflare.ts +105 -63
- package/src/adapters/compress-module.ts +16 -5
- package/src/adapters/fs-identity.ts +2 -3
- package/src/adapters/nitro-presets.ts +0 -15
- package/src/adapters/nitro-preview.ts +272 -136
- package/src/adapters/nitro.ts +119 -82
- package/src/adapters/shared.ts +23 -14
- package/src/adapters/types.ts +110 -21
- package/src/analyze/graph-cache.ts +3 -4
- package/src/cache/json-lossy-check.ts +3 -9
- package/src/cache/singleflight.ts +5 -2
- package/src/cache/sizeof.ts +3 -1
- package/src/cache/tag-aware-handler.ts +43 -26
- package/src/cli-check.ts +8 -98
- package/src/cli-context.ts +119 -0
- package/src/cli.ts +19 -28
- package/src/client/browser-dev.ts +1 -1
- package/src/client/browser-entry/action-dispatch.ts +26 -4
- package/src/client/browser-entry/hydrate.ts +53 -58
- package/src/client/browser-entry/index.ts +16 -27
- package/src/client/browser-entry/post-hydration.ts +6 -40
- package/src/client/browser-entry/router-init.ts +66 -84
- package/src/client/error-boundary.tsx +9 -41
- package/src/client/error-reconstituter.tsx +10 -5
- package/src/client/history.ts +35 -21
- package/src/client/index.ts +0 -1
- package/src/client/internal.ts +2 -7
- package/src/client/navigation-commit.ts +41 -18
- package/src/client/navigation-context.ts +3 -39
- package/src/client/react-root.ts +3 -2
- package/src/client/router-pipeline.ts +96 -132
- package/src/client/router-types.ts +46 -44
- package/src/client/router-url.ts +32 -0
- package/src/client/router.ts +62 -21
- package/src/client/rsc-fetch.ts +117 -155
- package/src/client/segment-cache.ts +110 -11
- package/src/client/ssr-data.ts +19 -80
- package/src/client/state.ts +2 -9
- package/src/client/use-pathname.ts +1 -1
- package/src/config-types.ts +2 -1
- package/src/config-validation.ts +2 -1
- package/src/dev-tools/dev-page-shell.ts +18 -0
- package/src/dev-tools/index.ts +0 -2
- package/src/dev-tools/instrumentation.ts +50 -2
- package/src/dev-tools/overlay.ts +8 -238
- package/src/index.ts +26 -14
- package/src/plugin-context.ts +39 -40
- package/src/plugins/build-manifest.ts +4 -11
- package/src/plugins/build-report.ts +70 -70
- package/src/plugins/dev-server.ts +24 -44
- package/src/plugins/entries.ts +2 -1
- package/src/plugins/fonts.ts +35 -7
- package/src/plugins/post-build.ts +327 -0
- package/src/plugins/prebuilt-capture.ts +28 -32
- package/src/plugins/prebuilt.ts +54 -39
- package/src/plugins/prerender-sugar.ts +0 -4
- package/src/plugins/react-resolve.ts +149 -0
- package/src/plugins/{adapter-build.ts → rsc-assets-manifest.ts} +20 -109
- package/src/plugins/shims.ts +1 -0
- package/src/plugins/static-build.ts +42 -74
- package/src/routing/codegen-write.ts +25 -3
- package/src/routing/segment-codegen.ts +3 -2
- package/src/rsc-runtime/vendor-types.d.ts +8 -0
- package/src/server/access-gate.tsx +2 -1
- package/src/server/action-client.ts +1 -1
- package/src/server/action-handler.ts +253 -110
- package/src/server/actions.ts +73 -25
- package/src/server/als-registry.ts +73 -5
- package/src/server/chain-url-parts.ts +1 -1
- package/src/server/children-interception.ts +2 -1
- package/src/server/cookie-context.ts +18 -48
- package/src/server/csp-nonce.ts +0 -12
- package/src/server/csrf.ts +140 -8
- package/src/server/debug.ts +0 -1
- package/src/server/default-logger.ts +2 -1
- package/src/server/deny-boundary.ts +25 -13
- package/src/server/deny-renderer.ts +30 -97
- package/src/server/error-boundary-wrapper.ts +7 -3
- package/src/server/fallback-error.ts +26 -11
- package/src/server/flight-scripts.ts +1 -1
- package/src/server/head-response.ts +4 -4
- package/src/server/html-injector-core.ts +2 -2
- package/src/server/html-injectors.ts +2 -4
- package/src/server/index.ts +0 -4
- package/src/server/instrumentation.ts +10 -3
- package/src/server/internal.ts +1 -6
- package/src/server/json-status-response.ts +105 -0
- package/src/server/logger.ts +39 -3
- package/src/server/param-coercion.ts +15 -12
- package/src/server/pipeline-helpers.ts +257 -12
- package/src/server/pipeline-interception.ts +133 -0
- package/src/server/pipeline-outcome.ts +103 -31
- package/src/server/pipeline-phases.ts +127 -237
- package/src/server/pipeline.ts +204 -207
- 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 +155 -48
- package/src/server/prebuilt/lifetime.ts +151 -0
- package/src/server/prebuilt/slots.ts +14 -2
- package/src/server/prebuilt/synthetic-store.ts +3 -0
- package/src/server/prebuilt-builder.ts +30 -320
- package/src/server/prebuilt-runtime.ts +125 -129
- package/src/server/primitives.ts +8 -168
- package/src/server/react-cache-bridge.ts +124 -0
- package/src/server/react-cache-scope.ts +104 -0
- package/src/server/render-timeout.ts +20 -0
- package/src/server/render-utils.ts +11 -1
- package/src/server/request-context.ts +36 -9
- package/src/server/route-element-builder.ts +11 -6
- package/src/server/route-handler.ts +36 -23
- package/src/server/route-matcher.ts +15 -1
- package/src/server/rsc-entry/action-middleware-runner.ts +79 -123
- package/src/server/rsc-entry/api-handler.ts +27 -103
- package/src/server/rsc-entry/deny-fallback.ts +93 -26
- package/src/server/rsc-entry/error-renderer.ts +39 -91
- package/src/server/rsc-entry/helpers.ts +2 -4
- package/src/server/rsc-entry/index.ts +64 -58
- package/src/server/rsc-entry/render-route.ts +15 -80
- package/src/server/rsc-entry/render-signals.ts +108 -0
- package/src/server/rsc-entry/revalidate-renderer.ts +56 -57
- package/src/server/rsc-entry/rsc-payload.ts +28 -61
- package/src/server/rsc-entry/rsc-stream.ts +113 -213
- package/src/server/rsc-entry/ssr-bridge.ts +2 -2
- package/src/server/rsc-entry/ssr-renderer.ts +182 -263
- package/src/server/rsc-entry/wrap-action-dispatch.ts +12 -14
- package/src/server/signal-identity.ts +112 -0
- package/src/server/slot-resolver.ts +18 -18
- package/src/server/slot-subtree-contain.ts +2 -1
- package/src/server/ssr-bridge-types.ts +92 -56
- package/src/server/ssr-entry.ts +87 -111
- package/src/server/ssr-render.ts +55 -64
- package/src/server/ssr-wrappers.tsx +2 -2
- package/src/server/static-generator.ts +7 -42
- package/src/server/static-not-found.ts +3 -3
- package/src/server/stream-utils.ts +51 -0
- package/src/server/tracing.ts +58 -75
- package/src/server/types.ts +1 -1
- package/src/server/version-skew.ts +5 -5
- package/src/shared/csrf-reject.ts +15 -0
- package/src/shared/error-digest.ts +46 -0
- package/src/shared/payload-root.ts +11 -10
- package/src/shared/rsc-payload-path.ts +8 -1
- package/src/utils/write-file-atomic.ts +32 -0
- package/dist/_chunks/actions-jNrXdzgs.js +0 -346
- package/dist/_chunks/actions-jNrXdzgs.js.map +0 -1
- package/dist/_chunks/als-registry-C6kcfprT.js.map +0 -1
- package/dist/_chunks/build-manifest-DTmSGLRz.js.map +0 -1
- package/dist/_chunks/build-output-helper-9dqCv1pZ.js.map +0 -1
- package/dist/_chunks/cache-api-CUD9Ezaq.js.map +0 -1
- package/dist/_chunks/cli-check-G8o30ldg.js.map +0 -1
- package/dist/_chunks/convention-lint-5KzoMg_A.js.map +0 -1
- package/dist/_chunks/dev-server-BzBxgYAV.js.map +0 -1
- package/dist/_chunks/error-boundary-BndF-3Td.js.map +0 -1
- package/dist/_chunks/fs-identity-D7vb6GdI.js.map +0 -1
- package/dist/_chunks/graph-cache-CP4GEmf9.js.map +0 -1
- package/dist/_chunks/json-lossy-check-ClNvBM_3.js.map +0 -1
- package/dist/_chunks/logger-k2DQ4EUf.js.map +0 -1
- package/dist/_chunks/navigation-context-D0TU0Jog.js.map +0 -1
- package/dist/_chunks/plugin-context-8idfR3UZ.js.map +0 -1
- package/dist/_chunks/primitives-DLAnvsrk.js.map +0 -1
- package/dist/_chunks/segment-context-D9_89u34.js +0 -34
- package/dist/_chunks/segment-context-D9_89u34.js.map +0 -1
- package/dist/_chunks/sizeof-lXffQ1Vr.js.map +0 -1
- package/dist/_chunks/ssr-data-D6T6Y3ef.js +0 -60
- package/dist/_chunks/ssr-data-D6T6Y3ef.js.map +0 -1
- package/dist/_chunks/state-FippDgxN.js.map +0 -1
- package/dist/_chunks/status-page-marker-DwQBrLBz.js.map +0 -1
- package/dist/client/types.d.ts +0 -14
- package/dist/client/types.d.ts.map +0 -1
- package/dist/plugins/adapter-build.d.ts +0 -38
- package/dist/plugins/adapter-build.d.ts.map +0 -1
- package/dist/server/asset-headers.d.ts +0 -32
- package/dist/server/asset-headers.d.ts.map +0 -1
- package/dist/server/dev-source-map.d.ts +0 -22
- package/dist/server/dev-source-map.d.ts.map +0 -1
- package/src/client/types.ts +0 -21
- package/src/server/asset-headers.ts +0 -59
- package/src/server/dev-source-map.ts +0 -31
package/dist/server/tracing.d.ts
CHANGED
|
@@ -33,16 +33,12 @@ export declare function generateTraceId(): string;
|
|
|
33
33
|
*/
|
|
34
34
|
export declare function runWithTraceId<T>(id: string, fn: () => T): T;
|
|
35
35
|
/**
|
|
36
|
-
* Replace the trace ID
|
|
37
|
-
*
|
|
38
|
-
*
|
|
36
|
+
* Replace the request's trace ID. Used when OTEL creates the root span and
|
|
37
|
+
* we want to switch from the UUID fallback to the real OTEL trace ID. Writes
|
|
38
|
+
* the request's shared trace, so every scope in the request sees it —
|
|
39
|
+
* including the ones outside the span this runs in.
|
|
39
40
|
*/
|
|
40
|
-
export declare function replaceTraceId(newTraceId: string
|
|
41
|
-
/**
|
|
42
|
-
* Update the span ID in the current ALS store. Used when entering a new
|
|
43
|
-
* OTEL span to keep log–trace correlation accurate.
|
|
44
|
-
*/
|
|
45
|
-
export declare function updateSpanId(newSpanId: string | undefined): void;
|
|
41
|
+
export declare function replaceTraceId(newTraceId: string): void;
|
|
46
42
|
/**
|
|
47
43
|
* Get the current trace store, or undefined if outside a request context.
|
|
48
44
|
* Framework-internal — use getTraceId()/getSpanId() in user code.
|
|
@@ -57,7 +53,8 @@ export declare function getTraceStore(): TraceStore | undefined;
|
|
|
57
53
|
* we create a BasicTracerProvider with our processor.
|
|
58
54
|
*
|
|
59
55
|
* Idempotent across module re-evaluations (HMR) — only the first call
|
|
60
|
-
* registers.
|
|
56
|
+
* registers. Called in dev, and in production only when TIMBER_DEBUG is
|
|
57
|
+
* set — otherwise production never loads the OTEL SDK.
|
|
61
58
|
*/
|
|
62
59
|
export declare function initDevTracing(config: import('../dev-tools/logger.ts').DevLoggerConfig): Promise<void>;
|
|
63
60
|
/**
|
|
@@ -104,7 +101,8 @@ export declare function getTracer(): Promise<import('@opentelemetry/api').Tracer
|
|
|
104
101
|
*
|
|
105
102
|
* Automatically:
|
|
106
103
|
* - Creates the span as a child of the current context
|
|
107
|
-
* -
|
|
104
|
+
* - Runs fn in its own trace scope carrying the span's IDs, for log–trace
|
|
105
|
+
* correlation and setSpanAttribute()
|
|
108
106
|
* - Ends the span when the function completes
|
|
109
107
|
* - Records exceptions on error (OTEL channel)
|
|
110
108
|
*/
|
|
@@ -131,10 +129,8 @@ export declare function addSpanEvent(name: string, attributes?: Record<string, s
|
|
|
131
129
|
export declare function addSpanEventSync(name: string, attributes?: Record<string, string | number | boolean>): void;
|
|
132
130
|
/**
|
|
133
131
|
* Try to extract the OTEL trace ID from the current active span context.
|
|
134
|
-
* Returns undefined if OTEL is not active or no span exists.
|
|
132
|
+
* Returns undefined if OTEL is not active or no span exists. (The span ID
|
|
133
|
+
* reaches logs through the span's own trace scope, not from here.)
|
|
135
134
|
*/
|
|
136
|
-
export declare function getOtelTraceId(): Promise<
|
|
137
|
-
traceId: string;
|
|
138
|
-
spanId: string;
|
|
139
|
-
} | undefined>;
|
|
135
|
+
export declare function getOtelTraceId(): Promise<string | undefined>;
|
|
140
136
|
//# sourceMappingURL=tracing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../src/server/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG9D,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,MAAM,CASnC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAE9C;AAID;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAE5D;AAED
|
|
1
|
+
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../src/server/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG9D,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,MAAM,CASnC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAE9C;AAID;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAKvD;AAiBD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,UAAU,GAAG,SAAS,CAEtD;AAcD;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,OAAO,wBAAwB,EAAE,eAAe,GACvD,OAAO,CAAC,IAAI,CAAC,CAsBf;AAID;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CACnE;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,CAAC,GAAG,CAAC,CAAC;CAC9D;AAOD,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAE1E;AAED,qDAAqD;AACrD,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,SAAS,CAE9D;AA4BD;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,OAAO,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC,CAUrF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EACrD,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,OAAO,CAAC,CAAC,CAAC,CAeZ;AAwCD;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAC/B,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACrD,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACrD,IAAI,CASN;AAED;;;;GAIG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAclE"}
|
package/dist/server/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { EarlyHint } from './early-hints.ts';
|
|
|
3
3
|
/**
|
|
4
4
|
* A value that is safe to pass through `JSON.stringify` without data loss.
|
|
5
5
|
*
|
|
6
|
-
* Used as the constraint for `deny(status,
|
|
6
|
+
* Used as the constraint for `deny(status, { dangerouslyPassData })` data
|
|
7
7
|
* because the post-flush path serializes via JSON.stringify, not React Flight.
|
|
8
8
|
* Types that survive Flight (Date, Map, Set, BigInt) would silently coerce or
|
|
9
9
|
* throw when serialized as JSON. This type prevents that at compile time.
|
|
@@ -25,9 +25,9 @@ export declare const DEPLOYMENT_ID_HEADER = "X-Timber-Deployment-Id";
|
|
|
25
25
|
/** Response header that signals the client to do a full page reload. */
|
|
26
26
|
export declare const RELOAD_HEADER = "X-Timber-Reload";
|
|
27
27
|
/**
|
|
28
|
-
* Set the current deployment ID. Called once at server startup
|
|
29
|
-
*
|
|
30
|
-
* checks are skipped).
|
|
28
|
+
* Set the current deployment ID. Called once at server startup by the RSC
|
|
29
|
+
* entry's `createRequestHandler()`. In dev mode this is never called
|
|
30
|
+
* (deployment ID checks are skipped).
|
|
31
31
|
*/
|
|
32
32
|
export declare function setDeploymentId(id: string): void;
|
|
33
33
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marker header on CSRF rejections.
|
|
3
|
+
*
|
|
4
|
+
* A CSRF rejection is a 403, the same status as an access-control denial.
|
|
5
|
+
* The server stamps this header on every CSRF 403 so callers — the browser
|
|
6
|
+
* action runtime, a same-origin `fetch` in user code, a curl session — can
|
|
7
|
+
* tell the two apart without parsing the body. A cross-origin `fetch` cannot
|
|
8
|
+
* read it: the rejection returns before proxy.ts, so no CORS headers are set
|
|
9
|
+
* and the browser reports a network error instead. Shared so the server writer and the client
|
|
10
|
+
* reader cannot drift.
|
|
11
|
+
*
|
|
12
|
+
* See design/08-forms-and-actions.md §"CSRF Protection" (TIM-1459).
|
|
13
|
+
*/
|
|
14
|
+
export declare const CSRF_REJECT_HEADER = "X-Timber-Reject";
|
|
15
|
+
export declare const CSRF_REJECT_VALUE = "csrf";
|
|
16
|
+
//# sourceMappingURL=csrf-reject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csrf-reject.d.ts","sourceRoot":"","sources":["../../src/shared/csrf-reject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AACpD,eAAO,MAAM,iBAAiB,SAAS,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The digest an unhandled render error carries across Flight, and the
|
|
3
|
+
* correlation ID error pages read back out of it.
|
|
4
|
+
*
|
|
5
|
+
* Flight's `onError` (server/rsc-entry/rsc-stream.ts) returns this string for
|
|
6
|
+
* any error that is not a deny or redirect, and React sets it as `digest` on
|
|
7
|
+
* the Error it revives for that row, in SSR and on the client alike. The
|
|
8
|
+
* `errorId` is the one the server logged the error with, so an error page
|
|
9
|
+
* that shows it gives the reader something to quote that an operator can
|
|
10
|
+
* find. It is the `digest` prop every TSX error page receives.
|
|
11
|
+
*
|
|
12
|
+
* `message` is the real message only in dev; production sends a fixed string
|
|
13
|
+
* (design/13-security.md §"Errors don't leak").
|
|
14
|
+
*/
|
|
15
|
+
interface ErrorRowDigest {
|
|
16
|
+
type: 'error';
|
|
17
|
+
message: string;
|
|
18
|
+
errorId: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function encodeErrorDigest(digest: Omit<ErrorRowDigest, 'type'>): string;
|
|
21
|
+
/**
|
|
22
|
+
* The correlation ID in an error's Flight digest, or `null` when the error
|
|
23
|
+
* carries none — a deny or redirect row, an error that never crossed Flight,
|
|
24
|
+
* or anything that is not an object.
|
|
25
|
+
*/
|
|
26
|
+
export declare function errorDigestId(error: unknown): string | null;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=error-digest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-digest.d.ts","sourceRoot":"","sources":["../../src/shared/error-digest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,UAAU,cAAc;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG,MAAM,CAG9E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAc3D"}
|
|
@@ -62,9 +62,9 @@ export interface RscPayloadRoot extends PublishedParams {
|
|
|
62
62
|
* In the browser this is unreachable for a real response: all four producers
|
|
63
63
|
* of a route payload go through `withPublishedParams`, and a client talking to
|
|
64
64
|
* a different build is answered with 204 at Stage 1c
|
|
65
|
-
* (`server/pipeline-phases.ts`) before any payload exists. It is
|
|
66
|
-
*
|
|
67
|
-
*
|
|
65
|
+
* (`server/pipeline-phases.ts`) before any payload exists. It is what a page
|
|
66
|
+
* with no payload at all publishes — a document hydrated without an inlined
|
|
67
|
+
* payload, or a prefetch entry that carries no params.
|
|
68
68
|
*/
|
|
69
69
|
export declare const NO_PUBLISHED_PARAMS: PublishedParams;
|
|
70
70
|
/**
|
|
@@ -78,9 +78,8 @@ export declare function readPublishedParams(source: unknown): PublishedParams;
|
|
|
78
78
|
/**
|
|
79
79
|
* Read the renderable tree out of a payload root.
|
|
80
80
|
*
|
|
81
|
-
* Returns the value unchanged when it is not a root
|
|
82
|
-
*
|
|
83
|
-
* that text should see the text.
|
|
81
|
+
* Returns the value unchanged when it is not a root, so a malformed value
|
|
82
|
+
* reaches React (and its error boundaries) rather than vanishing here.
|
|
84
83
|
*/
|
|
85
84
|
export declare function readPayloadTree(root: unknown): unknown;
|
|
86
85
|
/** A decoded payload, split into the two things the client does with it. */
|
|
@@ -91,10 +90,12 @@ export interface SplitPayload {
|
|
|
91
90
|
* The params published beside it. Settled when the root already is, so the
|
|
92
91
|
* hydration path can render without an extra await.
|
|
93
92
|
*
|
|
94
|
-
* **Never rejects.** A decode failure has to surface
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
93
|
+
* **Never rejects.** A decode failure has to surface through `tree`: where
|
|
94
|
+
* React renders it on hydration, so the error boundary *around the tree*
|
|
95
|
+
* catches it, and where the router awaits it before handing a navigation
|
|
96
|
+
* over, so the navigation fails and recovers. Rejecting here too would take
|
|
97
|
+
* down the provider above every boundary in the app, turning a contained
|
|
98
|
+
* failure into a blank page (TIM-1297).
|
|
98
99
|
*/
|
|
99
100
|
params: ParamsSource;
|
|
100
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload-root.d.ts","sourceRoot":"","sources":["../../src/shared/payload-root.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,0CAA0C;AAC1C,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,MAAM,EAAE,aAAa,CAAC;IACtB,6EAA6E;IAC7E,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEtE,sCAAsC;AACtC,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,gCAAgC;IAChC,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,eAAkD,CAAC;AAarF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,eAAe,CAGpE;AAED
|
|
1
|
+
{"version":3,"file":"payload-root.d.ts","sourceRoot":"","sources":["../../src/shared/payload-root.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,0CAA0C;AAC1C,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,MAAM,EAAE,aAAa,CAAC;IACtB,6EAA6E;IAC7E,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEtE,sCAAsC;AACtC,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,gCAAgC;IAChC,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,eAAkD,CAAC;AAarF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,eAAe,CAGpE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAKtD;AAED,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,yEAAyE;IACzE,IAAI,EAAE,OAAO,CAAC;IACd;;;;;;;;;;OAUG;IACH,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAgB5D"}
|
|
@@ -38,5 +38,11 @@
|
|
|
38
38
|
* normalize; this function does not, because the two callers normalize from
|
|
39
39
|
* different sources (a browser URL, a build-time route entry).
|
|
40
40
|
*/
|
|
41
|
+
/**
|
|
42
|
+
* The directory, relative to the site root, that holds every static RSC
|
|
43
|
+
* payload. The one spelling: the build writes, hashes, and reports it as
|
|
44
|
+
* content-hashed from here.
|
|
45
|
+
*/
|
|
46
|
+
export declare const RSC_PAYLOAD_DIR = "_rsc";
|
|
41
47
|
export declare function rscPayloadPath(routePath: string): string;
|
|
42
48
|
//# sourceMappingURL=rsc-payload-path.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc-payload-path.d.ts","sourceRoot":"","sources":["../../src/shared/rsc-payload-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGxD"}
|
|
1
|
+
{"version":3,"file":"rsc-payload-path.d.ts","sourceRoot":"","sources":["../../src/shared/rsc-payload-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;;;;;;GAOG;AACH;;;;GAIG;AACH,eAAO,MAAM,eAAe,SAAS,CAAC;AAEtC,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGxD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replace a file's contents in one step: write a uniquely named temp sibling,
|
|
3
|
+
* then `rename()` it over the target.
|
|
4
|
+
*
|
|
5
|
+
* `writeFile()` opens its target with `O_TRUNC`, so for the length of the write
|
|
6
|
+
* a concurrent reader sees an empty or half-written file under the real name.
|
|
7
|
+
* `rename()` within one directory swaps the name atomically, so a reader sees
|
|
8
|
+
* either the old file or the new one — never a torn one — and a crashed
|
|
9
|
+
* writer leaves no partial artifact under the final name.
|
|
10
|
+
*
|
|
11
|
+
* The temp name is unique per call, not a fixed `${path}.tmp`: two writers of
|
|
12
|
+
* the same path (a dev server and a `vite build` rewriting the same route
|
|
13
|
+
* types, parallel CLI invocations sharing a cache) would otherwise write into
|
|
14
|
+
* one temp file and rename each other's half-written bytes into place.
|
|
15
|
+
*/
|
|
16
|
+
export declare function writeFileAtomic(path: string, data: Uint8Array | string): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=write-file-atomic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-file-atomic.d.ts","sourceRoot":"","sources":["../../src/utils/write-file-atomic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAY5F"}
|
|
@@ -17,9 +17,9 @@ Universal denial/error primitive. Produces an HTTP error status and renders the
|
|
|
17
17
|
```ts
|
|
18
18
|
import { deny } from '@timber-js/app/server';
|
|
19
19
|
|
|
20
|
-
deny();
|
|
21
|
-
deny(404);
|
|
22
|
-
deny(503, { message: 'Maintenance' });
|
|
20
|
+
deny(); // 403 (default)
|
|
21
|
+
deny(404); // 404 Not Found
|
|
22
|
+
deny(503, { message: 'Maintenance' }); // server-only log message
|
|
23
23
|
deny(404, { dangerouslyPassData: { resourceId: params.id } }); // data forwarded as `data` prop
|
|
24
24
|
```
|
|
25
25
|
|
|
@@ -52,11 +52,11 @@ redirectExternal('https://auth.example.com/login', ['https://auth.example.com'])
|
|
|
52
52
|
redirectExternal('https://docs.example.com', ['https://docs.example.com'], 301);
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
| Parameter | Type | Default | Description
|
|
56
|
-
| ----------- | ---------- | ------- |
|
|
57
|
-
| `url` | `string` | — | Absolute URL to redirect to
|
|
58
|
-
| `allowList` | `string[]` | — | Allowed origins (e.g. `['https://example.com']`)
|
|
59
|
-
| `status` | `number` | `302` | HTTP redirect status code (3xx)
|
|
55
|
+
| Parameter | Type | Default | Description |
|
|
56
|
+
| ----------- | ---------- | ------- | ------------------------------------------------ |
|
|
57
|
+
| `url` | `string` | — | Absolute URL to redirect to |
|
|
58
|
+
| `allowList` | `string[]` | — | Allowed origins (e.g. `['https://example.com']`) |
|
|
59
|
+
| `status` | `number` | `302` | HTTP redirect status code (3xx) |
|
|
60
60
|
|
|
61
61
|
Throws if the origin is not in the allow-list, the scheme isn't `http:` or `https:`, or the URL is invalid.
|
|
62
62
|
|
|
@@ -130,11 +130,14 @@ throw new ActionError('VALIDATION_FAILED', { field: 'email' });
|
|
|
130
130
|
|
|
131
131
|
### `revalidatePath(path)`
|
|
132
132
|
|
|
133
|
-
Re-render a path and return the RSC payload as part of the action response.
|
|
133
|
+
Re-render a path and return the RSC payload as part of the action response. Server actions only: called anywhere else, it throws, because there is no action response to attach the render to. From a `route.ts` handler or a job, use `revalidateTag()` or `cache.invalidate()`.
|
|
134
134
|
|
|
135
135
|
### `revalidateTag(tag)`
|
|
136
136
|
|
|
137
|
-
Invalidate all cache entries with the given tag.
|
|
137
|
+
Invalidate all cache entries with the given tag, and the pre-rendered components that carry it. Returns `Promise<void>`. Callable from any server code:
|
|
138
|
+
|
|
139
|
+
- **In a server action**, the invalidation runs after the action body returns, before any `revalidatePath()` render, so that render sees fresh data. The promise resolves immediately.
|
|
140
|
+
- **Anywhere else** (a `route.ts` webhook, a job), it invalidates immediately. `await` it before you respond.
|
|
138
141
|
|
|
139
142
|
## Segment Params
|
|
140
143
|
|
|
@@ -146,8 +149,8 @@ Returns route path params for the current request. Pass a `SEGMENT_PATH` string
|
|
|
146
149
|
import { SEGMENT_PATH } from './$segment';
|
|
147
150
|
import { getSegmentParams } from '@timber-js/app/server';
|
|
148
151
|
|
|
149
|
-
const { id } = getSegmentParams(SEGMENT_PATH);
|
|
150
|
-
const params = getSegmentParams();
|
|
152
|
+
const { id } = getSegmentParams(SEGMENT_PATH); // Exact types from schema
|
|
153
|
+
const params = getSegmentParams(); // Partial<AllSegmentParams>
|
|
151
154
|
```
|
|
152
155
|
|
|
153
156
|
For typed coercion, define codecs in `app/schema.ts` with `defineSchema()`. See [Typed Params](/docs/typed-params).
|
|
@@ -159,7 +162,7 @@ For typed coercion, define codecs in `app/schema.ts` with `defineSchema()`. See
|
|
|
159
162
|
```ts
|
|
160
163
|
interface RouteContext {
|
|
161
164
|
req: Request;
|
|
162
|
-
headers: Headers;
|
|
165
|
+
headers: Headers; // Response headers (writable)
|
|
163
166
|
}
|
|
164
167
|
```
|
|
165
168
|
|
|
@@ -173,7 +176,7 @@ interface MiddlewareContext {
|
|
|
173
176
|
segmentParams: Record<string, string | string[]>;
|
|
174
177
|
headers: Headers; // Response headers (writable)
|
|
175
178
|
requestHeaders: Headers; // Request headers (injectable)
|
|
176
|
-
readonly nonce: string;
|
|
179
|
+
readonly nonce: string; // Per-request CSP nonce, generated on first read
|
|
177
180
|
}
|
|
178
181
|
```
|
|
179
182
|
|
|
@@ -15,7 +15,9 @@ Wrap an async function with cross-request caching.
|
|
|
15
15
|
```ts
|
|
16
16
|
import { cache } from '@timber-js/app/cache';
|
|
17
17
|
|
|
18
|
-
declare const db: {
|
|
18
|
+
declare const db: {
|
|
19
|
+
users: { findUnique(opts: { where: { id: string } }): Promise<{ id: string; name: string }> };
|
|
20
|
+
};
|
|
19
21
|
|
|
20
22
|
const getUser = cache.data(
|
|
21
23
|
async (userId: string) => {
|
|
@@ -87,14 +89,14 @@ const DocsPage = cache.component(DocsBody, { prerender: true, ttl: 3600, tags: [
|
|
|
87
89
|
|
|
88
90
|
### `PrebuiltComponentOptions`
|
|
89
91
|
|
|
90
|
-
| Option
|
|
91
|
-
|
|
|
92
|
-
| `prerender`
|
|
93
|
-
| `ttl`
|
|
94
|
-
| `tags`
|
|
95
|
-
| `staleWhileRevalidate`
|
|
96
|
-
| `slots`
|
|
97
|
-
| `fallbackOnMissingSegmentParams
|
|
92
|
+
| Option | Type | Description |
|
|
93
|
+
| -------------------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------- |
|
|
94
|
+
| `prerender` | `boolean` | Populate at build time via `generateStaticSegmentParams` |
|
|
95
|
+
| `ttl` | `number` | Runtime freshness window in seconds |
|
|
96
|
+
| `tags` | `string[] \| (props) => string[]` | Tags for invalidation via `revalidateTag` |
|
|
97
|
+
| `staleWhileRevalidate` | `boolean` | Serve stale while a background re-render refreshes |
|
|
98
|
+
| `slots` | `string[]` | Prop names whose values are live React elements composed into the cached shell at request time |
|
|
99
|
+
| `fallbackOnMissingSegmentParams` | `boolean` | When `false`, a cache miss throws instead of rendering live (default: `true`) |
|
|
98
100
|
|
|
99
101
|
Only module-scope declarations are transformed at build time:
|
|
100
102
|
|
|
@@ -110,11 +112,11 @@ export default function Page() {
|
|
|
110
112
|
|
|
111
113
|
### Tier Rules
|
|
112
114
|
|
|
113
|
-
| Declaration
|
|
114
|
-
|
|
|
115
|
-
| `prerender` only
|
|
116
|
-
| `ttl`/`tags` only
|
|
117
|
-
| `prerender` + `ttl`/`tags`
|
|
115
|
+
| Declaration | Enumerated params | Unenumerated miss |
|
|
116
|
+
| -------------------------- | ----------------- | ------------------------------------ |
|
|
117
|
+
| `prerender` only | Built at deploy | Live render every time, never stored |
|
|
118
|
+
| `ttl`/`tags` only | — | Rendered + stored on first request |
|
|
119
|
+
| `prerender` + `ttl`/`tags` | Built at deploy | Rendered + stored on first request |
|
|
118
120
|
|
|
119
121
|
### Slots
|
|
120
122
|
|
|
@@ -128,7 +130,9 @@ const Shell = cache.component(ExpensiveWrapper, {
|
|
|
128
130
|
});
|
|
129
131
|
|
|
130
132
|
// Request time: the shell is served from cache; children render live.
|
|
131
|
-
<Shell theme="dark"
|
|
133
|
+
<Shell theme="dark">
|
|
134
|
+
<LiveUserFeed />
|
|
135
|
+
</Shell>;
|
|
132
136
|
```
|
|
133
137
|
|
|
134
138
|
Slot props are excluded from the cache key — two instances with the same data props share one shell entry. Slots are **runtime tier only**: `prerender` is ignored when `slots` is active because the build cannot enumerate children variants.
|
|
@@ -149,7 +153,9 @@ This desugars to wrapping the page's default export in `cache.component(...)`. L
|
|
|
149
153
|
|
|
150
154
|
### Nesting
|
|
151
155
|
|
|
152
|
-
When a cached component renders inside another cached component, the outer entry's lifetime wins. The inner's output is baked into the outer's payload as a flat copy — `revalidateTag` on the inner's tags does **not** refresh the embedded copy. The framework warns
|
|
156
|
+
When a cached component renders inside another cached component, the outer entry's lifetime wins. The inner's output is baked into the outer's payload as a flat copy — `revalidateTag` on the inner's tags does **not** refresh the embedded copy. The framework warns when the inner declares a refresh channel the outer cannot honor: its `ttl` is shorter than the outer's, or it has a tag the outer doesn't declare. The warning fires once per pair, from the build and from runtime re-renders. Declaring the inner's tags on the outer lets `revalidateTag` reach the copy and silences the tag warning.
|
|
157
|
+
|
|
158
|
+
A cached component may render itself with different props — a comment thread, a tree. If the entry being cached renders itself again with the _same_ props, directly or through other components, the capture fails with an error naming the component. Recursion that never reaches a base case fails at the render timeout.
|
|
153
159
|
|
|
154
160
|
## `CacheHandler` Interface
|
|
155
161
|
|
|
@@ -225,11 +231,21 @@ const handler = new RedisCacheHandler({
|
|
|
225
231
|
const p = redis.multi();
|
|
226
232
|
for (const op of ops) {
|
|
227
233
|
switch (op.op) {
|
|
228
|
-
case 'set':
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
case '
|
|
232
|
-
|
|
234
|
+
case 'set':
|
|
235
|
+
p.set(op.key, op.value, 'EX', op.ttlSeconds);
|
|
236
|
+
break;
|
|
237
|
+
case 'sadd':
|
|
238
|
+
p.sadd(op.key, ...op.members);
|
|
239
|
+
break;
|
|
240
|
+
case 'expireNX':
|
|
241
|
+
p.expire(op.key, op.seconds, 'NX');
|
|
242
|
+
break;
|
|
243
|
+
case 'expireGT':
|
|
244
|
+
p.expire(op.key, op.seconds, 'GT');
|
|
245
|
+
break;
|
|
246
|
+
case 'del':
|
|
247
|
+
p.del(op.key);
|
|
248
|
+
break;
|
|
233
249
|
}
|
|
234
250
|
}
|
|
235
251
|
await p.exec();
|
|
@@ -302,8 +318,20 @@ Invalidate all cache entries with the given tag. Re-exported from `@timber-js/ap
|
|
|
302
318
|
```ts
|
|
303
319
|
import { revalidateTag } from '@timber-js/app/server';
|
|
304
320
|
|
|
305
|
-
revalidateTag('products');
|
|
306
|
-
revalidateTag(`user:${userId}`);
|
|
321
|
+
await revalidateTag('products');
|
|
322
|
+
await revalidateTag(`user:${userId}`);
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Returns `Promise<void>`. Inside a server action the invalidation is deferred until the action body returns, and the promise resolves at once. Anywhere else, it is `cache.invalidate({ tag })`, and the promise settles when the invalidation has, so a webhook awaits it:
|
|
326
|
+
|
|
327
|
+
```ts title="app/api/cms-webhook/route.ts"
|
|
328
|
+
import { revalidateTag } from '@timber-js/app/server';
|
|
329
|
+
|
|
330
|
+
export async function POST(ctx: RouteContext) {
|
|
331
|
+
const { tag } = await ctx.req.json();
|
|
332
|
+
await revalidateTag(tag);
|
|
333
|
+
return new Response(null, { status: 204 });
|
|
334
|
+
}
|
|
307
335
|
```
|
|
308
336
|
|
|
309
337
|
## Singleflight
|
|
@@ -116,7 +116,7 @@ adapter: nitro({ preset: 'node-server' });
|
|
|
116
116
|
### `serverTiming`
|
|
117
117
|
|
|
118
118
|
- **Type:** `'detailed' | 'total' | false`
|
|
119
|
-
- **Default:** `'
|
|
119
|
+
- **Default:** `'total'` (dev and production). `'detailed'` is opt-in.
|
|
120
120
|
|
|
121
121
|
Controls the `Server-Timing` response header. See [Instrumentation & Tracing](/docs/instrumentation).
|
|
122
122
|
|
|
@@ -125,7 +125,7 @@ Controls the `Server-Timing` response header. See [Instrumentation & Tracing](/d
|
|
|
125
125
|
- **Type:** `string[]`
|
|
126
126
|
- **Default:** none
|
|
127
127
|
|
|
128
|
-
Origins
|
|
128
|
+
Origins accepted by CSRF validation. When set, the incoming `Origin` must exactly match one of these full origins (e.g. `https://myapp.com`), replacing the default same-origin check. This option does not configure CORS.
|
|
129
129
|
|
|
130
130
|
### `csrf`
|
|
131
131
|
|
|
@@ -183,7 +183,7 @@ Slow request threshold in milliseconds. Requests exceeding this emit a warning v
|
|
|
183
183
|
- **Type:** `number`
|
|
184
184
|
- **Default:** `30000`
|
|
185
185
|
|
|
186
|
-
Render timeout in milliseconds. If an SSR render or RSC stream read does not complete within this duration, the render is aborted and the connection is closed. Protects against hung fetches and Suspense components that never resolve. Setting `0` uses a 120-second safety ceiling rather than disabling the timeout entirely.
|
|
186
|
+
Render timeout in milliseconds. If an SSR render or RSC stream read does not complete within this duration, the render is aborted and the connection is closed. Protects against hung fetches and Suspense components that never resolve. Setting `0` uses a 120-second safety ceiling rather than disabling the timeout entirely. The same value bounds how long concurrent `timber.cache` callers wait on a shared fill, and how long static generation waits for each page.
|
|
187
187
|
|
|
188
188
|
### `devBrowserLogs`
|
|
189
189
|
|
|
@@ -316,14 +316,42 @@ topLoader: {
|
|
|
316
316
|
|
|
317
317
|
## `TimberPlatformAdapter`
|
|
318
318
|
|
|
319
|
-
The adapter interface for community adapters
|
|
319
|
+
The adapter interface for community adapters, importable as types from `@timber-js/app/adapters/types`:
|
|
320
320
|
|
|
321
321
|
```ts
|
|
322
|
+
import type { TimberPlatformAdapter, BuildArtifacts } from '@timber-js/app/adapters/types';
|
|
323
|
+
|
|
322
324
|
interface TimberPlatformAdapter {
|
|
323
325
|
name: string;
|
|
324
|
-
buildOutput(config: TimberConfig,
|
|
325
|
-
preview?(config: TimberConfig,
|
|
326
|
+
buildOutput(config: TimberConfig, artifacts: BuildArtifacts): Promise<void>;
|
|
327
|
+
preview?(config: TimberConfig, target: { output: 'server' | 'static'; outputDir: string }): Promise<void>;
|
|
326
328
|
waitUntil?(promise: Promise<unknown>): void;
|
|
327
329
|
sendEarlyHints?(links: string[]): void;
|
|
328
330
|
}
|
|
329
331
|
```
|
|
332
|
+
|
|
333
|
+
`TimberConfig` carries configuration only (`root`, `base`, `clientJavascriptDisabled`). `BuildArtifacts` describes what the build produced, discriminated by `output`:
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
type BuildArtifacts =
|
|
337
|
+
| {
|
|
338
|
+
output: 'server';
|
|
339
|
+
outputDir: string;
|
|
340
|
+
client: { path: string };
|
|
341
|
+
immutableDirs: string[];
|
|
342
|
+
rsc: { path: string };
|
|
343
|
+
ssr: { path: string };
|
|
344
|
+
prebuilt?: { path: string };
|
|
345
|
+
manifestInit?: string;
|
|
346
|
+
}
|
|
347
|
+
| {
|
|
348
|
+
output: 'static';
|
|
349
|
+
outputDir: string;
|
|
350
|
+
client: { path: string };
|
|
351
|
+
immutableDirs: string[];
|
|
352
|
+
pages: { path: string };
|
|
353
|
+
contentTypes: Record<string, string>;
|
|
354
|
+
};
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Every path is absolute. `prebuilt` and `manifestInit` are absent when the build did not produce them, so check the field rather than whether a directory exists on disk. `immutableDirs` lists the directories of the served site whose file names are content-hashed — such as `assets`, `_timber/fonts`, and a static build's `_rsc` — relative to the site root, without a leading slash or the deployment `base`. Give those a long-lived `immutable` cache rule instead of hard-coding the paths. `preview()` runs in a separate process after the build, so instead of `BuildArtifacts` it receives the build output directory and the configured `output` mode.
|
package/docs/api/36-cli.mdx
CHANGED
|
@@ -78,7 +78,17 @@ Serve the production build locally for testing.
|
|
|
78
78
|
timber preview
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
If your adapter provides a `preview()` method
|
|
81
|
+
If your adapter provides a `preview()` method, that takes priority. Otherwise falls back to Vite's built-in preview server.
|
|
82
|
+
|
|
83
|
+
Preview reads your project the same way `timber build` does: it resolves your Vite config, so options passed inline to `timber({ ... })`, a custom `--config`, and `build.outDir` all apply. It serves your last build using the `output` mode your config sets now. If you change `output`, rebuild before you preview:
|
|
84
|
+
|
|
85
|
+
| Adapter | `output: 'server'` | `output: 'static'` |
|
|
86
|
+
| --- | --- | --- |
|
|
87
|
+
| Cloudflare | `wrangler dev --local` runs the Worker | `wrangler pages dev` serves the static site |
|
|
88
|
+
| Nitro `node-server` / `bun` | A local Node (or Bun) server runs your app | A local static file server |
|
|
89
|
+
| Other Nitro presets | Not supported. No local runtime, so preview exits with an error | A local static file server |
|
|
90
|
+
|
|
91
|
+
The Nitro static preview serves under your `base` path, but it does not apply `_redirects` or `_headers` rules. Check those on your hosting platform.
|
|
82
92
|
|
|
83
93
|
A `timber.config.ts` that exists but fails to load is a hard error naming the file — preview never silently falls back to the plain Vite preview server with your adapter ignored.
|
|
84
94
|
|
|
@@ -176,7 +176,23 @@ export const getUser = cache(async (id: string) => {
|
|
|
176
176
|
});
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
This deduplicates within a single request.
|
|
179
|
+
This deduplicates within a single request — across `middleware.ts`, `access.ts`, layouts, pages, and `route.ts` handlers, which all share one scope. Inside a server action `React.cache` does not dedupe (an action writes, so cached reads would go stale). The page that `revalidatePath()` re-renders afterwards starts fresh, so it sees the data the action just wrote.
|
|
180
|
+
|
|
181
|
+
Pass request inputs in as arguments rather than reading them inside the cached function. A cached value doesn't see a cookie that middleware changes later in the same request, but a new argument is a new cache key:
|
|
182
|
+
|
|
183
|
+
```tsx title="lib/session.ts"
|
|
184
|
+
import { cache } from 'react';
|
|
185
|
+
import { getCookieJar } from '@timber-js/app/server';
|
|
186
|
+
|
|
187
|
+
declare function fetchUserBySession(token: string): Promise<{ id: string; name: string } | null>;
|
|
188
|
+
|
|
189
|
+
// ✓ keyed on the token — a rotated or deleted session cookie is a cache miss
|
|
190
|
+
export const getUserBySession = cache(async (token: string | undefined) =>
|
|
191
|
+
token ? fetchUserBySession(token) : null
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
export const getUser = () => getUserBySession(getCookieJar().get('session'));
|
|
195
|
+
``` For cross-request caching with TTL, use `timber.cache()` — see [Caching](/docs/caching).
|
|
180
196
|
|
|
181
197
|
## Streaming Secondary Content
|
|
182
198
|
|
|
@@ -112,4 +112,4 @@ When access denies, that segment's `layout.tsx` never runs — `denied.tsx` rend
|
|
|
112
112
|
|
|
113
113
|
## Middleware vs Access
|
|
114
114
|
|
|
115
|
-
`access.ts` runs inside the React tree, so it
|
|
115
|
+
`access.ts` runs inside the React tree, so it gates each segment and supports slot degradation. `middleware.ts` runs before rendering, for headers, redirects, and cache warming. Both share the request's `React.cache` scope with your layouts and pages. The full comparison is in [Middleware](/docs/middleware).
|