@timber-js/app 0.2.0-alpha.8 → 0.2.0-alpha.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/dist/_chunks/actions-Dg-ANYHb.js +421 -0
- package/dist/_chunks/actions-Dg-ANYHb.js.map +1 -0
- package/dist/_chunks/{als-registry-B7DbZ2hS.js → als-registry-HS0LGUl2.js} +1 -1
- package/dist/_chunks/als-registry-HS0LGUl2.js.map +1 -0
- package/dist/_chunks/chunk-DYhsFzuS.js +33 -0
- package/dist/_chunks/{debug-gwlJkDuf.js → debug-ECi_61pb.js} +2 -2
- package/dist/_chunks/debug-ECi_61pb.js.map +1 -0
- package/dist/_chunks/define-C77ScO0m.js +106 -0
- package/dist/_chunks/define-C77ScO0m.js.map +1 -0
- package/dist/_chunks/define-CZqDwhSu.js +199 -0
- package/dist/_chunks/define-CZqDwhSu.js.map +1 -0
- package/dist/_chunks/define-cookie-C2IkoFGN.js +94 -0
- package/dist/_chunks/define-cookie-C2IkoFGN.js.map +1 -0
- package/dist/_chunks/{format-DviM89f0.js → dev-warnings-DpGRGoDi.js} +5 -44
- package/dist/_chunks/dev-warnings-DpGRGoDi.js.map +1 -0
- package/dist/_chunks/format-CYBGxKtc.js +14 -0
- package/dist/_chunks/format-CYBGxKtc.js.map +1 -0
- package/dist/_chunks/{interception-BOoWmLUA.js → interception-Dpn_UfAD.js} +171 -97
- package/dist/_chunks/interception-Dpn_UfAD.js.map +1 -0
- package/dist/_chunks/merge-search-params-Cm_KIWDX.js +41 -0
- package/dist/_chunks/merge-search-params-Cm_KIWDX.js.map +1 -0
- package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js → metadata-routes-DS3eKNmf.js} +1 -1
- package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js.map → metadata-routes-DS3eKNmf.js.map} +1 -1
- package/dist/_chunks/request-context-qMsWgy9C.js +478 -0
- package/dist/_chunks/request-context-qMsWgy9C.js.map +1 -0
- package/dist/_chunks/schema-bridge-C3xl_vfb.js +86 -0
- package/dist/_chunks/schema-bridge-C3xl_vfb.js.map +1 -0
- package/dist/_chunks/segment-classify-BDNn6EzD.js +65 -0
- package/dist/_chunks/segment-classify-BDNn6EzD.js.map +1 -0
- package/dist/_chunks/segment-context-fHFLF1PE.js +34 -0
- package/dist/_chunks/segment-context-fHFLF1PE.js.map +1 -0
- package/dist/_chunks/{ssr-data-MjmprTmO.js → ssr-data-DzuI0bIV.js} +1 -1
- package/dist/_chunks/{ssr-data-MjmprTmO.js.map → ssr-data-DzuI0bIV.js.map} +1 -1
- package/dist/_chunks/stale-reload-C2plcNtG.js +64 -0
- package/dist/_chunks/stale-reload-C2plcNtG.js.map +1 -0
- package/dist/_chunks/{tracing-CemImE6h.js → tracing-CCYbKn5n.js} +60 -9
- package/dist/_chunks/tracing-CCYbKn5n.js.map +1 -0
- package/dist/_chunks/use-params-Br9YSUFV.js +295 -0
- package/dist/_chunks/use-params-Br9YSUFV.js.map +1 -0
- package/dist/_chunks/{use-query-states-D5KaffOK.js → use-query-states-Lo_s_pw2.js} +4 -4
- package/dist/_chunks/use-query-states-Lo_s_pw2.js.map +1 -0
- package/dist/_chunks/wrappers-_DTmImGt.js +63 -0
- package/dist/_chunks/wrappers-_DTmImGt.js.map +1 -0
- package/dist/adapters/cloudflare-dev.d.ts +109 -0
- package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
- package/dist/adapters/cloudflare-dev.js +73 -0
- package/dist/adapters/cloudflare-dev.js.map +1 -0
- package/dist/adapters/cloudflare-kv-cache.d.ts +64 -0
- package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
- package/dist/adapters/cloudflare-kv-cache.js +95 -0
- package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
- package/dist/adapters/cloudflare.d.ts +148 -12
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +135 -11
- package/dist/adapters/cloudflare.js.map +1 -1
- package/dist/adapters/compress-module.d.ts.map +1 -1
- package/dist/adapters/nitro.d.ts +17 -1
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +56 -13
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/cache/cache-api.d.ts +24 -0
- package/dist/cache/cache-api.d.ts.map +1 -0
- package/dist/cache/handler-store.d.ts +31 -0
- package/dist/cache/handler-store.d.ts.map +1 -0
- package/dist/cache/index.d.ts +23 -7
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +142 -80
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/singleflight.d.ts +18 -1
- package/dist/cache/singleflight.d.ts.map +1 -1
- package/dist/cache/sizeof.d.ts +22 -0
- package/dist/cache/sizeof.d.ts.map +1 -0
- package/dist/cache/timber-cache.d.ts +1 -1
- package/dist/cache/timber-cache.d.ts.map +1 -1
- package/dist/cli.d.ts +6 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/browser-dev.d.ts +27 -1
- package/dist/client/browser-dev.d.ts.map +1 -1
- package/dist/client/browser-entry/action-dispatch.d.ts +17 -0
- package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
- package/dist/client/browser-entry/hmr.d.ts +21 -0
- package/dist/client/browser-entry/hmr.d.ts.map +1 -0
- package/dist/client/browser-entry/hydrate.d.ts +46 -0
- package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
- package/dist/client/browser-entry/index.d.ts +30 -0
- package/dist/client/browser-entry/index.d.ts.map +1 -0
- package/dist/client/browser-entry/post-hydration.d.ts +26 -0
- package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
- package/dist/client/browser-entry/router-init.d.ts +23 -0
- package/dist/client/browser-entry/router-init.d.ts.map +1 -0
- package/dist/client/browser-entry/rsc-stream.d.ts +24 -0
- package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
- package/dist/client/browser-entry/scroll.d.ts +19 -0
- package/dist/client/browser-entry/scroll.d.ts.map +1 -0
- package/dist/client/error-boundary.d.ts +12 -5
- package/dist/client/error-boundary.d.ts.map +1 -1
- package/dist/client/error-boundary.js +10 -4
- package/dist/client/error-boundary.js.map +1 -1
- package/dist/client/error-reconstituter.d.ts +54 -0
- package/dist/client/error-reconstituter.d.ts.map +1 -0
- package/dist/client/form.d.ts +2 -2
- package/dist/client/form.d.ts.map +1 -1
- package/dist/client/history.d.ts +19 -4
- package/dist/client/history.d.ts.map +1 -1
- package/dist/client/index.d.ts +7 -21
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +210 -1017
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +18 -0
- package/dist/client/internal.d.ts.map +1 -0
- package/dist/client/internal.js +890 -0
- package/dist/client/internal.js.map +1 -0
- package/dist/client/link-pending-store.d.ts +63 -0
- package/dist/client/link-pending-store.d.ts.map +1 -0
- package/dist/client/link.d.ts +90 -32
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/nav-link-store.d.ts +36 -0
- package/dist/client/nav-link-store.d.ts.map +1 -0
- package/dist/client/navigation-api-types.d.ts +90 -0
- package/dist/client/navigation-api-types.d.ts.map +1 -0
- package/dist/client/navigation-api.d.ts +115 -0
- package/dist/client/navigation-api.d.ts.map +1 -0
- package/dist/client/navigation-context.d.ts +13 -2
- package/dist/client/navigation-context.d.ts.map +1 -1
- package/dist/client/{transition-root.d.ts → navigation-root.d.ts} +42 -8
- package/dist/client/navigation-root.d.ts.map +1 -0
- package/dist/client/nuqs-adapter.d.ts.map +1 -1
- package/dist/client/router-ref.d.ts +1 -1
- package/dist/client/router.d.ts +70 -4
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/rsc-fetch.d.ts +38 -3
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +1 -1
- package/dist/client/segment-cache.d.ts.map +1 -1
- package/dist/client/segment-outlet.d.ts +63 -0
- package/dist/client/segment-outlet.d.ts.map +1 -0
- package/dist/client/ssr-data.d.ts +13 -4
- package/dist/client/ssr-data.d.ts.map +1 -1
- package/dist/client/stale-reload.d.ts +15 -0
- package/dist/client/stale-reload.d.ts.map +1 -1
- package/dist/client/top-loader.d.ts +5 -5
- package/dist/client/top-loader.d.ts.map +1 -1
- package/dist/client/use-link-status.d.ts +5 -5
- package/dist/client/use-link-status.d.ts.map +1 -1
- package/dist/client/use-params.d.ts +6 -4
- package/dist/client/use-params.d.ts.map +1 -1
- package/dist/client/{use-navigation-pending.d.ts → use-pending-navigation.d.ts} +4 -4
- package/dist/client/use-pending-navigation.d.ts.map +1 -0
- package/dist/client/use-query-states.d.ts +1 -1
- package/dist/client/use-query-states.d.ts.map +1 -1
- package/dist/client/use-router.d.ts +1 -1
- package/dist/codec.d.ts +33 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +2 -0
- package/dist/config-types.d.ts +210 -0
- package/dist/config-types.d.ts.map +1 -0
- package/dist/content/index.d.ts +1 -10
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/index.js +0 -2
- package/dist/cookies/define-cookie.d.ts +35 -14
- package/dist/cookies/define-cookie.d.ts.map +1 -1
- package/dist/cookies/index.js +1 -83
- package/dist/fonts/css.d.ts +1 -0
- package/dist/fonts/css.d.ts.map +1 -1
- package/dist/index.d.ts +45 -192
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12296 -11901
- package/dist/index.js.map +1 -1
- package/dist/plugin-context.d.ts +84 -0
- package/dist/plugin-context.d.ts.map +1 -0
- package/dist/plugins/adapter-build.d.ts +1 -1
- package/dist/plugins/adapter-build.d.ts.map +1 -1
- package/dist/plugins/build-manifest.d.ts +2 -2
- package/dist/plugins/build-manifest.d.ts.map +1 -1
- package/dist/plugins/build-report.d.ts +3 -3
- package/dist/plugins/build-report.d.ts.map +1 -1
- package/dist/plugins/client-chunks.d.ts +32 -0
- package/dist/plugins/client-chunks.d.ts.map +1 -0
- package/dist/plugins/content.d.ts +1 -1
- package/dist/plugins/content.d.ts.map +1 -1
- package/dist/plugins/dev-browser-logs.d.ts +84 -0
- package/dist/plugins/dev-browser-logs.d.ts.map +1 -0
- package/dist/plugins/dev-error-overlay.d.ts +26 -1
- package/dist/plugins/dev-error-overlay.d.ts.map +1 -1
- package/dist/plugins/dev-logs.d.ts +1 -1
- package/dist/plugins/dev-logs.d.ts.map +1 -1
- package/dist/plugins/dev-server.d.ts +1 -1
- package/dist/plugins/dev-server.d.ts.map +1 -1
- package/dist/plugins/entries.d.ts +1 -1
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/plugins/fonts.d.ts +19 -5
- package/dist/plugins/fonts.d.ts.map +1 -1
- package/dist/plugins/mdx.d.ts +1 -1
- package/dist/plugins/mdx.d.ts.map +1 -1
- package/dist/plugins/routing.d.ts +1 -1
- package/dist/plugins/routing.d.ts.map +1 -1
- package/dist/plugins/server-bundle.d.ts.map +1 -1
- package/dist/plugins/shims.d.ts +6 -5
- package/dist/plugins/shims.d.ts.map +1 -1
- package/dist/plugins/static-build.d.ts +4 -4
- package/dist/plugins/static-build.d.ts.map +1 -1
- package/dist/routing/codegen.d.ts +2 -2
- package/dist/routing/codegen.d.ts.map +1 -1
- package/dist/routing/index.d.ts +2 -0
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +3 -2
- package/dist/routing/scanner.d.ts.map +1 -1
- package/dist/routing/segment-classify.d.ts +46 -0
- package/dist/routing/segment-classify.d.ts.map +1 -0
- package/dist/routing/status-file-lint.d.ts +2 -1
- package/dist/routing/status-file-lint.d.ts.map +1 -1
- package/dist/routing/types.d.ts +16 -4
- package/dist/routing/types.d.ts.map +1 -1
- package/dist/rsc-runtime/rsc.d.ts +1 -1
- package/dist/rsc-runtime/rsc.d.ts.map +1 -1
- package/dist/rsc-runtime/ssr.d.ts +12 -0
- package/dist/rsc-runtime/ssr.d.ts.map +1 -1
- package/dist/schema-bridge.d.ts +76 -0
- package/dist/schema-bridge.d.ts.map +1 -0
- package/dist/search-params/define.d.ts +139 -0
- package/dist/search-params/define.d.ts.map +1 -0
- package/dist/search-params/index.d.ts +4 -7
- package/dist/search-params/index.d.ts.map +1 -1
- package/dist/search-params/index.js +4 -474
- package/dist/search-params/registry.d.ts +2 -2
- package/dist/search-params/registry.d.ts.map +1 -1
- package/dist/search-params/wrappers.d.ts +53 -0
- package/dist/search-params/wrappers.d.ts.map +1 -0
- package/dist/segment-params/define.d.ts +78 -0
- package/dist/segment-params/define.d.ts.map +1 -0
- package/dist/segment-params/index.d.ts +6 -0
- package/dist/segment-params/index.d.ts.map +1 -0
- package/dist/segment-params/index.js +4 -0
- package/dist/server/access-gate.d.ts +4 -0
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/action-client.d.ts +12 -1
- package/dist/server/action-client.d.ts.map +1 -1
- package/dist/server/action-encryption.d.ts +76 -0
- package/dist/server/action-encryption.d.ts.map +1 -0
- package/dist/server/action-handler.d.ts.map +1 -1
- package/dist/server/actions.d.ts +3 -6
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +32 -4
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/build-manifest.d.ts +2 -2
- package/dist/server/build-manifest.d.ts.map +1 -1
- package/dist/server/debug.d.ts +1 -1
- package/dist/server/default-logger.d.ts +22 -0
- package/dist/server/default-logger.d.ts.map +1 -0
- package/dist/server/deny-page-resolver.d.ts +52 -0
- package/dist/server/deny-page-resolver.d.ts.map +1 -0
- package/dist/server/deny-renderer.d.ts.map +1 -1
- package/dist/server/dev-holding-server.d.ts +52 -0
- package/dist/server/dev-holding-server.d.ts.map +1 -0
- package/dist/server/dev-warnings.d.ts +1 -21
- package/dist/server/dev-warnings.d.ts.map +1 -1
- package/dist/server/early-hints.d.ts +13 -5
- package/dist/server/early-hints.d.ts.map +1 -1
- package/dist/server/error-boundary-wrapper.d.ts +7 -1
- package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
- package/dist/server/fallback-error.d.ts +4 -3
- package/dist/server/fallback-error.d.ts.map +1 -1
- package/dist/server/flight-injection-state.d.ts +66 -0
- package/dist/server/flight-injection-state.d.ts.map +1 -0
- package/dist/server/flight-scripts.d.ts +42 -0
- package/dist/server/flight-scripts.d.ts.map +1 -0
- package/dist/server/flush.d.ts.map +1 -1
- package/dist/server/form-data.d.ts +29 -0
- package/dist/server/form-data.d.ts.map +1 -1
- package/dist/server/html-injectors.d.ts +51 -11
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/index.d.ts +6 -43
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +38 -2798
- package/dist/server/index.js.map +1 -1
- package/dist/server/internal.d.ts +46 -0
- package/dist/server/internal.d.ts.map +1 -0
- package/dist/server/internal.js +2883 -0
- package/dist/server/internal.js.map +1 -0
- package/dist/server/logger.d.ts +25 -7
- package/dist/server/logger.d.ts.map +1 -1
- package/dist/server/middleware-runner.d.ts +19 -4
- package/dist/server/middleware-runner.d.ts.map +1 -1
- package/dist/server/node-stream-transforms.d.ts +113 -0
- package/dist/server/node-stream-transforms.d.ts.map +1 -0
- package/dist/server/page-deny-boundary.d.ts +31 -0
- package/dist/server/page-deny-boundary.d.ts.map +1 -0
- package/dist/server/pipeline-interception.d.ts +1 -1
- package/dist/server/pipeline-interception.d.ts.map +1 -1
- package/dist/server/pipeline-metadata.d.ts +6 -0
- package/dist/server/pipeline-metadata.d.ts.map +1 -1
- package/dist/server/pipeline.d.ts +42 -10
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/primitives.d.ts +69 -18
- package/dist/server/primitives.d.ts.map +1 -1
- package/dist/server/render-timeout.d.ts +51 -0
- package/dist/server/render-timeout.d.ts.map +1 -0
- package/dist/server/request-context.d.ts +112 -43
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts +27 -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 +9 -2
- package/dist/server/route-matcher.d.ts.map +1 -1
- package/dist/server/rsc-entry/api-handler.d.ts +2 -2
- package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
- package/dist/server/rsc-entry/error-renderer.d.ts +26 -13
- package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/helpers.d.ts +48 -5
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts +8 -3
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-payload.d.ts +3 -3
- package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts +4 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts +1 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +19 -4
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/safe-load.d.ts +46 -0
- package/dist/server/safe-load.d.ts.map +1 -0
- package/dist/server/sitemap-generator.d.ts +129 -0
- package/dist/server/sitemap-generator.d.ts.map +1 -0
- package/dist/server/sitemap-handler.d.ts +22 -0
- package/dist/server/sitemap-handler.d.ts.map +1 -0
- package/dist/server/slot-resolver.d.ts +1 -1
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/ssr-entry.d.ts +22 -0
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-render.d.ts +39 -21
- package/dist/server/ssr-render.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts +50 -0
- package/dist/server/ssr-wrappers.d.ts.map +1 -0
- package/dist/server/status-code-resolver.d.ts +1 -1
- package/dist/server/status-code-resolver.d.ts.map +1 -1
- package/dist/server/stream-utils.d.ts +36 -0
- package/dist/server/stream-utils.d.ts.map +1 -0
- package/dist/server/tracing.d.ts +4 -4
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/server/tree-builder.d.ts +22 -19
- package/dist/server/tree-builder.d.ts.map +1 -1
- package/dist/server/types.d.ts +1 -4
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/version-skew.d.ts +61 -0
- package/dist/server/version-skew.d.ts.map +1 -0
- package/dist/shared/merge-search-params.d.ts +22 -0
- package/dist/shared/merge-search-params.d.ts.map +1 -0
- package/dist/shims/font-google.d.ts +1 -1
- package/dist/shims/font-google.d.ts.map +1 -1
- package/dist/shims/font-google.js +42 -0
- package/dist/shims/font-google.js.map +1 -0
- package/dist/shims/font-local.d.ts +26 -0
- package/dist/shims/font-local.d.ts.map +1 -0
- package/dist/shims/font-local.js +20 -0
- package/dist/shims/font-local.js.map +1 -0
- package/dist/shims/headers.d.ts +2 -1
- package/dist/shims/headers.d.ts.map +1 -1
- package/dist/shims/navigation-client.d.ts +1 -1
- package/dist/shims/navigation-client.d.ts.map +1 -1
- package/dist/shims/navigation.d.ts +3 -2
- package/dist/shims/navigation.d.ts.map +1 -1
- package/dist/utils/directive-parser.d.ts +5 -2
- package/dist/utils/directive-parser.d.ts.map +1 -1
- package/dist/utils/state-machine.d.ts +80 -0
- package/dist/utils/state-machine.d.ts.map +1 -0
- package/package.json +53 -23
- package/src/adapters/cloudflare-dev.ts +177 -0
- package/src/adapters/cloudflare-kv-cache.ts +142 -0
- package/src/adapters/cloudflare.ts +342 -28
- package/src/adapters/compress-module.ts +24 -4
- package/src/adapters/nitro.ts +52 -8
- package/src/adapters/wrangler.d.ts +7 -0
- package/src/cache/cache-api.ts +38 -0
- package/src/cache/handler-store.ts +68 -0
- package/src/cache/index.ts +81 -18
- package/src/cache/singleflight.ts +62 -4
- package/src/cache/sizeof.ts +31 -0
- package/src/cache/timber-cache.ts +24 -20
- package/src/cli.ts +6 -1
- package/src/client/browser-dev.ts +128 -1
- package/src/client/browser-entry/action-dispatch.ts +116 -0
- package/src/client/browser-entry/hmr.ts +81 -0
- package/src/client/browser-entry/hydrate.ts +145 -0
- package/src/client/browser-entry/index.ts +138 -0
- package/src/client/browser-entry/post-hydration.ts +119 -0
- package/src/client/browser-entry/router-init.ts +193 -0
- package/src/client/browser-entry/rsc-stream.ts +157 -0
- package/src/client/browser-entry/scroll.ts +27 -0
- package/src/client/error-boundary.tsx +48 -16
- package/src/client/error-reconstituter.tsx +65 -0
- package/src/client/form.tsx +2 -2
- package/src/client/history.ts +26 -4
- package/src/client/index.ts +19 -38
- package/src/client/internal.ts +57 -0
- package/src/client/link-pending-store.ts +111 -0
- package/src/client/link.tsx +329 -97
- package/src/client/nav-link-store.ts +47 -0
- package/src/client/navigation-api-types.ts +112 -0
- package/src/client/navigation-api.ts +332 -0
- package/src/client/navigation-context.ts +31 -6
- package/src/client/navigation-root.tsx +342 -0
- package/src/client/nuqs-adapter.tsx +16 -3
- package/src/client/router-ref.ts +1 -1
- package/src/client/router.ts +299 -72
- package/src/client/rsc-fetch.ts +97 -8
- package/src/client/segment-cache.ts +1 -1
- package/src/client/segment-outlet.tsx +86 -0
- package/src/client/ssr-data.ts +13 -5
- package/src/client/stale-reload.ts +72 -3
- package/src/client/top-loader.tsx +16 -8
- package/src/client/use-link-status.ts +7 -7
- package/src/client/use-params.ts +7 -5
- package/src/client/{use-navigation-pending.ts → use-pending-navigation.ts} +6 -6
- package/src/client/use-query-states.ts +3 -3
- package/src/client/use-router.ts +1 -1
- package/src/codec.ts +49 -0
- package/src/config-types.ts +208 -0
- package/src/content/index.ts +5 -13
- package/src/cookies/define-cookie.ts +78 -25
- package/src/cookies/index.ts +8 -0
- package/src/fonts/css.ts +2 -1
- package/src/index.ts +258 -354
- package/src/plugin-context.ts +200 -0
- package/src/plugins/adapter-build.ts +8 -2
- package/src/plugins/build-manifest.ts +13 -2
- package/src/plugins/build-report.ts +3 -3
- package/src/plugins/client-chunks.ts +65 -0
- package/src/plugins/content.ts +1 -1
- package/src/plugins/dev-browser-logs.ts +288 -0
- package/src/plugins/dev-error-overlay.ts +70 -1
- package/src/plugins/dev-logs.ts +1 -1
- package/src/plugins/dev-server.ts +70 -9
- package/src/plugins/entries.ts +71 -10
- package/src/plugins/fonts.ts +168 -61
- package/src/plugins/mdx.ts +1 -1
- package/src/plugins/routing.ts +57 -17
- package/src/plugins/server-action-exports.ts +1 -1
- package/src/plugins/server-bundle.ts +32 -1
- package/src/plugins/shims.ts +135 -35
- package/src/plugins/static-build.ts +17 -11
- package/src/routing/codegen.ts +165 -105
- package/src/routing/index.ts +2 -0
- package/src/routing/scanner.ts +93 -23
- package/src/routing/segment-classify.ts +89 -0
- package/src/routing/status-file-lint.ts +3 -2
- package/src/routing/types.ts +17 -4
- package/src/rsc-runtime/rsc.ts +2 -0
- package/src/rsc-runtime/ssr.ts +50 -0
- package/src/rsc-runtime/vendor-types.d.ts +7 -0
- package/src/{search-params/codecs.ts → schema-bridge.ts} +57 -20
- package/src/search-params/define.ts +482 -0
- package/src/search-params/index.ts +14 -20
- package/src/search-params/registry.ts +2 -2
- package/src/search-params/wrappers.ts +85 -0
- package/src/segment-params/define.ts +279 -0
- package/src/segment-params/index.ts +29 -0
- package/src/server/access-gate.tsx +70 -29
- package/src/server/action-client.ts +21 -2
- package/src/server/action-encryption.ts +144 -0
- package/src/server/action-handler.ts +21 -4
- package/src/server/actions.ts +10 -9
- package/src/server/als-registry.ts +34 -6
- package/src/server/build-manifest.ts +10 -4
- package/src/server/compress.ts +25 -7
- package/src/server/debug.ts +1 -1
- package/src/server/default-logger.ts +99 -0
- package/src/server/deny-page-resolver.ts +154 -0
- package/src/server/deny-renderer.ts +24 -38
- package/src/server/dev-holding-server.ts +185 -0
- package/src/server/dev-warnings.ts +4 -49
- package/src/server/early-hints.ts +36 -15
- package/src/server/error-boundary-wrapper.ts +74 -22
- package/src/server/fallback-error.ts +31 -15
- package/src/server/flight-injection-state.ts +113 -0
- package/src/server/flight-scripts.ts +62 -0
- package/src/server/flush.ts +2 -1
- package/src/server/form-data.ts +76 -0
- package/src/server/html-injectors.ts +280 -120
- package/src/server/index.ts +26 -177
- package/src/server/internal.ts +169 -0
- package/src/server/logger.ts +44 -36
- package/src/server/middleware-runner.ts +31 -4
- package/src/server/node-stream-transforms.ts +509 -0
- package/src/server/page-deny-boundary.tsx +56 -0
- package/src/server/pipeline-interception.ts +17 -16
- package/src/server/pipeline-metadata.ts +13 -0
- package/src/server/pipeline.ts +227 -62
- package/src/server/primitives.ts +111 -28
- package/src/server/render-timeout.ts +108 -0
- package/src/server/request-context.ts +293 -132
- package/src/server/route-element-builder.ts +283 -191
- package/src/server/route-handler.ts +24 -4
- package/src/server/route-matcher.ts +24 -20
- package/src/server/rsc-entry/api-handler.ts +15 -16
- package/src/server/rsc-entry/error-renderer.ts +300 -89
- package/src/server/rsc-entry/helpers.ts +134 -5
- package/src/server/rsc-entry/index.ts +200 -112
- package/src/server/rsc-entry/rsc-payload.ts +65 -18
- package/src/server/rsc-entry/rsc-stream.ts +65 -13
- package/src/server/rsc-entry/ssr-bridge.ts +14 -5
- package/src/server/rsc-entry/ssr-renderer.ts +168 -38
- package/src/server/safe-load.ts +60 -0
- package/src/server/sitemap-generator.ts +338 -0
- package/src/server/sitemap-handler.ts +126 -0
- package/src/server/slot-resolver.ts +244 -229
- package/src/server/ssr-entry.ts +211 -32
- package/src/server/ssr-render.ts +289 -67
- package/src/server/ssr-wrappers.tsx +139 -0
- package/src/server/status-code-resolver.ts +1 -1
- package/src/server/stream-utils.ts +213 -0
- package/src/server/tracing.ts +20 -9
- package/src/server/tree-builder.ts +92 -58
- package/src/server/types.ts +3 -6
- package/src/server/version-skew.ts +104 -0
- package/src/shared/merge-search-params.ts +55 -0
- package/src/shims/font-google.ts +1 -1
- package/src/shims/font-local.ts +34 -0
- package/src/shims/headers.ts +5 -1
- package/src/shims/navigation-client.ts +1 -1
- package/src/shims/navigation.ts +7 -2
- package/src/utils/directive-parser.ts +5 -2
- package/src/utils/state-machine.ts +111 -0
- package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
- package/dist/_chunks/debug-gwlJkDuf.js.map +0 -1
- package/dist/_chunks/format-DviM89f0.js.map +0 -1
- package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
- package/dist/_chunks/request-context-DIkVh_jG.js +0 -330
- package/dist/_chunks/request-context-DIkVh_jG.js.map +0 -1
- package/dist/_chunks/tracing-CemImE6h.js.map +0 -1
- package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
- package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
- package/dist/_chunks/use-query-states-D5KaffOK.js.map +0 -1
- package/dist/cache/register-cached-function.d.ts +0 -17
- package/dist/cache/register-cached-function.d.ts.map +0 -1
- package/dist/client/browser-entry.d.ts +0 -21
- package/dist/client/browser-entry.d.ts.map +0 -1
- package/dist/client/link-status-provider.d.ts +0 -11
- package/dist/client/link-status-provider.d.ts.map +0 -1
- package/dist/client/transition-root.d.ts.map +0 -1
- package/dist/client/use-navigation-pending.d.ts.map +0 -1
- package/dist/cookies/index.js.map +0 -1
- package/dist/plugins/cache-transform.d.ts +0 -36
- package/dist/plugins/cache-transform.d.ts.map +0 -1
- package/dist/plugins/dynamic-transform.d.ts +0 -72
- package/dist/plugins/dynamic-transform.d.ts.map +0 -1
- package/dist/search-params/analyze.d.ts +0 -54
- package/dist/search-params/analyze.d.ts.map +0 -1
- package/dist/search-params/builtin-codecs.d.ts +0 -105
- package/dist/search-params/builtin-codecs.d.ts.map +0 -1
- package/dist/search-params/codecs.d.ts +0 -53
- package/dist/search-params/codecs.d.ts.map +0 -1
- package/dist/search-params/create.d.ts +0 -106
- package/dist/search-params/create.d.ts.map +0 -1
- package/dist/search-params/index.js.map +0 -1
- package/dist/server/prerender.d.ts +0 -77
- package/dist/server/prerender.d.ts.map +0 -1
- package/dist/server/response-cache.d.ts +0 -54
- package/dist/server/response-cache.d.ts.map +0 -1
- package/src/cache/register-cached-function.ts +0 -103
- package/src/client/browser-entry.ts +0 -678
- package/src/client/link-status-provider.tsx +0 -30
- package/src/client/transition-root.tsx +0 -166
- package/src/plugins/cache-transform.ts +0 -199
- package/src/plugins/dynamic-transform.ts +0 -161
- package/src/search-params/analyze.ts +0 -192
- package/src/search-params/builtin-codecs.ts +0 -228
- package/src/search-params/create.ts +0 -321
- package/src/server/prerender.ts +0 -139
- package/src/server/response-cache.ts +0 -410
package/src/index.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @timber-js/app — Root entry point (public API).
|
|
3
|
+
*
|
|
4
|
+
* User-facing exports: timber(), defineConfig(), TimberUserConfig, Routes.
|
|
5
|
+
*
|
|
6
|
+
* Internal helpers (PluginContext, resolveAppDir, loadTimberConfigFile,
|
|
7
|
+
* warnConfigConflicts, resolveClientJavascript) live in plugin-context.ts
|
|
8
|
+
* and are NOT re-exported here. Sub-plugins import them via relative paths.
|
|
9
|
+
*
|
|
10
|
+
* Design doc: 18-build-system.md §"Plugin Architecture"
|
|
11
|
+
*/
|
|
12
|
+
|
|
1
13
|
import type { Plugin, PluginOption } from 'vite';
|
|
2
|
-
import {
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
14
|
+
import { join, resolve } from 'node:path';
|
|
5
15
|
import { createRequire } from 'node:module';
|
|
6
|
-
import react from '@vitejs/plugin-react';
|
|
7
|
-
import { cacheTransformPlugin } from './plugins/cache-transform';
|
|
16
|
+
import react, { reactCompilerPreset } from '@vitejs/plugin-react';
|
|
8
17
|
import { timberContent } from './plugins/content';
|
|
9
18
|
import { timberDevServer } from './plugins/dev-server';
|
|
10
19
|
import { timberEntries } from './plugins/entries';
|
|
@@ -13,358 +22,247 @@ import { timberRouting } from './plugins/routing';
|
|
|
13
22
|
import { timberShims } from './plugins/shims';
|
|
14
23
|
import { timberFonts } from './plugins/fonts';
|
|
15
24
|
import { timberStaticBuild } from './plugins/static-build';
|
|
16
|
-
import { timberDynamicTransform } from './plugins/dynamic-transform';
|
|
17
25
|
import { timberServerActionExports } from './plugins/server-action-exports';
|
|
18
26
|
import { timberBuildManifest } from './plugins/build-manifest';
|
|
19
27
|
import { timberDevLogs } from './plugins/dev-logs';
|
|
28
|
+
import { timberDevBrowserLogs } from './plugins/dev-browser-logs';
|
|
20
29
|
import { timberReactProd } from './plugins/react-prod';
|
|
21
30
|
import { timberChunks } from './plugins/chunks';
|
|
31
|
+
import { clientChunkGroup } from './plugins/client-chunks';
|
|
22
32
|
import { timberServerBundle } from './plugins/server-bundle';
|
|
23
33
|
import { timberAdapterBuild } from './plugins/adapter-build';
|
|
24
34
|
import { timberBuildReport } from './plugins/build-report';
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
35
|
+
import { createNoopTimer } from './utils/startup-timer';
|
|
36
|
+
import { resolveEncryptionKeyExpression, shouldEnableEncryption } from './server/action-encryption';
|
|
37
|
+
import { createHoldingServer } from './server/dev-holding-server.js';
|
|
38
|
+
import type { TimberUserConfig } from './config-types.js';
|
|
39
|
+
import type { PluginContext } from './plugin-context.js';
|
|
40
|
+
import {
|
|
41
|
+
createPluginContext,
|
|
42
|
+
loadTimberConfigFile,
|
|
43
|
+
mergeFileConfig,
|
|
44
|
+
resolveAppDir,
|
|
45
|
+
resolveClientJavascript,
|
|
46
|
+
} from './plugin-context.js';
|
|
29
47
|
|
|
30
|
-
|
|
31
|
-
export interface ClientJavascriptConfig {
|
|
32
|
-
/** When true, no client JS bundles are emitted or referenced in HTML. */
|
|
33
|
-
disabled: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* When `disabled` is true, still inject the Vite HMR client in dev mode
|
|
36
|
-
* so hot reloading works during development. Default: true.
|
|
37
|
-
*/
|
|
38
|
-
enableHMRInDev?: boolean;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** Fully resolved client JavaScript configuration (no optionals). */
|
|
42
|
-
export interface ResolvedClientJavascript {
|
|
43
|
-
disabled: boolean;
|
|
44
|
-
enableHMRInDev: boolean;
|
|
45
|
-
}
|
|
48
|
+
// ── Public API ────────────────────────────────────────────────────────────
|
|
46
49
|
|
|
47
|
-
export
|
|
48
|
-
output?: 'server' | 'static';
|
|
49
|
-
/**
|
|
50
|
-
* Enable timber debug logging in production builds.
|
|
51
|
-
*
|
|
52
|
-
* When `true`, timber's own diagnostics (dev warnings, verbose logging)
|
|
53
|
-
* are active even in production mode. React stays in production mode —
|
|
54
|
-
* only timber's logs are affected.
|
|
55
|
-
*
|
|
56
|
-
* Can also be enabled at runtime via the `TIMBER_DEBUG` environment variable.
|
|
57
|
-
*
|
|
58
|
-
* Default: `false`.
|
|
59
|
-
*/
|
|
60
|
-
debug?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Control client-side JavaScript output.
|
|
63
|
-
*
|
|
64
|
-
* Boolean shorthand:
|
|
65
|
-
* `clientJavascript: false` disables all client JS (equivalent to `{ disabled: true }`).
|
|
66
|
-
* `clientJavascript: true` enables client JS (the default).
|
|
67
|
-
*
|
|
68
|
-
* Object form:
|
|
69
|
-
* `clientJavascript: { disabled: true, enableHMRInDev: true }` disables client JS
|
|
70
|
-
* in production but preserves Vite HMR in dev mode.
|
|
71
|
-
*
|
|
72
|
-
* When `disabled` is true, `enableHMRInDev` defaults to `true`.
|
|
73
|
-
* Server-side JS still runs — this only affects what is sent to the browser.
|
|
74
|
-
*/
|
|
75
|
-
clientJavascript?: boolean | ClientJavascriptConfig;
|
|
76
|
-
adapter?: unknown;
|
|
77
|
-
cacheHandler?: unknown;
|
|
78
|
-
allowedOrigins?: string[];
|
|
79
|
-
csrf?: boolean;
|
|
80
|
-
limits?: {
|
|
81
|
-
actionBodySize?: string;
|
|
82
|
-
uploadBodySize?: string;
|
|
83
|
-
maxFields?: number;
|
|
84
|
-
};
|
|
85
|
-
pageExtensions?: string[];
|
|
86
|
-
/**
|
|
87
|
-
* Slow request threshold in milliseconds. Requests exceeding this emit
|
|
88
|
-
* a warning via the logger. Set to 0 to disable. Default: 3000.
|
|
89
|
-
*
|
|
90
|
-
* See design/17-logging.md §"slowRequestMs".
|
|
91
|
-
*/
|
|
92
|
-
slowRequestMs?: number;
|
|
93
|
-
/** Dev-mode options. These have no effect in production builds. */
|
|
94
|
-
dev?: {
|
|
95
|
-
/** Threshold in ms to highlight slow phases in dev logging output. Default: 200. */
|
|
96
|
-
slowPhaseMs?: number;
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Cookie signing configuration. See design/29-cookies.md §"Signed Cookies".
|
|
100
|
-
*
|
|
101
|
-
* Provide `secret` for a single key, or `secrets` (array) for key rotation.
|
|
102
|
-
* When `secrets` is used, index 0 is the signing key; all are tried for verification.
|
|
103
|
-
*/
|
|
104
|
-
cookies?: {
|
|
105
|
-
/** Single signing secret. Shorthand for `secrets: [secret]`. */
|
|
106
|
-
secret?: string;
|
|
107
|
-
/** Array of signing secrets for key rotation. Index 0 signs; all verify. */
|
|
108
|
-
secrets?: string[];
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* Override the app directory location. By default, timber auto-detects
|
|
112
|
-
* `app/` at the project root, falling back to `src/app/`.
|
|
113
|
-
*
|
|
114
|
-
* Set this to a relative path from the project root (e.g. `'src/app'`)
|
|
115
|
-
* to use a custom location.
|
|
116
|
-
*/
|
|
117
|
-
appDir?: string;
|
|
118
|
-
/** MDX compilation options passed to @mdx-js/rollup. See design/20-content-collections.md. */
|
|
119
|
-
mdx?: {
|
|
120
|
-
remarkPlugins?: unknown[];
|
|
121
|
-
rehypePlugins?: unknown[];
|
|
122
|
-
recmaPlugins?: unknown[];
|
|
123
|
-
remarkRehypeOptions?: Record<string, unknown>;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Built-in top-loader progress bar for client navigations.
|
|
127
|
-
* Shows an animated bar at the top of the viewport during RSC navigations.
|
|
128
|
-
* Enabled by default — set `enabled: false` to opt out.
|
|
129
|
-
*
|
|
130
|
-
* Users who want a fully custom progress indicator should disable this
|
|
131
|
-
* and use `useNavigationPending()` directly.
|
|
132
|
-
*
|
|
133
|
-
* See LOCAL-336 for design decisions.
|
|
134
|
-
*/
|
|
135
|
-
topLoader?: {
|
|
136
|
-
/** Whether the top-loader is enabled. Default: true. */
|
|
137
|
-
enabled?: boolean;
|
|
138
|
-
/** Bar color. Default: '#2299DD'. */
|
|
139
|
-
color?: string;
|
|
140
|
-
/** Bar height in pixels. Default: 3. */
|
|
141
|
-
height?: number;
|
|
142
|
-
/** Show subtle glow/shadow effect. Default: true. */
|
|
143
|
-
shadow?: boolean;
|
|
144
|
-
/** Delay in ms before showing the bar (avoids flash on fast navs). Default: 0. */
|
|
145
|
-
delay?: number;
|
|
146
|
-
/** CSS z-index. Default: 1600. */
|
|
147
|
-
zIndex?: number;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Response-level caching and deduplication.
|
|
151
|
-
*
|
|
152
|
-
* When enabled, concurrent requests to the same URL share a single render
|
|
153
|
-
* (singleflight), and recently rendered responses are reused from a short-TTL
|
|
154
|
-
* LRU cache without re-executing the RSC-to-SSR pipeline.
|
|
155
|
-
*
|
|
156
|
-
* Set to `false` to disable entirely. Default: enabled with sensible defaults.
|
|
157
|
-
*
|
|
158
|
-
* See design/31-benchmarking.md for performance context.
|
|
159
|
-
*/
|
|
160
|
-
responseCache?:
|
|
161
|
-
| false
|
|
162
|
-
| {
|
|
163
|
-
/** Maximum number of entries in the LRU cache. Default: 150. */
|
|
164
|
-
maxSize?: number;
|
|
165
|
-
/** TTL for cached entries in milliseconds. Default: 5000 (5s). */
|
|
166
|
-
ttlMs?: number;
|
|
167
|
-
/**
|
|
168
|
-
* When true (default), requests with Cookie or Authorization headers
|
|
169
|
-
* bypass the cache entirely. This prevents sharing user-specific
|
|
170
|
-
* responses across requests.
|
|
171
|
-
*
|
|
172
|
-
* Set to false to cache all responses regardless of auth state.
|
|
173
|
-
* Only do this if your pages are truly public and don't vary by user.
|
|
174
|
-
*/
|
|
175
|
-
publicOnly?: boolean;
|
|
176
|
-
};
|
|
177
|
-
}
|
|
50
|
+
export type { TimberUserConfig } from './config-types.js';
|
|
178
51
|
|
|
179
52
|
/**
|
|
180
|
-
*
|
|
53
|
+
* Route map interface — augmented by the generated timber-routes.d.ts.
|
|
54
|
+
*
|
|
55
|
+
* Each key is a route path pattern. Values have:
|
|
56
|
+
* segmentParams: shape of URL segment params (e.g. { id: string })
|
|
57
|
+
* searchParams: parsed type from search-params.ts, or {} if none
|
|
58
|
+
*
|
|
59
|
+
* This interface is empty by default and populated via codegen.
|
|
60
|
+
* See design/09-typescript.md §"Typed Routes".
|
|
181
61
|
*/
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if (typeof config.clientJavascript === 'boolean') {
|
|
185
|
-
// `clientJavascript: false` → disabled
|
|
186
|
-
// `clientJavascript: true` → enabled (default)
|
|
187
|
-
return {
|
|
188
|
-
disabled: !config.clientJavascript,
|
|
189
|
-
enableHMRInDev: !config.clientJavascript, // default true when disabled
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
// Object form
|
|
193
|
-
return {
|
|
194
|
-
disabled: config.clientJavascript.disabled,
|
|
195
|
-
enableHMRInDev: config.clientJavascript.enableHMRInDev ?? config.clientJavascript.disabled,
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Default: client JS enabled
|
|
200
|
-
return { disabled: false, enableHMRInDev: false };
|
|
201
|
-
}
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
63
|
+
export interface Routes {}
|
|
202
64
|
|
|
203
65
|
/**
|
|
204
|
-
*
|
|
66
|
+
* Type-safe helper for timber.config.ts files.
|
|
205
67
|
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
68
|
+
* A pass-through identity function that provides autocomplete and
|
|
69
|
+
* type checking for timber configuration. No runtime validation —
|
|
70
|
+
* purely a DX convenience (same pattern as Vite's defineConfig).
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* // timber.config.ts
|
|
75
|
+
* import { defineConfig } from '@timber-js/app';
|
|
76
|
+
*
|
|
77
|
+
* export default defineConfig({
|
|
78
|
+
* output: 'server',
|
|
79
|
+
* pageExtensions: ['tsx', 'ts', 'mdx'],
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
209
82
|
*/
|
|
210
|
-
export
|
|
211
|
-
config
|
|
212
|
-
/** Resolved client JavaScript configuration */
|
|
213
|
-
clientJavascript: ResolvedClientJavascript;
|
|
214
|
-
/** The scanned route tree (populated by timber-routing, consumed by timber-entries) */
|
|
215
|
-
routeTree: RouteTree | null;
|
|
216
|
-
/** Absolute path to the app/ directory */
|
|
217
|
-
appDir: string;
|
|
218
|
-
/** Absolute path to the project root */
|
|
219
|
-
root: string;
|
|
220
|
-
/** Whether the dev server is running (set by timber-root-sync in configResolved) */
|
|
221
|
-
dev: boolean;
|
|
222
|
-
/** CSS build manifest (populated by adapter after client build, null in dev) */
|
|
223
|
-
buildManifest: BuildManifest | null;
|
|
224
|
-
/** Startup timer for profiling cold start phases (active in dev, no-op in prod) */
|
|
225
|
-
timer: StartupTimer;
|
|
226
|
-
/** URL path to font CSS file, set by timber-fonts when fonts are registered */
|
|
227
|
-
fontCssUrl?: string;
|
|
83
|
+
export function defineConfig(config: TimberUserConfig): TimberUserConfig {
|
|
84
|
+
return config;
|
|
228
85
|
}
|
|
229
86
|
|
|
87
|
+
// ── Private helpers ───────────────────────────────────────────────────────
|
|
88
|
+
|
|
230
89
|
/**
|
|
231
|
-
* Resolve the
|
|
232
|
-
* 1. Explicit `configAppDir` from timber.config.ts
|
|
233
|
-
* 2. `<root>/app`
|
|
234
|
-
* 3. `<root>/src/app`
|
|
90
|
+
* Resolve the React Compiler plugin via @rolldown/plugin-babel.
|
|
235
91
|
*
|
|
236
|
-
*
|
|
92
|
+
* Uses the `reactCompilerPreset` from @vitejs/plugin-react, which:
|
|
93
|
+
* - Uses Babel ONLY for the compiler pass (OXC handles JSX)
|
|
94
|
+
* - Automatically scopes to client environment via applyToEnvironmentHook
|
|
95
|
+
* - Uses react/compiler-runtime built into React 19
|
|
96
|
+
*
|
|
97
|
+
* @rolldown/plugin-babel and babel-plugin-react-compiler are optional peer deps.
|
|
98
|
+
* If either is missing, require() fails with a clear error message.
|
|
237
99
|
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
100
|
+
function resolveReactCompilerPlugin(
|
|
101
|
+
config: true | { compilationMode?: string; target?: string },
|
|
102
|
+
req: NodeRequire
|
|
103
|
+
): PluginOption {
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
105
|
+
let babel: any;
|
|
106
|
+
try {
|
|
107
|
+
babel = req('@rolldown/plugin-babel');
|
|
108
|
+
} catch {
|
|
109
|
+
throw new Error(
|
|
110
|
+
'[timber] reactCompiler requires @rolldown/plugin-babel. ' +
|
|
111
|
+
'Install it: pnpm add -D @rolldown/plugin-babel babel-plugin-react-compiler'
|
|
112
|
+
);
|
|
245
113
|
}
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (existsSync(srcApp)) return srcApp;
|
|
252
|
-
|
|
253
|
-
throw new Error(
|
|
254
|
-
`[timber] Could not find app directory. Expected "app/" or "src/app/" in ${root}. ` +
|
|
255
|
-
`You can set appDir in timber.config.ts to specify a custom location.`
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function createPluginContext(config?: TimberUserConfig, root?: string): PluginContext {
|
|
260
|
-
const projectRoot = root ?? process.cwd();
|
|
261
|
-
const resolvedConfig: TimberUserConfig = { output: 'server', ...config };
|
|
262
|
-
// Timer starts as active — swapped to noop in configResolved for production builds
|
|
263
|
-
return {
|
|
264
|
-
config: resolvedConfig,
|
|
265
|
-
clientJavascript: resolveClientJavascript(resolvedConfig),
|
|
266
|
-
routeTree: null,
|
|
267
|
-
appDir: join(projectRoot, 'app'),
|
|
268
|
-
root: projectRoot,
|
|
269
|
-
dev: false,
|
|
270
|
-
buildManifest: null,
|
|
271
|
-
timer: createStartupTimer(),
|
|
272
|
-
};
|
|
114
|
+
const options = typeof config === 'object' ? config : {};
|
|
115
|
+
const babelPlugin = babel.default ?? babel;
|
|
116
|
+
return babelPlugin({
|
|
117
|
+
presets: [reactCompilerPreset(options as Parameters<typeof reactCompilerPreset>[0])],
|
|
118
|
+
}) as PluginOption;
|
|
273
119
|
}
|
|
274
120
|
|
|
275
121
|
/**
|
|
276
|
-
*
|
|
277
|
-
*
|
|
122
|
+
* Build the options object for @vitejs/plugin-rsc.
|
|
123
|
+
*
|
|
124
|
+
* Uses a getter for `enableActionEncryption` so the RSC plugin reads
|
|
125
|
+
* the value lazily — after ctx.dev is set in configResolved. This lets
|
|
126
|
+
* `actionEncryption.disableInDev` work correctly even though the RSC
|
|
127
|
+
* plugin is created before Vite resolves the command.
|
|
278
128
|
*/
|
|
279
|
-
|
|
280
|
-
|
|
129
|
+
function createRscOptions(
|
|
130
|
+
ctx: PluginContext,
|
|
131
|
+
encryptionKeyExpr: string | undefined
|
|
132
|
+
): Record<string, unknown> {
|
|
133
|
+
const options: Record<string, unknown> = {
|
|
134
|
+
serverHandler: false,
|
|
135
|
+
customClientEntry: true,
|
|
136
|
+
entries: {
|
|
137
|
+
rsc: 'virtual:timber-rsc-entry',
|
|
138
|
+
ssr: 'virtual:timber-ssr-entry',
|
|
139
|
+
client: 'virtual:timber-browser-entry',
|
|
140
|
+
},
|
|
141
|
+
// Group client references by layout boundary to balance route-scoped code
|
|
142
|
+
// splitting with HTTP request count. A constant group name ('client-refs')
|
|
143
|
+
// would collapse all routes into one chunk — any page downloads every
|
|
144
|
+
// client component. Per-serverChunk grouping creates many sub-500B files.
|
|
145
|
+
// Layout-boundary grouping is the middle ground: components under the same
|
|
146
|
+
// layout segment share a chunk. See design/27-chunking-strategy.md, TIM-440, TIM-499.
|
|
147
|
+
clientChunks: (meta: { id: string; normalizedId: string; serverChunk: string }) =>
|
|
148
|
+
clientChunkGroup(meta, ctx.appDir),
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Bound args encryption — AES-256-GCM authenticated encryption for
|
|
152
|
+
// closure variables in 'use server' functions. Always on in production,
|
|
153
|
+
// configurable in dev. See design/08-forms-and-actions.md §"Bound Args Encryption".
|
|
154
|
+
//
|
|
155
|
+
// Uses a getter so the RSC plugin reads the value lazily in its transform
|
|
156
|
+
// hooks, after ctx.dev is set in configResolved. This lets disableInDev
|
|
157
|
+
// work correctly — ctx.dev is false at construction time but true during
|
|
158
|
+
// dev server transforms.
|
|
159
|
+
Object.defineProperty(options, 'enableActionEncryption', {
|
|
160
|
+
get() {
|
|
161
|
+
return shouldEnableEncryption(ctx.dev, ctx.config.actionEncryption);
|
|
162
|
+
},
|
|
163
|
+
enumerable: true,
|
|
164
|
+
});
|
|
281
165
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
return (mod.default ?? mod) as TimberUserConfig;
|
|
287
|
-
}
|
|
166
|
+
// When TIMBER_ACTIONS_ENCRYPTION_KEY is set, pass it as a runtime expression
|
|
167
|
+
// so the RSC plugin uses it instead of auto-generating a per-build key.
|
|
168
|
+
if (encryptionKeyExpr) {
|
|
169
|
+
options.defineEncryptionKey = encryptionKeyExpr;
|
|
288
170
|
}
|
|
289
|
-
|
|
171
|
+
|
|
172
|
+
return options;
|
|
290
173
|
}
|
|
291
174
|
|
|
175
|
+
// NOTE: 'use cache' directive transform removed — future feature pending design doc.
|
|
176
|
+
// The timber.cache() API (createCache) remains available for explicit caching.
|
|
177
|
+
// See design/06-caching.md.
|
|
178
|
+
|
|
179
|
+
// ── Main plugin factory ──────────────────────────────────────────────────
|
|
180
|
+
|
|
292
181
|
/**
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
182
|
+
* Create the timber Vite plugin array.
|
|
183
|
+
*
|
|
184
|
+
* Loads timber.config.ts and all dependencies synchronously before
|
|
185
|
+
* constructing the plugin array. This ensures ALL plugins — including
|
|
186
|
+
* the RSC plugin and React Compiler — see the fully merged config
|
|
187
|
+
* (inline + file-based). No async, no deferred config, no stale reads.
|
|
296
188
|
*
|
|
297
|
-
*
|
|
189
|
+
* Requires Node >= 22.12 for synchronous require() of ESM modules
|
|
190
|
+
* (@vitejs/plugin-rsc is ESM-only).
|
|
191
|
+
*
|
|
192
|
+
* Previous versions used async loading and deferred config merging,
|
|
193
|
+
* causing file-based config for reactCompiler, actionEncryption, and
|
|
194
|
+
* output mode to be silently ignored. See TIM-451.
|
|
298
195
|
*/
|
|
299
|
-
export function
|
|
300
|
-
|
|
301
|
-
fileConfig: TimberUserConfig
|
|
302
|
-
): string[] {
|
|
303
|
-
const conflicts: string[] = [];
|
|
304
|
-
for (const key of Object.keys(fileConfig) as (keyof TimberUserConfig)[]) {
|
|
305
|
-
if (key === 'output') continue;
|
|
306
|
-
if (key in inline && inline[key] !== undefined) {
|
|
307
|
-
conflicts.push(key);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
if (conflicts.length > 0) {
|
|
311
|
-
console.warn(
|
|
312
|
-
`[timber] Config conflict: ${conflicts.map((k) => `"${k}"`).join(', ')} set in both ` +
|
|
313
|
-
`vite.config.ts (inline) and timber.config.ts. ` +
|
|
314
|
-
`Move all config to timber.config.ts to avoid confusion. ` +
|
|
315
|
-
`The inline value from vite.config.ts will be used.`
|
|
316
|
-
);
|
|
317
|
-
}
|
|
318
|
-
return conflicts;
|
|
319
|
-
}
|
|
196
|
+
export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
197
|
+
const ctx = createPluginContext(config);
|
|
320
198
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
const inline = ctx.config;
|
|
199
|
+
// Resolve dependencies from the consumer's project (process.cwd()),
|
|
200
|
+
// not from timber's own node_modules. This is critical for pnpm link:
|
|
201
|
+
// when linked, timber's node_modules has a separate vite instance, and
|
|
202
|
+
// the RSC plugin must use the same vite instance as the dev server.
|
|
203
|
+
const consumerRequire = createRequire(join(process.cwd(), 'package.json'));
|
|
327
204
|
|
|
328
|
-
//
|
|
329
|
-
|
|
205
|
+
// ── Step 1: Load @vitejs/plugin-rsc ─────────────────────────────────
|
|
206
|
+
// Synchronous require() works for ESM modules on Node 22.12+.
|
|
207
|
+
ctx.timer.start('rsc-plugin-import');
|
|
208
|
+
const rscMod = consumerRequire('@vitejs/plugin-rsc');
|
|
209
|
+
const vitePluginRsc = rscMod.default ?? rscMod;
|
|
210
|
+
ctx.timer.end('rsc-plugin-import');
|
|
330
211
|
|
|
331
|
-
//
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
...inline,
|
|
335
|
-
// Deep merge for nested objects where both exist
|
|
336
|
-
...(fileConfig.limits && inline.limits
|
|
337
|
-
? { limits: { ...fileConfig.limits, ...inline.limits } }
|
|
338
|
-
: {}),
|
|
339
|
-
...(fileConfig.dev && inline.dev ? { dev: { ...fileConfig.dev, ...inline.dev } } : {}),
|
|
340
|
-
...(fileConfig.mdx && inline.mdx ? { mdx: { ...fileConfig.mdx, ...inline.mdx } } : {}),
|
|
341
|
-
};
|
|
342
|
-
}
|
|
212
|
+
// ── Step 2: Compute config-dependent options ────────────────────────
|
|
213
|
+
// encryptionKeyExpr is env-based and doesn't depend on file config.
|
|
214
|
+
const encryptionKeyExpr = resolveEncryptionKeyExpression();
|
|
343
215
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
216
|
+
// ── Step 3: Pre-load file config for plugin resolution ──────────────
|
|
217
|
+
// Load timber.config.ts eagerly from process.cwd() so we can resolve
|
|
218
|
+
// plugins (like React Compiler) and add them to the top-level array.
|
|
219
|
+
// Vite's config() hook return type is Omit<UserConfig, 'plugins'> —
|
|
220
|
+
// plugins returned from config() are silently ignored. See TIM-632.
|
|
221
|
+
//
|
|
222
|
+
// The config() hook still loads from the correct Vite root (which may
|
|
223
|
+
// differ from cwd in monorepo setups — see TIM-498), but only for
|
|
224
|
+
// non-plugin config merging.
|
|
225
|
+
const earlyFileConfig = loadTimberConfigFile(process.cwd());
|
|
347
226
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
//
|
|
351
|
-
//
|
|
352
|
-
// Also loads timber.config.ts and merges it into ctx.config (inline config wins).
|
|
227
|
+
// ── Step 4: Build rootSync plugin ───────────────────────────────────
|
|
228
|
+
// rootSync loads timber.config.ts from Vite's resolved root and merges
|
|
229
|
+
// it into ctx.config. Plugin resolution is handled eagerly above — the
|
|
230
|
+
// config() hook must NOT return a `plugins` field (Vite ignores it).
|
|
353
231
|
const rootSync: Plugin = {
|
|
354
232
|
name: 'timber-root-sync',
|
|
355
|
-
|
|
356
|
-
// Load timber.config.ts
|
|
357
|
-
//
|
|
358
|
-
//
|
|
359
|
-
|
|
233
|
+
config(userConfig, { command }) {
|
|
234
|
+
// ── Load timber.config.ts from the correct root ───────────────
|
|
235
|
+
// Vite's `config` hook fires before `configResolved`. The user's
|
|
236
|
+
// `root` option (if set) tells us where the project lives.
|
|
237
|
+
// `resolve()` mirrors Vite's own root resolution logic.
|
|
238
|
+
const viteRoot = resolve(userConfig.root ?? process.cwd());
|
|
360
239
|
ctx.timer.start('config-load');
|
|
361
|
-
const fileConfig =
|
|
240
|
+
const fileConfig = loadTimberConfigFile(viteRoot);
|
|
362
241
|
if (fileConfig) {
|
|
363
242
|
mergeFileConfig(ctx, fileConfig);
|
|
364
243
|
ctx.clientJavascript = resolveClientJavascript(ctx.config);
|
|
365
244
|
}
|
|
245
|
+
// Apply defaults AFTER merge so file-based config isn't overridden
|
|
246
|
+
// by defaults that were baked into the inline config object.
|
|
247
|
+
ctx.config.output ??= 'server';
|
|
366
248
|
ctx.timer.end('config-load');
|
|
367
249
|
|
|
250
|
+
// Warn if the Vite root differs from cwd and the re-loaded config
|
|
251
|
+
// has reactCompiler but the early cwd-based load missed it. In this
|
|
252
|
+
// edge case the user must move reactCompiler to inline config.
|
|
253
|
+
if (viteRoot !== process.cwd()) {
|
|
254
|
+
const hasCompilerInReloaded = !config?.reactCompiler && ctx.config.reactCompiler;
|
|
255
|
+
const hadCompilerInEarly = !config?.reactCompiler && earlyFileConfig?.reactCompiler;
|
|
256
|
+
if (hasCompilerInReloaded && !hadCompilerInEarly) {
|
|
257
|
+
console.warn(
|
|
258
|
+
'[timber] reactCompiler is set in timber.config.ts but could not be ' +
|
|
259
|
+
'registered because the config file is in a non-cwd root directory. ' +
|
|
260
|
+
'Move reactCompiler to the inline timber() config in vite.config.ts, or ' +
|
|
261
|
+
'run vite from the project root directory.'
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
368
266
|
// Force production JSX transform for builds.
|
|
369
267
|
//
|
|
370
268
|
// Vite determines dev vs prod JSX via `isProduction`, which checks
|
|
@@ -378,6 +276,38 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
378
276
|
// We explicitly set `oxc.jsx.development: false` for builds so
|
|
379
277
|
// the client bundle always uses jsx/jsxs from react/jsx-runtime,
|
|
380
278
|
// regardless of the ambient NODE_ENV value.
|
|
279
|
+
// ── Start holding server for dev mode ───────────────────────
|
|
280
|
+
// Bind the port immediately so browsers see a loading page
|
|
281
|
+
// instead of ERR_CONNECTION_REFUSED during the ~6-8s startup.
|
|
282
|
+
// The holding server is closed in timber-dev-server's
|
|
283
|
+
// configureServer hook (the last plugin), right before Vite
|
|
284
|
+
// calls server.listen().
|
|
285
|
+
// See design/21-dev-server.md §"Startup Holding Server", TIM-665.
|
|
286
|
+
if (command === 'serve') {
|
|
287
|
+
const port = (userConfig.server?.port as number) ?? 5173;
|
|
288
|
+
try {
|
|
289
|
+
ctx.holdingServer = createHoldingServer();
|
|
290
|
+
// listen() is async but we fire-and-forget — the server
|
|
291
|
+
// starts binding immediately and will be ready well before
|
|
292
|
+
// any browser request arrives. We can't await here because
|
|
293
|
+
// config() must return synchronously.
|
|
294
|
+
ctx.holdingServer.listen(port).then(
|
|
295
|
+
(boundPort) => {
|
|
296
|
+
const url = `http://localhost:${boundPort}`;
|
|
297
|
+
console.log(
|
|
298
|
+
`\n \x1b[2m🪵 timber.js dev server starting at\x1b[0m \x1b[36m${url}\x1b[0m\n`
|
|
299
|
+
);
|
|
300
|
+
},
|
|
301
|
+
() => {
|
|
302
|
+
// Port already in use — skip gracefully.
|
|
303
|
+
ctx.holdingServer = null;
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
} catch {
|
|
307
|
+
ctx.holdingServer = null;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
381
311
|
if (command === 'build') {
|
|
382
312
|
return {
|
|
383
313
|
oxc: {
|
|
@@ -401,17 +331,28 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
401
331
|
}
|
|
402
332
|
},
|
|
403
333
|
};
|
|
334
|
+
|
|
335
|
+
// ── Step 5: Resolve optional plugins ────────────────────────────────
|
|
336
|
+
// React Compiler — resolved eagerly from either inline or file config.
|
|
337
|
+
// Vite's config() hook return type is Omit<UserConfig, 'plugins'>, so
|
|
338
|
+
// plugins MUST be in the top-level array — returning them from config()
|
|
339
|
+
// silently drops them. See TIM-632.
|
|
340
|
+
//
|
|
341
|
+
// Inline config takes precedence. File config (from the early cwd-based
|
|
342
|
+
// load) is used when inline config doesn't set reactCompiler.
|
|
343
|
+
const reactCompilerPlugins: PluginOption[] = [];
|
|
344
|
+
const effectiveReactCompiler = config?.reactCompiler ?? earlyFileConfig?.reactCompiler;
|
|
345
|
+
if (effectiveReactCompiler) {
|
|
346
|
+
reactCompilerPlugins.push(resolveReactCompilerPlugin(effectiveReactCompiler, consumerRequire));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// ── Step 6: Assemble plugin array ─────────────────────────────────────
|
|
404
350
|
// @vitejs/plugin-rsc handles:
|
|
405
351
|
// - RSC/SSR/client environment setup
|
|
406
352
|
// - "use client" directive → client reference proxy transformation
|
|
407
353
|
// - "use server" directive → server reference transformation
|
|
408
354
|
// - Client reference tracking and module map generation
|
|
409
355
|
//
|
|
410
|
-
// Loaded via dynamic import() because @vitejs/plugin-rsc is ESM-only.
|
|
411
|
-
// Vite's config loader uses esbuild to transpile to CJS, which breaks
|
|
412
|
-
// static imports of ESM-only packages. The dynamic import() is preserved
|
|
413
|
-
// by esbuild and runs natively in ESM at runtime.
|
|
414
|
-
//
|
|
415
356
|
// serverHandler: false — timber has its own dev server (timber-dev-server)
|
|
416
357
|
// entries — tells the RSC plugin about timber's virtual entry modules so
|
|
417
358
|
// it correctly wires up the browser entry (needed for React Fast Refresh
|
|
@@ -424,30 +365,6 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
424
365
|
// We do NOT set customBuildApp — the RSC plugin's orchestration is correct
|
|
425
366
|
// and handles bundle ordering, asset manifest generation, and environment
|
|
426
367
|
// imports manifest. See @vitejs/plugin-rsc's buildApp implementation.
|
|
427
|
-
// Resolve @vitejs/plugin-rsc from the consumer's project (process.cwd()),
|
|
428
|
-
// not from timber's own node_modules. This is critical for pnpm link:
|
|
429
|
-
// when linked, timber's node_modules has a separate vite instance, and
|
|
430
|
-
// the RSC plugin must use the same vite instance as the dev server.
|
|
431
|
-
const consumerRequire = createRequire(join(process.cwd(), 'package.json'));
|
|
432
|
-
const rscPluginPath = consumerRequire.resolve('@vitejs/plugin-rsc');
|
|
433
|
-
ctx.timer.start('rsc-plugin-import');
|
|
434
|
-
const rscPluginsPromise = import(pathToFileURL(rscPluginPath).href).then(
|
|
435
|
-
({ default: vitePluginRsc }) => {
|
|
436
|
-
ctx.timer.end('rsc-plugin-import');
|
|
437
|
-
return vitePluginRsc({
|
|
438
|
-
serverHandler: false,
|
|
439
|
-
customClientEntry: true,
|
|
440
|
-
entries: {
|
|
441
|
-
rsc: 'virtual:timber-rsc-entry',
|
|
442
|
-
ssr: 'virtual:timber-ssr-entry',
|
|
443
|
-
client: 'virtual:timber-browser-entry',
|
|
444
|
-
},
|
|
445
|
-
// No custom clientChunks — Rolldown handles natural code splitting.
|
|
446
|
-
// See design/27-chunking-strategy.md and LOCAL-337.
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
);
|
|
450
|
-
|
|
451
368
|
return [
|
|
452
369
|
rootSync,
|
|
453
370
|
timberReactProd(),
|
|
@@ -456,15 +373,14 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
456
373
|
// following Vinext's convention — the RSC plugin's virtual browser entry
|
|
457
374
|
// coordinates with plugin-react via __vite_plugin_react_preamble_installed__.
|
|
458
375
|
react(),
|
|
376
|
+
...reactCompilerPlugins,
|
|
459
377
|
timberServerActionExports(),
|
|
460
|
-
|
|
378
|
+
vitePluginRsc(createRscOptions(ctx, encryptionKeyExpr)),
|
|
461
379
|
timberShims(ctx),
|
|
462
380
|
timberRouting(ctx),
|
|
463
381
|
timberEntries(ctx),
|
|
464
382
|
timberBuildManifest(ctx),
|
|
465
|
-
timberCache(ctx),
|
|
466
383
|
timberStaticBuild(ctx),
|
|
467
|
-
timberDynamicTransform(ctx),
|
|
468
384
|
timberFonts(ctx),
|
|
469
385
|
timberMdx(ctx),
|
|
470
386
|
timberContent(ctx),
|
|
@@ -473,21 +389,9 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
473
389
|
timberBuildReport(ctx), // Post-build: route table with bundle sizes
|
|
474
390
|
timberAdapterBuild(ctx), // Post-build: invoke adapter.buildOutput()
|
|
475
391
|
timberDevLogs(ctx), // Dev-only: forward server console.* to browser console
|
|
392
|
+
timberDevBrowserLogs(ctx), // Dev-only: forward browser console.* to server terminal
|
|
476
393
|
timberDevServer(ctx), // Must be last — configureServer post-hook runs after all watchers
|
|
477
394
|
];
|
|
478
395
|
}
|
|
479
396
|
|
|
480
|
-
/**
|
|
481
|
-
* Route map interface — augmented by the generated timber-routes.d.ts.
|
|
482
|
-
*
|
|
483
|
-
* Each key is a route path pattern. Values have:
|
|
484
|
-
* params: shape of URL params (e.g. { id: string })
|
|
485
|
-
* searchParams: parsed type from search-params.ts, or {} if none
|
|
486
|
-
*
|
|
487
|
-
* This interface is empty by default and populated via codegen.
|
|
488
|
-
* See design/09-typescript.md §"Typed Routes".
|
|
489
|
-
*/
|
|
490
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
491
|
-
export interface Routes {}
|
|
492
|
-
|
|
493
397
|
export default timber;
|