@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/src/adapters/nitro.ts
CHANGED
|
@@ -5,23 +5,29 @@
|
|
|
5
5
|
// compression, graceful shutdown, static file serving, and platform quirks.
|
|
6
6
|
// See design/11-platform.md and design/25-production-deployments.md.
|
|
7
7
|
|
|
8
|
+
import { existsSync } from 'node:fs';
|
|
8
9
|
import { cp, glob, readFile, writeFile } from 'node:fs/promises';
|
|
9
|
-
import { basename, dirname, join } from 'node:path';
|
|
10
|
+
import { basename, dirname, join, relative, sep } from 'node:path';
|
|
10
11
|
import {
|
|
11
12
|
buildStaticDirectoryOutput,
|
|
12
|
-
findUnhashedStaticFiles,
|
|
13
13
|
runSharedBuildSteps,
|
|
14
14
|
writeHeadersFile,
|
|
15
15
|
} from './build-output-helper.ts';
|
|
16
16
|
import { generateCompressModule } from './compress-module.ts';
|
|
17
|
+
import { generateCanonicalizeModule } from './canonicalize-module.ts';
|
|
17
18
|
import { LOCALLY_PREVIEWABLE, PRESET_CONFIGS, type NitroPreset } from './nitro-presets.ts';
|
|
18
19
|
import {
|
|
19
20
|
generatePreviewScript,
|
|
20
21
|
generateSendResponseModule,
|
|
21
22
|
spawnNitroPreview,
|
|
22
23
|
} from './nitro-preview.ts';
|
|
23
|
-
import { IMMUTABLE_CACHE } from './shared.ts';
|
|
24
|
-
import type {
|
|
24
|
+
import { adapterBase, IMMUTABLE_CACHE } from './shared.ts';
|
|
25
|
+
import type {
|
|
26
|
+
BuildArtifacts,
|
|
27
|
+
PreviewTarget,
|
|
28
|
+
TimberConfig,
|
|
29
|
+
TimberPlatformAdapter,
|
|
30
|
+
} from './types.ts';
|
|
25
31
|
|
|
26
32
|
// NitroPreset is part of the public adapter API (NitroAdapterOptions.preset),
|
|
27
33
|
// so it stays importable from this module.
|
|
@@ -101,18 +107,30 @@ export function nitro(options: NitroAdapterOptions = {}): TimberPlatformAdapter
|
|
|
101
107
|
return {
|
|
102
108
|
name: `nitro-${preset}`,
|
|
103
109
|
|
|
104
|
-
async buildOutput(config: TimberConfig,
|
|
105
|
-
const outDir = join(
|
|
110
|
+
async buildOutput(config: TimberConfig, artifacts: BuildArtifacts) {
|
|
111
|
+
const outDir = join(artifacts.outputDir, 'nitro');
|
|
106
112
|
|
|
107
113
|
// ── Static mode: plain directory output ────────────────────────
|
|
108
114
|
// No Nitro server — just pre-rendered HTML + client assets.
|
|
109
|
-
if (
|
|
110
|
-
await buildStaticDirectoryOutput(config,
|
|
115
|
+
if (artifacts.output === 'static') {
|
|
116
|
+
await buildStaticDirectoryOutput(config, artifacts, outDir, 'public');
|
|
111
117
|
const publicDir = join(outDir, 'public');
|
|
112
118
|
|
|
113
119
|
// Write _headers for cache control + extensionless Content-Type.
|
|
114
120
|
// Netlify supports the _headers convention just like Cloudflare.
|
|
115
|
-
await writeHeadersFile(publicDir, config,
|
|
121
|
+
await writeHeadersFile(publicDir, config, artifacts);
|
|
122
|
+
|
|
123
|
+
// Local preview serves the site as the build recorded it.
|
|
124
|
+
await writeFile(join(outDir, CANONICALIZE_MODULE), await generateCanonicalizeModule());
|
|
125
|
+
await writeFile(
|
|
126
|
+
join(outDir, PREVIEW_SCRIPT),
|
|
127
|
+
generatePreviewScript({
|
|
128
|
+
output: 'static',
|
|
129
|
+
immutableDirs: artifacts.immutableDirs,
|
|
130
|
+
base: adapterBase(config),
|
|
131
|
+
contentTypes: artifacts.contentTypes,
|
|
132
|
+
})
|
|
133
|
+
);
|
|
116
134
|
|
|
117
135
|
// Platform-specific files for static deploy targets.
|
|
118
136
|
const target = options.staticTarget ?? 'generic';
|
|
@@ -143,7 +161,7 @@ export function nitro(options: NitroAdapterOptions = {}): TimberPlatformAdapter
|
|
|
143
161
|
// write _headers, write manifest-init).
|
|
144
162
|
await runSharedBuildSteps({
|
|
145
163
|
config,
|
|
146
|
-
|
|
164
|
+
artifacts,
|
|
147
165
|
outDir,
|
|
148
166
|
publicDirName: 'public',
|
|
149
167
|
});
|
|
@@ -156,76 +174,116 @@ export function nitro(options: NitroAdapterOptions = {}): TimberPlatformAdapter
|
|
|
156
174
|
// Web→Node response bridge with backpressure. See TIM-1154.
|
|
157
175
|
await writeFile(join(outDir, '_send-response.mjs'), generateSendResponseModule());
|
|
158
176
|
|
|
177
|
+
// Standalone preview server for presets with a local runtime. It loads
|
|
178
|
+
// the build's own RSC bundle — not the copy under nitro/rsc/ — because
|
|
179
|
+
// the handler reads prebuilt payloads from ../prebuilt beside its
|
|
180
|
+
// bundle, and the build's prebuilt/ is cleaned every build while
|
|
181
|
+
// nitro/prebuilt/ is not: a build that captured nothing would otherwise
|
|
182
|
+
// preview an earlier build's payloads.
|
|
183
|
+
if (LOCALLY_PREVIEWABLE.has(preset)) {
|
|
184
|
+
await writeFile(join(outDir, CANONICALIZE_MODULE), await generateCanonicalizeModule());
|
|
185
|
+
await writeFile(
|
|
186
|
+
join(outDir, PREVIEW_SCRIPT),
|
|
187
|
+
generatePreviewScript({
|
|
188
|
+
output: 'server',
|
|
189
|
+
runtimeName: PRESET_CONFIGS[preset].runtimeName,
|
|
190
|
+
rscEntry: importSpecifier(outDir, join(artifacts.rsc.path, 'index.js')),
|
|
191
|
+
hasManifestInit: !!artifacts.manifestInit,
|
|
192
|
+
immutableDirs: artifacts.immutableDirs,
|
|
193
|
+
base: adapterBase(config),
|
|
194
|
+
})
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
159
198
|
// Prepend the manifest assignment directly into the RSC entry so
|
|
160
199
|
// globalThis.__TIMBER_BUILD_MANIFEST__ is set before any module reads it.
|
|
161
200
|
// This must be top-level code, not an import, because rollup tree-shakes
|
|
162
201
|
// side-effect-only globalThis assignments from imported modules.
|
|
163
|
-
if (
|
|
202
|
+
if (artifacts.manifestInit) {
|
|
164
203
|
const rscEntry = join(outDir, 'rsc', 'index.js');
|
|
165
204
|
const rscContent = await readFile(rscEntry, 'utf-8');
|
|
166
|
-
await writeFile(rscEntry, `${
|
|
205
|
+
await writeFile(rscEntry, `${artifacts.manifestInit}\n${rscContent}`);
|
|
167
206
|
}
|
|
168
207
|
|
|
169
208
|
// Generate the Nitro entry point (imports from ./rsc/ within nitro dir)
|
|
170
|
-
const entry = generateNitroEntry(
|
|
209
|
+
const entry = generateNitroEntry(preset, compress);
|
|
171
210
|
await writeFile(join(outDir, 'entry.ts'), entry);
|
|
172
211
|
|
|
173
212
|
// Run the Nitro build to produce a production-ready server bundle.
|
|
174
213
|
// The output goes to dist/nitro/.output/server/index.mjs (for node-server preset).
|
|
175
214
|
// Config is passed programmatically — no nitro.config.ts file needed.
|
|
176
|
-
const { serverDir } = await runNitroBuild(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
215
|
+
const { serverDir } = await runNitroBuild(
|
|
216
|
+
outDir,
|
|
217
|
+
preset,
|
|
218
|
+
artifacts.immutableDirs,
|
|
219
|
+
options.nitroConfig
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
// Copy prebuilt flight payloads into the Nitro output. The RSC entry
|
|
223
|
+
// resolves `../prebuilt/` relative to its bundled chunk
|
|
224
|
+
// (<serverDir>/_chunks/), so prebuilt/ must live at
|
|
182
225
|
// <serverDir>/prebuilt/. serverDir is the resolved path from Nitro
|
|
183
226
|
// (honors user overrides via nitroConfig.output.serverDir).
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
recursive: true
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const baseFuncName = basename(serverDir);
|
|
197
|
-
await copyPrebuiltToVercelFuncClones(functionsDir, prebuiltSrc, baseFuncName);
|
|
227
|
+
if (artifacts.prebuilt) {
|
|
228
|
+
const prebuiltSrc = artifacts.prebuilt.path;
|
|
229
|
+
await cp(prebuiltSrc, join(serverDir, 'prebuilt'), { recursive: true });
|
|
230
|
+
|
|
231
|
+
// Vercel with functionRules clones __server.func to per-route .func
|
|
232
|
+
// directories during the Nitro build. Copy prebuilt into those clones
|
|
233
|
+
// so requests routed to them also resolve ../prebuilt correctly.
|
|
234
|
+
if (preset === 'vercel' || preset === 'vercel-edge') {
|
|
235
|
+
const functionsDir = dirname(serverDir);
|
|
236
|
+
const baseFuncName = basename(serverDir);
|
|
237
|
+
await copyPrebuiltToVercelFuncClones(functionsDir, prebuiltSrc, baseFuncName);
|
|
238
|
+
}
|
|
198
239
|
}
|
|
199
240
|
},
|
|
200
241
|
|
|
201
|
-
//
|
|
202
|
-
//
|
|
203
|
-
// local runtime
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
242
|
+
// buildOutput wrote the preview server for this build: a static file
|
|
243
|
+
// server for a static build, and for a server build on a preset with a
|
|
244
|
+
// local runtime (node-server, bun), one that routes to the RSC handler.
|
|
245
|
+
// Serverless presets (vercel, netlify, aws-lambda, etc.) have no local
|
|
246
|
+
// runtime, so a server build on one has nothing to preview.
|
|
247
|
+
async preview(_config: TimberConfig, { output, outputDir }: PreviewTarget) {
|
|
248
|
+
if (output === 'server' && !LOCALLY_PREVIEWABLE.has(preset)) {
|
|
249
|
+
throw new Error(
|
|
250
|
+
`[timber] The nitro '${preset}' preset has no local runtime, so \`timber preview\` ` +
|
|
251
|
+
`cannot run its server build. Preview with a node-server build, or with the ` +
|
|
252
|
+
`platform's own tooling.`
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
const nitroDir = join(outputDir, 'nitro');
|
|
256
|
+
const script = join(nitroDir, PREVIEW_SCRIPT);
|
|
257
|
+
if (!existsSync(script)) {
|
|
258
|
+
throw new Error(
|
|
259
|
+
`[timber] No preview server at ${script}. Run \`timber build\` before \`timber preview\`.`
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
// Only a bun server build needs Bun. The static file server uses Node
|
|
263
|
+
// built-ins, so it runs on the Node already running timber, as does a
|
|
264
|
+
// node-server build — no PATH lookup for either.
|
|
265
|
+
const command = output === 'server' && preset === 'bun' ? 'bun' : process.execPath;
|
|
266
|
+
await spawnNitroPreview(command, [script], nitroDir);
|
|
267
|
+
},
|
|
217
268
|
};
|
|
218
269
|
}
|
|
219
270
|
|
|
271
|
+
/** The preview server buildOutput writes into the Nitro output directory. */
|
|
272
|
+
const PREVIEW_SCRIPT = '_preview-server.mjs';
|
|
273
|
+
|
|
274
|
+
/** The request-path canonicalizer the preview server imports beside it. */
|
|
275
|
+
const CANONICALIZE_MODULE = '_canonicalize.mjs';
|
|
276
|
+
|
|
277
|
+
/** A relative ESM import specifier for `file`, as imported from a module in `fromDir`. */
|
|
278
|
+
function importSpecifier(fromDir: string, file: string): string {
|
|
279
|
+
const path = relative(fromDir, file).split(sep).join('/');
|
|
280
|
+
return path.startsWith('../') ? path : './' + path;
|
|
281
|
+
}
|
|
282
|
+
|
|
220
283
|
// ─── Entry Generation ────────────────────────────────────────────────────────
|
|
221
284
|
|
|
222
285
|
/** @internal Exported for testing. */
|
|
223
|
-
export function generateNitroEntry(
|
|
224
|
-
buildDir: string,
|
|
225
|
-
outDir: string,
|
|
226
|
-
preset: NitroPreset,
|
|
227
|
-
compress = true
|
|
228
|
-
): string {
|
|
286
|
+
export function generateNitroEntry(preset: NitroPreset, compress = true): string {
|
|
229
287
|
// The RSC entry is the main request handler — it exports the fetch handler as default.
|
|
230
288
|
// rsc/ is copied into the nitro dir so the import is local.
|
|
231
289
|
// The manifest init is prepended to rsc/index.js before the nitro build,
|
|
@@ -408,6 +466,7 @@ interface NitroBuildResult {
|
|
|
408
466
|
async function runNitroBuild(
|
|
409
467
|
nitroDir: string,
|
|
410
468
|
preset: NitroPreset,
|
|
469
|
+
immutableDirs: readonly string[],
|
|
411
470
|
userConfig?: Record<string, unknown>
|
|
412
471
|
): Promise<NitroBuildResult> {
|
|
413
472
|
const presetConfig = PRESET_CONFIGS[preset];
|
|
@@ -426,10 +485,10 @@ async function runNitroBuild(
|
|
|
426
485
|
// Using `entry` directly would bypass the Nitro server runtime.
|
|
427
486
|
renderer: { handler: join(nitroDir, 'entry.ts') },
|
|
428
487
|
output: { dir: join(nitroDir, presetConfig.outputDir) },
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
488
|
+
// One rule per content-hashed directory the build recorded.
|
|
489
|
+
routeRules: Object.fromEntries(
|
|
490
|
+
immutableDirs.map((dir) => [`/${dir}/**`, { headers: { 'Cache-Control': IMMUTABLE_CACHE } }])
|
|
491
|
+
),
|
|
433
492
|
// Don't bundle the timber RSC/SSR build output — it has its own
|
|
434
493
|
// internal file references that nitro's bundler can't follow.
|
|
435
494
|
// Mark them as external so rollup leaves the imports as-is.
|
|
@@ -471,22 +530,6 @@ async function runNitroBuild(
|
|
|
471
530
|
}
|
|
472
531
|
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
473
532
|
|
|
474
|
-
/**
|
|
475
|
-
* Resolve the destination path for prebuilt flight payloads in the Nitro
|
|
476
|
-
* output directory. The RSC entry resolves `../prebuilt/` relative to its
|
|
477
|
-
* bundled chunk location (`<serverBundleDir>/_chunks/`), so prebuilt/ must
|
|
478
|
-
* live at `<serverBundleDir>/prebuilt/`.
|
|
479
|
-
*
|
|
480
|
-
* The serverBundleDir varies by preset — Nitro's Vercel preset uses
|
|
481
|
-
* `functions/__server.func` while most others use `server`.
|
|
482
|
-
*
|
|
483
|
-
* @internal Exported for testing.
|
|
484
|
-
*/
|
|
485
|
-
export function resolvePrebuiltOutputPath(outDir: string, preset: NitroPreset): string {
|
|
486
|
-
const presetConfig = PRESET_CONFIGS[preset];
|
|
487
|
-
return join(outDir, presetConfig.outputDir, presetConfig.serverBundleDir, 'prebuilt');
|
|
488
|
-
}
|
|
489
|
-
|
|
490
533
|
/**
|
|
491
534
|
* Copy prebuilt payloads into cloned Vercel function directories.
|
|
492
535
|
*
|
|
@@ -513,12 +556,6 @@ export async function copyPrebuiltToVercelFuncClones(
|
|
|
513
556
|
return;
|
|
514
557
|
}
|
|
515
558
|
await Promise.all(
|
|
516
|
-
funcDirs.map((dir) =>
|
|
517
|
-
cp(prebuiltSrc, join(dir, 'prebuilt'), { recursive: true }).catch(
|
|
518
|
-
(e: NodeJS.ErrnoException) => {
|
|
519
|
-
if (e.code !== 'ENOENT') throw e;
|
|
520
|
-
}
|
|
521
|
-
)
|
|
522
|
-
)
|
|
559
|
+
funcDirs.map((dir) => cp(prebuiltSrc, join(dir, 'prebuilt'), { recursive: true }))
|
|
523
560
|
);
|
|
524
561
|
}
|
package/src/adapters/shared.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { withBasePath } from '../shared/base-path.ts';
|
|
|
19
19
|
* by callers that predate it (a hand-written adapter, a test harness). Falling
|
|
20
20
|
* back to `'/'` reproduces the pre-TIM-1274 output exactly, which is correct
|
|
21
21
|
* for the only deployments those callers can have: a build under a non-root
|
|
22
|
-
* base always goes through `plugins/
|
|
22
|
+
* base always goes through `plugins/post-build.ts`, which populates it.
|
|
23
23
|
*
|
|
24
24
|
* Typed structurally rather than as `TimberConfig` so this module keeps no
|
|
25
25
|
* import of `./types.js` at runtime.
|
|
@@ -43,7 +43,9 @@ export const STATIC_CACHE = 'public, max-age=3600, must-revalidate';
|
|
|
43
43
|
* Static Assets, Cloudflare Pages, and Netlify. It maps URL patterns to
|
|
44
44
|
* HTTP response headers.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
46
|
+
* The build's content-hashed directories (`immutableDirs`, recorded on
|
|
47
|
+
* `BuildArtifacts` by the phases that hashed them) get one wildcard rule
|
|
48
|
+
* each. When
|
|
47
49
|
* `unhashedPaths` is provided, per-file rules are appended for unhashed
|
|
48
50
|
* static assets (favicon.ico, robots.txt, etc.) so they get Cache-Control
|
|
49
51
|
* on platforms like Cloudflare Workers Static Assets where the server
|
|
@@ -62,13 +64,13 @@ export const STATIC_CACHE = 'public, max-age=3600, must-revalidate';
|
|
|
62
64
|
* Cloudflare Workers Static Assets without one.
|
|
63
65
|
*
|
|
64
66
|
* The prefix is applied at exactly one point, `rulePath()`, which every rule
|
|
65
|
-
* in this function goes through. Prefixing the
|
|
67
|
+
* in this function goes through. Prefixing the wildcards and
|
|
66
68
|
* hand-checking that the per-file rules agree is how the next rule gets
|
|
67
69
|
* missed.
|
|
68
70
|
*/
|
|
69
|
-
// Cloudflare Workers Static Assets caps _headers at 100 rules.
|
|
70
|
-
//
|
|
71
|
-
const
|
|
71
|
+
// Cloudflare Workers Static Assets caps _headers at 100 rules. The wildcard
|
|
72
|
+
// rules for the immutable directories come out of the same budget.
|
|
73
|
+
const MAX_RULES = 100;
|
|
72
74
|
|
|
73
75
|
export interface HeadersFileOptions {
|
|
74
76
|
/**
|
|
@@ -79,6 +81,11 @@ export interface HeadersFileOptions {
|
|
|
79
81
|
* root-relative rules that match nothing, which is the bug this closes.
|
|
80
82
|
*/
|
|
81
83
|
base: string;
|
|
84
|
+
/**
|
|
85
|
+
* Content-hashed directories, from `BuildArtifacts.immutableDirs`. Each
|
|
86
|
+
* gets an immutable `Cache-Control` wildcard rule.
|
|
87
|
+
*/
|
|
88
|
+
immutableDirs: readonly string[];
|
|
82
89
|
/** Unhashed static files (route-space paths) needing per-file cache rules. */
|
|
83
90
|
unhashedPaths?: string[];
|
|
84
91
|
/** Route-space path → Content-Type, for extensionless API route outputs. */
|
|
@@ -154,6 +161,7 @@ function patternsOverlap(a: string, b: string): boolean {
|
|
|
154
161
|
|
|
155
162
|
export function generateHeadersFile({
|
|
156
163
|
base,
|
|
164
|
+
immutableDirs,
|
|
157
165
|
unhashedPaths,
|
|
158
166
|
contentTypes,
|
|
159
167
|
userRules,
|
|
@@ -208,24 +216,25 @@ export function generateHeadersFile({
|
|
|
208
216
|
let content = `# Auto-generated by @timber-js/app — static asset cache headers.
|
|
209
217
|
# See design/25-production-deployments.md §"CDN / Edge Cache"
|
|
210
218
|
`;
|
|
211
|
-
for (const
|
|
212
|
-
content += emit(rulePath(
|
|
219
|
+
for (const dir of immutableDirs) {
|
|
220
|
+
content += emit(rulePath(`/${dir}/*`), 'Cache-Control', IMMUTABLE_CACHE);
|
|
213
221
|
}
|
|
222
|
+
const maxPerFileRules = MAX_RULES - immutableDirs.length;
|
|
214
223
|
|
|
215
224
|
// Content-Type rules are higher priority than cache headers for
|
|
216
225
|
// extensionless files — without them the file is unreadable.
|
|
217
226
|
const allCtEntries = contentTypes
|
|
218
227
|
? Object.entries(contentTypes).sort(([a], [b]) => a.localeCompare(b))
|
|
219
228
|
: [];
|
|
220
|
-
const ctEntries = allCtEntries.slice(0,
|
|
221
|
-
if (allCtEntries.length >
|
|
229
|
+
const ctEntries = allCtEntries.slice(0, maxPerFileRules);
|
|
230
|
+
if (allCtEntries.length > maxPerFileRules) {
|
|
222
231
|
console.warn(
|
|
223
232
|
`[timber] _headers: ${allCtEntries.length} content-type rules exceed ` +
|
|
224
|
-
`Cloudflare's 100-rule limit. Only the first ${
|
|
233
|
+
`Cloudflare's 100-rule limit. Only the first ${maxPerFileRules} ` +
|
|
225
234
|
`extensionless API routes will get Content-Type headers.`
|
|
226
235
|
);
|
|
227
236
|
}
|
|
228
|
-
const remainingBudget =
|
|
237
|
+
const remainingBudget = maxPerFileRules - ctEntries.length;
|
|
229
238
|
|
|
230
239
|
if (unhashedPaths && unhashedPaths.length > 0) {
|
|
231
240
|
const capped = unhashedPaths.slice(0, Math.max(0, remainingBudget));
|
|
@@ -260,10 +269,10 @@ export function generateHeadersFile({
|
|
|
260
269
|
content += `\n# User-authored rules from public/_headers\n\n${userRules.trim()}\n`;
|
|
261
270
|
|
|
262
271
|
const total = countHeaderRules(content);
|
|
263
|
-
if (total >
|
|
272
|
+
if (total > MAX_RULES) {
|
|
264
273
|
console.warn(
|
|
265
274
|
`[timber] _headers: ${total} rules after merging public/_headers, over ` +
|
|
266
|
-
`Cloudflare's ${
|
|
275
|
+
`Cloudflare's ${MAX_RULES}-rule limit. Rules past the ` +
|
|
267
276
|
`limit are dropped by the platform — remove some, or move static ` +
|
|
268
277
|
`assets under a directory the wildcard rules already cover.`
|
|
269
278
|
);
|
package/src/adapters/types.ts
CHANGED
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
/**
|
|
8
8
|
* Configuration passed to adapter lifecycle methods.
|
|
9
9
|
* A subset of the resolved timber.config.ts relevant to adapters.
|
|
10
|
+
*
|
|
11
|
+
* Configuration only: nothing here is produced by a build phase. What the
|
|
12
|
+
* build produced — directories, the manifest initialization module, the
|
|
13
|
+
* static site — arrives separately as {@link BuildArtifacts}, and the output
|
|
14
|
+
* mode is the discriminant of that union rather than a field here, so an
|
|
15
|
+
* adapter cannot be handed a static mode with no static site (TIM-1524).
|
|
10
16
|
*/
|
|
11
17
|
export interface TimberConfig {
|
|
12
18
|
/** Absolute path to the project root (Vite root). */
|
|
@@ -19,40 +25,120 @@ export interface TimberConfig {
|
|
|
19
25
|
* host matches against the *request* path, so those rules live in deployed-
|
|
20
26
|
* URL space rather than route space and need this prefix (TIM-1274).
|
|
21
27
|
*
|
|
22
|
-
* Populated by `plugins/
|
|
28
|
+
* Populated by `plugins/post-build.ts` from `ctx.base`, the single copy
|
|
23
29
|
* lifted in TIM-1261. Adapters must not re-derive it from `config.base`.
|
|
24
30
|
*/
|
|
25
31
|
base?: string;
|
|
26
|
-
output: 'server' | 'static';
|
|
27
32
|
clientJavascriptDisabled?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** A directory a build phase wrote. */
|
|
36
|
+
export interface DirectoryArtifact {
|
|
37
|
+
/** Absolute path. Adapters never join it against `outputDir` or `root`. */
|
|
38
|
+
readonly path: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface BuildArtifactsBase {
|
|
28
42
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
43
|
+
* The build output directory (`.timber/dist` by default) — where adapters
|
|
44
|
+
* write their own platform directory (`cloudflare/`, `nitro/`). Not the
|
|
45
|
+
* project root; that is `TimberConfig.root`.
|
|
32
46
|
*/
|
|
33
|
-
|
|
47
|
+
readonly outputDir: string;
|
|
34
48
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* Layout: path/index.html, _rsc/path/index.rsc, api-route-path
|
|
49
|
+
* The browser bundle: client JS, CSS, fonts, and everything Vite copied
|
|
50
|
+
* out of `public/`. Always produced — with client JavaScript disabled it
|
|
51
|
+
* still carries the stylesheets and `public/`; adapters drop the `.js`.
|
|
39
52
|
*/
|
|
40
|
-
|
|
53
|
+
readonly client: DirectoryArtifact;
|
|
41
54
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
55
|
+
* Directories of the served tree whose every file name carries a content
|
|
56
|
+
* hash — `'assets'`, `'_timber/fonts'`, and in a static build whose RSC
|
|
57
|
+
* payloads were hashed, `'_rsc'`. Relative to the site root, `/`-separated,
|
|
58
|
+
* no leading or trailing slash, and in route space: an adapter writing
|
|
59
|
+
* platform rules adds the deployment `base` itself.
|
|
60
|
+
*
|
|
61
|
+
* Each entry is recorded by the phase that hashed the files — the client
|
|
62
|
+
* environment from its `build.assetsDir`, the font plugin when it emitted a
|
|
63
|
+
* binary, static generation when it hashed payloads — so adapters mark
|
|
64
|
+
* these immutable without knowing which plugin names or hashes what.
|
|
46
65
|
*/
|
|
47
|
-
|
|
66
|
+
readonly immutableDirs: readonly string[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Build products of an `output: 'server'` build. */
|
|
70
|
+
export interface ServerBuildArtifacts extends BuildArtifactsBase {
|
|
71
|
+
readonly output: 'server';
|
|
72
|
+
/** The RSC server bundle. Its `index.js` is the request handler. */
|
|
73
|
+
readonly rsc: DirectoryArtifact;
|
|
74
|
+
/**
|
|
75
|
+
* The SSR bundle. The RSC bundle imports it by a path the RSC plugin
|
|
76
|
+
* computed between the two build directories — siblings named `rsc/` and
|
|
77
|
+
* `ssr/` — so adapters deploy them as siblings under those names.
|
|
78
|
+
*/
|
|
79
|
+
readonly ssr: DirectoryArtifact;
|
|
80
|
+
/**
|
|
81
|
+
* `cache.component` flight payloads captured at build time (design/44).
|
|
82
|
+
* Present only when the capture pass wrote at least one payload.
|
|
83
|
+
*/
|
|
84
|
+
readonly prebuilt?: DirectoryArtifact;
|
|
85
|
+
/**
|
|
86
|
+
* Generated JS module source that sets `globalThis.__TIMBER_BUILD_MANIFEST__`.
|
|
87
|
+
* Must evaluate before the RSC handler; adapters
|
|
88
|
+
* write it as `_timber-manifest-init.js` or prepend it to the entry.
|
|
89
|
+
* Absent when no build manifest was produced.
|
|
90
|
+
*/
|
|
91
|
+
readonly manifestInit?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Build products of an `output: 'static'` build. */
|
|
95
|
+
export interface StaticBuildArtifacts extends BuildArtifactsBase {
|
|
96
|
+
readonly output: 'static';
|
|
97
|
+
/**
|
|
98
|
+
* The pre-rendered site: `path/index.html`, RSC payloads under `_rsc/`
|
|
99
|
+
* (content-hashed unless client JavaScript is disabled), API route
|
|
100
|
+
* outputs, `404.html`, and a generated `_redirects` when any redirect was
|
|
101
|
+
* captured.
|
|
102
|
+
*/
|
|
103
|
+
readonly pages: DirectoryArtifact;
|
|
104
|
+
/**
|
|
105
|
+
* Content-Type for each extensionless API route output, keyed by URL path
|
|
106
|
+
* (e.g. `/api/data` → `application/json`). Adapters write these as
|
|
107
|
+
* `_headers` rules; a static host cannot infer them from a file name.
|
|
108
|
+
* See TIM-1241.
|
|
109
|
+
*/
|
|
110
|
+
readonly contentTypes: Readonly<Record<string, string>>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Everything a `timber build` produced, as the adapter consumes it.
|
|
115
|
+
*
|
|
116
|
+
* Each field is recorded by the phase that wrote it. The two optional fields
|
|
117
|
+
* are the two products a build can legitimately lack — `prebuilt` (nothing
|
|
118
|
+
* captured) and `manifestInit` (no build manifest) — and adapters branch on
|
|
119
|
+
* their presence (`if (artifacts.prebuilt)`) rather than probing the
|
|
120
|
+
* filesystem.
|
|
121
|
+
*/
|
|
122
|
+
export type BuildArtifacts = ServerBuildArtifacts | StaticBuildArtifacts;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* What `timber preview` asks an adapter to serve. Preview runs in a later
|
|
126
|
+
* process with no build in memory, so it gets the output directory and the
|
|
127
|
+
* configured mode rather than {@link BuildArtifacts}; the mode is what tells
|
|
128
|
+
* an adapter whether a server entry exists to run at all.
|
|
129
|
+
*/
|
|
130
|
+
export interface PreviewTarget {
|
|
131
|
+
readonly output: 'server' | 'static';
|
|
132
|
+
/** The build output directory `buildOutput` wrote its platform directory into. */
|
|
133
|
+
readonly outputDir: string;
|
|
48
134
|
}
|
|
49
135
|
|
|
50
136
|
/**
|
|
51
137
|
* The formal adapter interface. An adapter transforms the build output
|
|
52
138
|
* into a deployable artifact for a specific platform.
|
|
53
139
|
*
|
|
54
|
-
* Adapters are small: they receive
|
|
55
|
-
* transform or copy it into whatever shape the platform expects.
|
|
140
|
+
* Adapters are small: they receive a description of what the build
|
|
141
|
+
* produced and transform or copy it into whatever shape the platform expects.
|
|
56
142
|
*/
|
|
57
143
|
export interface TimberPlatformAdapter {
|
|
58
144
|
/** Unique adapter name (e.g. 'cloudflare', 'node', 'bun'). */
|
|
@@ -62,13 +148,16 @@ export interface TimberPlatformAdapter {
|
|
|
62
148
|
* Transform the build output for the target platform.
|
|
63
149
|
* Called at the end of `timber build`.
|
|
64
150
|
*/
|
|
65
|
-
buildOutput(config: TimberConfig,
|
|
151
|
+
buildOutput(config: TimberConfig, artifacts: BuildArtifacts): Promise<void>;
|
|
66
152
|
|
|
67
153
|
/**
|
|
68
154
|
* Start a local preview server for the built output.
|
|
69
|
-
* Falls back to
|
|
155
|
+
* Falls back to Vite's preview server if not provided.
|
|
156
|
+
*
|
|
157
|
+
* Runs in a later process than the build (`timber preview`); see
|
|
158
|
+
* {@link PreviewTarget}.
|
|
70
159
|
*/
|
|
71
|
-
preview?(config: TimberConfig,
|
|
160
|
+
preview?(config: TimberConfig, target: PreviewTarget): Promise<void>;
|
|
72
161
|
|
|
73
162
|
/**
|
|
74
163
|
* Send 103 Early Hints to the client before the final response.
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
|
|
23
23
|
import { createHash } from 'node:crypto';
|
|
24
24
|
import { createRequire } from 'node:module';
|
|
25
|
-
import { mkdir, readFile,
|
|
25
|
+
import { mkdir, readFile, stat } from 'node:fs/promises';
|
|
26
26
|
import { dirname, isAbsolute, join } from 'node:path';
|
|
27
27
|
import { buildSourceExtensions, scanProjectSourceFiles } from './scan.ts';
|
|
28
28
|
import type { CrawlReport } from './crawl.ts';
|
|
29
|
+
import { writeFileAtomic } from '../utils/write-file-atomic.ts';
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* JSON contract version (design/47 §9) — one constant for every
|
|
@@ -326,7 +327,5 @@ export async function readGraphCache(root: string): Promise<GraphCacheFile | nul
|
|
|
326
327
|
export async function writeGraphCache(root: string, cache: GraphCacheFile): Promise<void> {
|
|
327
328
|
const target = join(root, CACHE_RELATIVE_PATH);
|
|
328
329
|
await mkdir(dirname(target), { recursive: true });
|
|
329
|
-
|
|
330
|
-
await writeFile(temp, JSON.stringify(cache));
|
|
331
|
-
await rename(temp, target);
|
|
330
|
+
await writeFileAtomic(target, JSON.stringify(cache));
|
|
332
331
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { logLossyCacheValue } from '../server/logger.ts';
|
|
2
|
+
|
|
1
3
|
const LOSSY_TYPES = ['Date', 'Map', 'Set', 'BigInt'] as const;
|
|
2
4
|
|
|
3
5
|
let hasWarned = false;
|
|
@@ -17,15 +19,7 @@ export function warnLossyJsonValue(value: unknown, cacheKey: string): void {
|
|
|
17
19
|
if (lossy.size === 0) return;
|
|
18
20
|
|
|
19
21
|
hasWarned = true;
|
|
20
|
-
|
|
21
|
-
console.warn(
|
|
22
|
-
`[timber] cache value for key "${cacheKey}" contains ${types} — ` +
|
|
23
|
-
'these types lose fidelity through JSON serialization in Redis/KV cache handlers. ' +
|
|
24
|
-
'Date becomes an ISO string, Map/Set become {}, BigInt throws. ' +
|
|
25
|
-
'The MemoryCacheHandler preserves them. Consider transforming values ' +
|
|
26
|
-
'to JSON-safe types before caching, or use MemoryCacheHandler for ' +
|
|
27
|
-
'values that require type preservation.'
|
|
28
|
-
);
|
|
22
|
+
logLossyCacheValue({ cacheKey, types: [...lossy].join(', ') });
|
|
29
23
|
}
|
|
30
24
|
|
|
31
25
|
function findLossyTypes(value: unknown, seen: Set<unknown>, depth: number): Set<string> {
|
|
@@ -52,8 +52,11 @@ export function createSingleflight(opts?: SingleflightOptions): Singleflight {
|
|
|
52
52
|
// side effects (e.g. cache writes). See TIM-1092.
|
|
53
53
|
promise = new Promise<T>((resolve, reject) => {
|
|
54
54
|
const timer = setTimeout(() => {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
// The timeout error is also the signal's reason, so the body
|
|
56
|
+
// can tell why it was aborted (runBackgroundFlight reports it).
|
|
57
|
+
const timeout = new SingleflightTimeoutError(key, timeoutMs);
|
|
58
|
+
ac.abort(timeout);
|
|
59
|
+
reject(timeout);
|
|
57
60
|
}, timeoutMs);
|
|
58
61
|
try {
|
|
59
62
|
fn(ac.signal).then(
|
package/src/cache/sizeof.ts
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* to cache and undercount than to reject the entry.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
import { swallow } from '../server/logger.ts';
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* Estimate the byte size of a value.
|
|
18
20
|
*
|
|
@@ -27,7 +29,7 @@ export function estimateByteSize(value: unknown): number {
|
|
|
27
29
|
return json.length * 2;
|
|
28
30
|
} catch (e) {
|
|
29
31
|
// Circular reference or non-serializable value
|
|
30
|
-
|
|
32
|
+
swallow(e, 'sizeof estimation failed', { level: 'debug' });
|
|
31
33
|
return 0;
|
|
32
34
|
}
|
|
33
35
|
}
|