@timber-js/app 0.2.0-alpha.15 → 0.2.0-alpha.150
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-a0RczDnB.js +1106 -0
- package/dist/_chunks/actions-a0RczDnB.js.map +1 -0
- package/dist/_chunks/build-output-helper-B20ZuTSA.js +102 -0
- package/dist/_chunks/build-output-helper-B20ZuTSA.js.map +1 -0
- package/dist/_chunks/cache-api-Co-yI-gP.js +424 -0
- package/dist/_chunks/cache-api-Co-yI-gP.js.map +1 -0
- package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js → canonicalize-P41GR6tY.js} +94 -18
- package/dist/_chunks/canonicalize-P41GR6tY.js.map +1 -0
- package/dist/_chunks/cli-schema-sync-DJDdyEae.js +629 -0
- package/dist/_chunks/cli-schema-sync-DJDdyEae.js.map +1 -0
- package/dist/_chunks/cli-schema-sync-D_IhHEUW.js +2 -0
- package/dist/_chunks/codec-registry-oOUxugz3.js +21 -0
- package/dist/_chunks/codec-registry-oOUxugz3.js.map +1 -0
- package/dist/_chunks/define-Bssfp6ot.js +82 -0
- package/dist/_chunks/define-Bssfp6ot.js.map +1 -0
- package/dist/_chunks/define-CFmvb4Bt.js +203 -0
- package/dist/_chunks/define-CFmvb4Bt.js.map +1 -0
- package/dist/_chunks/fast-hash-D6hIVt1Y.js +36 -0
- package/dist/_chunks/fast-hash-D6hIVt1Y.js.map +1 -0
- package/dist/_chunks/format-CfwjgPz9.js +14 -0
- package/dist/_chunks/format-CfwjgPz9.js.map +1 -0
- package/dist/_chunks/href-validation-FiA_rToW.js +141 -0
- package/dist/_chunks/href-validation-FiA_rToW.js.map +1 -0
- package/dist/_chunks/logger-CM0clugc.js +645 -0
- package/dist/_chunks/logger-CM0clugc.js.map +1 -0
- package/dist/_chunks/navigation-root-bUDZLw74.js +124 -0
- package/dist/_chunks/navigation-root-bUDZLw74.js.map +1 -0
- package/dist/_chunks/plugin-context-DurqFBuY.js +2 -0
- package/dist/_chunks/plugin-context-GfDWsdd2.js +268 -0
- package/dist/_chunks/plugin-context-GfDWsdd2.js.map +1 -0
- package/dist/_chunks/registry-DbJPKoBp.js +20 -0
- package/dist/_chunks/registry-DbJPKoBp.js.map +1 -0
- package/dist/_chunks/resolve-schema-3iUvBV5T.js +50 -0
- package/dist/_chunks/resolve-schema-3iUvBV5T.js.map +1 -0
- package/dist/_chunks/router-ref-CtmF-aPv.js +28 -0
- package/dist/_chunks/router-ref-CtmF-aPv.js.map +1 -0
- package/dist/_chunks/schema-bridge-BY3QLBL7.js +119 -0
- package/dist/_chunks/schema-bridge-BY3QLBL7.js.map +1 -0
- package/dist/_chunks/segment-classify-CDDRVKs7.js +137 -0
- package/dist/_chunks/segment-classify-CDDRVKs7.js.map +1 -0
- package/dist/_chunks/segment-context-ZDnXDkbz.js +34 -0
- package/dist/_chunks/segment-context-ZDnXDkbz.js.map +1 -0
- package/dist/_chunks/{ssr-data-MjmprTmO.js → ssr-data-BOWsq18U.js} +1 -1
- package/dist/_chunks/ssr-data-BOWsq18U.js.map +1 -0
- package/dist/_chunks/tree-match-D2l830j2.js +102 -0
- package/dist/_chunks/tree-match-D2l830j2.js.map +1 -0
- package/dist/_chunks/{use-query-states-D5KaffOK.js → use-query-states-CbeQmext.js} +7 -20
- package/dist/_chunks/use-query-states-CbeQmext.js.map +1 -0
- package/dist/_chunks/use-segment-params-D1CzlgBo.js +151 -0
- package/dist/_chunks/use-segment-params-D1CzlgBo.js.map +1 -0
- package/dist/_chunks/validation-taUkvA4Q.js +113 -0
- package/dist/_chunks/validation-taUkvA4Q.js.map +1 -0
- package/dist/_chunks/walkers-DvWDj453.js +790 -0
- package/dist/_chunks/walkers-DvWDj453.js.map +1 -0
- package/dist/adapters/build-output-helper.d.ts +28 -0
- package/dist/adapters/build-output-helper.d.ts.map +1 -0
- package/dist/adapters/cloudflare-dev.d.ts +109 -0
- package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
- package/dist/adapters/cloudflare-dev.js +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 +117 -0
- package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
- package/dist/adapters/cloudflare.d.ts +142 -20
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +150 -64
- package/dist/adapters/cloudflare.js.map +1 -1
- package/dist/adapters/compress-module.d.ts +5 -4
- package/dist/adapters/compress-module.d.ts.map +1 -1
- package/dist/adapters/nitro.d.ts +17 -3
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +146 -147
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/shared.d.ts +16 -0
- package/dist/adapters/shared.d.ts.map +1 -0
- 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 +25 -7
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +100 -240
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/invalidation-epoch.d.ts +43 -0
- package/dist/cache/invalidation-epoch.d.ts.map +1 -0
- package/dist/cache/redis-handler.d.ts +85 -8
- package/dist/cache/redis-handler.d.ts.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/stable-stringify.d.ts +9 -0
- package/dist/cache/stable-stringify.d.ts.map +1 -1
- package/dist/cache/timber-cache.d.ts +20 -10
- package/dist/cache/timber-cache.d.ts.map +1 -1
- package/dist/cli-schema-sync.d.ts +59 -0
- package/dist/cli-schema-sync.d.ts.map +1 -0
- package/dist/cli.d.ts +26 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +70 -33
- package/dist/cli.js.map +1 -1
- package/dist/client/browser-dev.d.ts +34 -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 +29 -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 +26 -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 +28 -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 +47 -10
- package/dist/client/error-boundary.js.map +1 -1
- package/dist/client/error-reconstituter.d.ts +61 -0
- package/dist/client/error-reconstituter.d.ts.map +1 -0
- package/dist/client/form.d.ts +16 -27
- package/dist/client/form.d.ts.map +1 -1
- package/dist/client/history.d.ts +11 -3
- package/dist/client/history.d.ts.map +1 -1
- package/dist/client/index.d.ts +10 -24
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +183 -1134
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +19 -0
- package/dist/client/internal.d.ts.map +1 -0
- package/dist/client/internal.js +900 -0
- package/dist/client/internal.js.map +1 -0
- package/dist/client/link.d.ts +69 -60
- package/dist/client/link.d.ts.map +1 -1
- 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 +122 -0
- package/dist/client/navigation-api.d.ts.map +1 -0
- package/dist/client/navigation-context.d.ts +3 -2
- package/dist/client/navigation-context.d.ts.map +1 -1
- package/dist/client/navigation-root.d.ts +119 -0
- package/dist/client/navigation-root.d.ts.map +1 -0
- package/dist/client/nuqs-adapter.d.ts +1 -1
- package/dist/client/nuqs-adapter.d.ts.map +1 -1
- package/dist/client/router-ref.d.ts +1 -1
- package/dist/client/router.d.ts +86 -10
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/rsc-fetch.d.ts +46 -3
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +3 -1
- package/dist/client/segment-cache.d.ts.map +1 -1
- package/dist/client/segment-outlet.d.ts +49 -0
- package/dist/client/segment-outlet.d.ts.map +1 -0
- package/dist/client/segment-update-context.d.ts +21 -0
- package/dist/client/segment-update-context.d.ts.map +1 -0
- package/dist/client/shallow-url.d.ts +10 -0
- package/dist/client/shallow-url.d.ts.map +1 -0
- package/dist/client/ssr-data.d.ts +13 -4
- package/dist/client/ssr-data.d.ts.map +1 -1
- package/dist/client/state.d.ts +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-cookie.d.ts +12 -0
- package/dist/client/use-cookie.d.ts.map +1 -1
- package/dist/client/use-link-status.d.ts +5 -5
- package/dist/client/use-link-status.d.ts.map +1 -1
- package/dist/client/use-pathname.d.ts.map +1 -1
- package/dist/client/use-pending-navigation.d.ts +23 -0
- package/dist/client/use-pending-navigation.d.ts.map +1 -0
- package/dist/client/use-query-states.d.ts +1 -1
- package/dist/client/use-query-states.d.ts.map +1 -1
- package/dist/client/use-router.d.ts +1 -1
- package/dist/client/use-router.d.ts.map +1 -1
- package/dist/client/use-search-params.d.ts +12 -5
- package/dist/client/use-search-params.d.ts.map +1 -1
- package/dist/client/{use-params.d.ts → use-segment-params.d.ts} +8 -6
- package/dist/client/use-segment-params.d.ts.map +1 -0
- package/dist/codec.d.ts +69 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +75 -0
- package/dist/codec.js.map +1 -0
- package/dist/config-types.d.ts +294 -0
- package/dist/config-types.d.ts.map +1 -0
- package/dist/config-validation.d.ts +51 -0
- package/dist/config-validation.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 +58 -25
- package/dist/cookies/define-cookie.d.ts.map +1 -1
- package/dist/cookies/index.d.ts +2 -1
- package/dist/cookies/index.d.ts.map +1 -1
- package/dist/cookies/index.js +249 -36
- package/dist/cookies/index.js.map +1 -1
- package/dist/cookies/json-cookie.d.ts +64 -0
- package/dist/cookies/json-cookie.d.ts.map +1 -0
- package/dist/cookies/validation.d.ts +34 -0
- package/dist/cookies/validation.d.ts.map +1 -0
- package/dist/dev-tools/404-page.d.ts +50 -0
- package/dist/dev-tools/404-page.d.ts.map +1 -0
- package/dist/dev-tools/browser-logs.d.ts +84 -0
- package/dist/dev-tools/browser-logs.d.ts.map +1 -0
- package/dist/dev-tools/dev-page-shell.d.ts +78 -0
- package/dist/dev-tools/dev-page-shell.d.ts.map +1 -0
- package/dist/dev-tools/error-page.d.ts +32 -0
- package/dist/dev-tools/error-page.d.ts.map +1 -0
- package/dist/dev-tools/holding-server.d.ts +54 -0
- package/dist/dev-tools/holding-server.d.ts.map +1 -0
- package/dist/dev-tools/hydration-overlay.d.ts +11 -0
- package/dist/dev-tools/hydration-overlay.d.ts.map +1 -0
- package/dist/dev-tools/index.d.ts +31 -0
- package/dist/dev-tools/index.d.ts.map +1 -0
- package/dist/dev-tools/instrumentation.d.ts +59 -0
- package/dist/dev-tools/instrumentation.d.ts.map +1 -0
- package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
- package/dist/dev-tools/logger.d.ts.map +1 -0
- package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +2 -2
- package/dist/dev-tools/logs.d.ts.map +1 -0
- package/dist/dev-tools/overlay.d.ts +91 -0
- package/dist/dev-tools/overlay.d.ts.map +1 -0
- package/dist/dev-tools/stack-classifier.d.ts +34 -0
- package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
- package/dist/dev-tools/terminal.d.ts +28 -0
- package/dist/dev-tools/terminal.d.ts.map +1 -0
- package/dist/fonts/ast-walk.d.ts +68 -0
- package/dist/fonts/ast-walk.d.ts.map +1 -0
- package/dist/fonts/ast.d.ts +110 -6
- package/dist/fonts/ast.d.ts.map +1 -1
- package/dist/fonts/bundle.d.ts +50 -0
- package/dist/fonts/bundle.d.ts.map +1 -0
- package/dist/fonts/dev-middleware.d.ts +22 -0
- package/dist/fonts/dev-middleware.d.ts.map +1 -0
- package/dist/fonts/fallbacks.d.ts +0 -7
- package/dist/fonts/fallbacks.d.ts.map +1 -1
- package/dist/fonts/google.d.ts +4 -2
- package/dist/fonts/google.d.ts.map +1 -1
- package/dist/fonts/local.d.ts +4 -4
- package/dist/fonts/local.d.ts.map +1 -1
- package/dist/fonts/paths.d.ts +43 -0
- package/dist/fonts/paths.d.ts.map +1 -0
- package/dist/fonts/pipeline.d.ts +158 -0
- package/dist/fonts/pipeline.d.ts.map +1 -0
- package/dist/fonts/transform.d.ts +78 -0
- package/dist/fonts/transform.d.ts.map +1 -0
- package/dist/fonts/types.d.ts +47 -1
- package/dist/fonts/types.d.ts.map +1 -1
- package/dist/fonts/virtual-modules.d.ts +77 -0
- package/dist/fonts/virtual-modules.d.ts.map +1 -0
- package/dist/index.d.ts +46 -180
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6432 -13423
- package/dist/index.js.map +1 -1
- package/dist/params/codec-registry.d.ts +26 -0
- package/dist/params/codec-registry.d.ts.map +1 -0
- package/dist/params/define-schema.d.ts +81 -0
- package/dist/params/define-schema.d.ts.map +1 -0
- package/dist/params/index.d.ts +5 -0
- package/dist/params/index.d.ts.map +1 -0
- package/dist/params/index.js +34 -0
- package/dist/params/index.js.map +1 -0
- package/dist/params/resolve-schema.d.ts +34 -0
- package/dist/params/resolve-schema.d.ts.map +1 -0
- package/dist/plugin-context.d.ts +137 -0
- package/dist/plugin-context.d.ts.map +1 -0
- package/dist/plugins/adapter-build.d.ts +20 -1
- package/dist/plugins/adapter-build.d.ts.map +1 -1
- package/dist/plugins/build-manifest.d.ts +7 -3
- package/dist/plugins/build-manifest.d.ts.map +1 -1
- package/dist/plugins/build-report.d.ts +9 -7
- package/dist/plugins/build-report.d.ts.map +1 -1
- package/dist/plugins/cache.d.ts +73 -0
- package/dist/plugins/cache.d.ts.map +1 -0
- package/dist/plugins/client-chunks.d.ts +39 -0
- package/dist/plugins/client-chunks.d.ts.map +1 -0
- package/dist/plugins/cloudflare-wasm.d.ts +21 -0
- package/dist/plugins/cloudflare-wasm.d.ts.map +1 -0
- package/dist/plugins/content.d.ts +1 -1
- package/dist/plugins/content.d.ts.map +1 -1
- package/dist/plugins/dev-server.d.ts +17 -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 +16 -73
- 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 +29 -5
- package/dist/plugins/shims.d.ts.map +1 -1
- package/dist/plugins/static-build.d.ts +5 -26
- package/dist/plugins/static-build.d.ts.map +1 -1
- package/dist/routing/codegen-shared.d.ts +67 -0
- package/dist/routing/codegen-shared.d.ts.map +1 -0
- package/dist/routing/codegen-types.d.ts +64 -0
- package/dist/routing/codegen-types.d.ts.map +1 -0
- package/dist/routing/codegen.d.ts +7 -2
- package/dist/routing/codegen.d.ts.map +1 -1
- package/dist/routing/convention-lint.d.ts +41 -0
- package/dist/routing/convention-lint.d.ts.map +1 -0
- package/dist/routing/file-cache.d.ts +8 -0
- package/dist/routing/file-cache.d.ts.map +1 -0
- package/dist/routing/index.d.ts +7 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +4 -2
- package/dist/routing/interception.d.ts +0 -5
- package/dist/routing/interception.d.ts.map +1 -1
- package/dist/routing/link-codegen.d.ts +90 -0
- package/dist/routing/link-codegen.d.ts.map +1 -0
- package/dist/routing/manifest-codegen.d.ts +32 -0
- package/dist/routing/manifest-codegen.d.ts.map +1 -0
- package/dist/routing/scanner.d.ts +1 -10
- package/dist/routing/scanner.d.ts.map +1 -1
- package/dist/routing/schema-validation.d.ts +35 -0
- package/dist/routing/schema-validation.d.ts.map +1 -0
- package/dist/routing/segment-classify.d.ts +75 -0
- package/dist/routing/segment-classify.d.ts.map +1 -0
- package/dist/routing/segment-codegen.d.ts +38 -0
- package/dist/routing/segment-codegen.d.ts.map +1 -0
- package/dist/routing/types.d.ts +77 -25
- package/dist/routing/types.d.ts.map +1 -1
- package/dist/routing/walkers.d.ts +51 -0
- package/dist/routing/walkers.d.ts.map +1 -0
- package/dist/rsc-runtime/rsc.d.ts +1 -1
- package/dist/rsc-runtime/rsc.d.ts.map +1 -1
- package/dist/rsc-runtime/ssr.d.ts +12 -0
- package/dist/rsc-runtime/ssr.d.ts.map +1 -1
- package/dist/schema-bridge.d.ts +91 -0
- package/dist/schema-bridge.d.ts.map +1 -0
- package/dist/search-params/define.d.ts +157 -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 +37 -440
- package/dist/search-params/index.js.map +1 -1
- 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 +89 -0
- package/dist/segment-params/define.d.ts.map +1 -0
- package/dist/segment-params/index.d.ts +3 -0
- package/dist/segment-params/index.d.ts.map +1 -0
- package/dist/segment-params/index.js +2 -0
- package/dist/server/access-gate.d.ts +8 -3
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/action-client.d.ts +41 -6
- 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 +35 -1
- package/dist/server/action-handler.d.ts.map +1 -1
- package/dist/server/actions.d.ts +9 -30
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +70 -11
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/asset-headers.d.ts +1 -15
- package/dist/server/asset-headers.d.ts.map +1 -1
- package/dist/server/body-limits.d.ts.map +1 -1
- package/dist/server/build-manifest.d.ts +6 -29
- package/dist/server/build-manifest.d.ts.map +1 -1
- package/dist/server/canonicalize.d.ts +10 -0
- package/dist/server/canonicalize.d.ts.map +1 -1
- package/dist/server/coalesce-tick.d.ts +40 -0
- package/dist/server/coalesce-tick.d.ts.map +1 -0
- package/dist/server/cookie-context.d.ts +170 -0
- package/dist/server/cookie-context.d.ts.map +1 -0
- package/dist/server/cookie-parsing.d.ts +51 -0
- package/dist/server/cookie-parsing.d.ts.map +1 -0
- package/dist/server/csrf.d.ts +3 -2
- package/dist/server/csrf.d.ts.map +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-boundary.d.ts +115 -0
- package/dist/server/deny-boundary.d.ts.map +1 -0
- package/dist/server/deny-renderer.d.ts +2 -2
- package/dist/server/deny-renderer.d.ts.map +1 -1
- package/dist/server/dev-source-map.d.ts +22 -0
- package/dist/server/dev-source-map.d.ts.map +1 -0
- package/dist/server/early-hints-sender.d.ts.map +1 -1
- package/dist/server/early-hints.d.ts +13 -11
- 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 +12 -7
- package/dist/server/fallback-error.d.ts.map +1 -1
- package/dist/server/flight-injection-state.d.ts +66 -0
- package/dist/server/flight-injection-state.d.ts.map +1 -0
- package/dist/server/flight-scripts.d.ts +42 -0
- package/dist/server/flight-scripts.d.ts.map +1 -0
- package/dist/server/form-data.d.ts +29 -0
- package/dist/server/form-data.d.ts.map +1 -1
- package/dist/server/html-injector-core.d.ts +221 -0
- package/dist/server/html-injector-core.d.ts.map +1 -0
- package/dist/server/html-injectors.d.ts +81 -41
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/index.d.ts +10 -46
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +170 -2911
- package/dist/server/index.js.map +1 -1
- package/dist/server/internal.d.ts +44 -0
- package/dist/server/internal.d.ts.map +1 -0
- package/dist/server/internal.js +3015 -0
- package/dist/server/internal.js.map +1 -0
- package/dist/server/logger.d.ts +39 -7
- package/dist/server/logger.d.ts.map +1 -1
- package/dist/server/metadata-routes.d.ts +23 -7
- package/dist/server/metadata-routes.d.ts.map +1 -1
- package/dist/server/middleware-runner.d.ts +36 -4
- package/dist/server/middleware-runner.d.ts.map +1 -1
- package/dist/server/node-stream-transforms.d.ts +119 -0
- package/dist/server/node-stream-transforms.d.ts.map +1 -0
- package/dist/server/param-coercion.d.ts +54 -0
- package/dist/server/param-coercion.d.ts.map +1 -0
- package/dist/server/pipeline-helpers.d.ts +95 -0
- package/dist/server/pipeline-helpers.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-outcome.d.ts +49 -0
- package/dist/server/pipeline-outcome.d.ts.map +1 -0
- package/dist/server/pipeline-phases.d.ts +56 -0
- package/dist/server/pipeline-phases.d.ts.map +1 -0
- package/dist/server/pipeline.d.ts +122 -19
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/port-resolution.d.ts +117 -0
- package/dist/server/port-resolution.d.ts.map +1 -0
- package/dist/server/primitives.d.ts +75 -31
- 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/render-utils.d.ts +25 -0
- package/dist/server/render-utils.d.ts.map +1 -0
- package/dist/server/request-context.d.ts +62 -107
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts +30 -18
- 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 +25 -36
- package/dist/server/route-matcher.d.ts.map +1 -1
- package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
- package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
- package/dist/server/rsc-entry/api-handler.d.ts +12 -3
- 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 +51 -23
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts +19 -8
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts +50 -0
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
- package/dist/server/rsc-entry/revalidate-renderer.d.ts +108 -0
- package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -0
- 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 +17 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts +5 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +34 -4
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/wrap-action-dispatch.d.ts +119 -0
- package/dist/server/rsc-entry/wrap-action-dispatch.d.ts.map +1 -0
- package/dist/server/safe-load.d.ts +46 -0
- package/dist/server/safe-load.d.ts.map +1 -0
- package/dist/server/sensitive-fields.d.ts +74 -0
- package/dist/server/sensitive-fields.d.ts.map +1 -0
- package/dist/server/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 +7 -5
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/ssr-bridge-types.d.ts +121 -0
- package/dist/server/ssr-bridge-types.d.ts.map +1 -0
- package/dist/server/ssr-entry.d.ts +2 -43
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-render.d.ts +64 -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/state-tree-diff.d.ts +12 -5
- package/dist/server/state-tree-diff.d.ts.map +1 -1
- package/dist/server/status-code-resolver.d.ts +22 -11
- 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 +7 -6
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/server/tree-builder.d.ts +62 -30
- package/dist/server/tree-builder.d.ts.map +1 -1
- package/dist/server/tree-match.d.ts +49 -0
- package/dist/server/tree-match.d.ts.map +1 -0
- package/dist/server/types.d.ts +71 -6
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/utils/escape-html.d.ts +14 -0
- package/dist/server/utils/escape-html.d.ts.map +1 -0
- package/dist/server/utils/mdx-file.d.ts +15 -0
- package/dist/server/utils/mdx-file.d.ts.map +1 -0
- package/dist/server/version-skew.d.ts +61 -0
- package/dist/server/version-skew.d.ts.map +1 -0
- package/dist/shared/head-header.d.ts +54 -0
- package/dist/shared/head-header.d.ts.map +1 -0
- package/dist/shared/href-validation.d.ts +49 -0
- package/dist/shared/href-validation.d.ts.map +1 -0
- package/dist/shared/merge-search-params.d.ts +22 -0
- package/dist/shared/merge-search-params.d.ts.map +1 -0
- package/dist/shared/redirect-type.d.ts +17 -0
- package/dist/shared/redirect-type.d.ts.map +1 -0
- package/dist/shims/font-google.d.ts +1 -1
- package/dist/shims/font-google.d.ts.map +1 -1
- package/dist/shims/font-google.js +42 -0
- package/dist/shims/font-google.js.map +1 -0
- package/dist/shims/font-local.d.ts +26 -0
- package/dist/shims/font-local.d.ts.map +1 -0
- package/dist/shims/font-local.js +20 -0
- package/dist/shims/font-local.js.map +1 -0
- package/dist/shims/headers.d.ts +53 -1
- package/dist/shims/headers.d.ts.map +1 -1
- package/dist/shims/image.d.ts +16 -16
- package/dist/shims/navigation-client.d.ts +35 -11
- package/dist/shims/navigation-client.d.ts.map +1 -1
- package/dist/shims/navigation.d.ts +11 -5
- package/dist/shims/navigation.d.ts.map +1 -1
- package/dist/utils/state-machine.d.ts +80 -0
- package/dist/utils/state-machine.d.ts.map +1 -0
- package/package.json +63 -24
- package/src/adapters/build-output-helper.ts +139 -0
- package/src/adapters/cloudflare-dev.ts +177 -0
- package/src/adapters/cloudflare-kv-cache.ts +179 -0
- package/src/adapters/cloudflare.ts +356 -116
- package/src/adapters/compress-module.ts +27 -92
- package/src/adapters/nitro.ts +155 -99
- package/src/adapters/raw-imports.d.ts +5 -0
- package/src/adapters/shared.ts +40 -0
- package/src/adapters/wrangler.d.ts +7 -0
- package/src/cache/cache-api.ts +47 -0
- package/src/cache/handler-store.ts +68 -0
- package/src/cache/index.ts +84 -18
- package/src/cache/invalidation-epoch.ts +93 -0
- package/src/cache/redis-handler.ts +110 -15
- package/src/cache/singleflight.ts +62 -4
- package/src/cache/sizeof.ts +33 -0
- package/src/cache/stable-stringify.ts +65 -2
- package/src/cache/timber-cache.ts +132 -36
- package/src/cli-schema-sync.ts +388 -0
- package/src/cli.ts +98 -34
- package/src/client/browser-dev.ts +153 -1
- package/src/client/browser-entry/action-dispatch.ts +119 -0
- package/src/client/browser-entry/hmr.ts +70 -0
- package/src/client/browser-entry/hydrate.ts +187 -0
- package/src/client/browser-entry/index.ts +111 -0
- package/src/client/browser-entry/post-hydration.ts +104 -0
- package/src/client/browser-entry/router-init.ts +292 -0
- package/src/client/browser-entry/rsc-stream.ts +157 -0
- package/src/client/browser-entry/scroll.ts +50 -0
- package/src/client/error-boundary.tsx +127 -22
- package/src/client/error-reconstituter.tsx +79 -0
- package/src/client/form.tsx +31 -32
- package/src/client/history.ts +11 -3
- package/src/client/index.ts +67 -45
- package/src/client/internal.ts +58 -0
- package/src/client/link.tsx +346 -150
- package/src/client/navigation-api-types.ts +112 -0
- package/src/client/navigation-api.ts +347 -0
- package/src/client/navigation-context.ts +15 -7
- package/src/client/navigation-root.tsx +355 -0
- package/src/client/nuqs-adapter.tsx +16 -3
- package/src/client/router-ref.ts +1 -1
- package/src/client/router.ts +490 -140
- package/src/client/rsc-fetch.ts +220 -17
- package/src/client/segment-cache.ts +6 -3
- package/src/client/segment-outlet.tsx +77 -0
- package/src/client/segment-update-context.ts +42 -0
- package/src/client/shallow-url.ts +22 -0
- package/src/client/ssr-data.ts +13 -5
- package/src/client/state.ts +2 -2
- package/src/client/top-loader.tsx +11 -9
- package/src/client/use-cookie.ts +31 -2
- package/src/client/use-link-status.ts +7 -7
- package/src/client/use-pathname.ts +1 -0
- package/src/client/use-pending-navigation.ts +40 -0
- package/src/client/use-query-states.ts +9 -3
- package/src/client/use-router.ts +4 -1
- package/src/client/use-search-params.ts +31 -44
- package/src/client/{use-params.ts → use-segment-params.ts} +9 -6
- package/src/codec.ts +147 -0
- package/src/config-types.ts +292 -0
- package/src/config-validation.ts +311 -0
- package/src/content/index.ts +5 -13
- package/src/cookies/define-cookie.ts +217 -53
- package/src/cookies/index.ts +12 -1
- package/src/cookies/json-cookie.ts +105 -0
- package/src/cookies/validation.ts +192 -0
- package/src/dev-tools/404-page.ts +286 -0
- package/src/dev-tools/browser-logs.ts +291 -0
- package/src/dev-tools/dev-page-shell.ts +260 -0
- package/src/dev-tools/error-page.ts +331 -0
- package/src/dev-tools/holding-server.ts +187 -0
- package/src/dev-tools/hydration-overlay.ts +158 -0
- package/src/dev-tools/index.ts +83 -0
- package/src/dev-tools/instrumentation.ts +213 -0
- package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +9 -5
- package/src/dev-tools/overlay.ts +469 -0
- package/src/dev-tools/stack-classifier.ts +75 -0
- package/src/dev-tools/terminal.ts +183 -0
- package/src/fonts/ast-walk.ts +235 -0
- package/src/fonts/ast.ts +477 -126
- package/src/fonts/bundle.ts +138 -0
- package/src/fonts/dev-middleware.ts +85 -0
- package/src/fonts/fallbacks.ts +0 -23
- package/src/fonts/google.ts +7 -3
- package/src/fonts/local.ts +9 -8
- package/src/fonts/paths.ts +58 -0
- package/src/fonts/pipeline.ts +316 -0
- package/src/fonts/transform.ts +344 -0
- package/src/fonts/types.ts +52 -1
- package/src/fonts/virtual-modules.ts +179 -0
- package/src/index.ts +417 -346
- package/src/params/codec-registry.ts +34 -0
- package/src/params/define-schema.ts +115 -0
- package/src/params/index.ts +17 -0
- package/src/params/resolve-schema.ts +84 -0
- package/src/plugin-context.ts +325 -0
- package/src/plugins/adapter-build.ts +98 -4
- package/src/plugins/build-manifest.ts +168 -23
- package/src/plugins/build-report.ts +16 -25
- package/src/plugins/cache.ts +285 -0
- package/src/plugins/client-chunks.ts +113 -0
- package/src/plugins/cloudflare-wasm.ts +141 -0
- package/src/plugins/content.ts +1 -1
- package/src/plugins/dev-server.ts +264 -46
- package/src/plugins/entries.ts +110 -8
- package/src/plugins/fonts.ts +170 -663
- package/src/plugins/mdx.ts +47 -10
- package/src/plugins/routing.ts +237 -241
- package/src/plugins/server-bundle.ts +85 -12
- package/src/plugins/shims.ts +207 -64
- package/src/plugins/static-build.ts +15 -89
- package/src/routing/codegen-shared.ts +115 -0
- package/src/routing/codegen-types.ts +65 -0
- package/src/routing/codegen.ts +380 -178
- package/src/routing/convention-lint.ts +358 -0
- package/src/routing/file-cache.ts +23 -0
- package/src/routing/index.ts +10 -1
- package/src/routing/interception.ts +3 -22
- package/src/routing/link-codegen.ts +310 -0
- package/src/routing/manifest-codegen.ts +290 -0
- package/src/routing/scanner.ts +248 -188
- package/src/routing/schema-validation.ts +149 -0
- package/src/routing/segment-classify.ts +188 -0
- package/src/routing/segment-codegen.ts +98 -0
- package/src/routing/types.ts +78 -25
- package/src/routing/walkers.ts +90 -0
- 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/schema-bridge.ts +252 -0
- package/src/search-params/define.ts +570 -0
- package/src/search-params/index.ts +14 -20
- package/src/search-params/registry.ts +2 -2
- package/src/search-params/wrappers.ts +110 -0
- package/src/segment-params/define.ts +249 -0
- package/src/segment-params/index.ts +9 -0
- package/src/server/access-gate.tsx +84 -34
- package/src/server/action-client.ts +119 -28
- package/src/server/action-encryption.ts +144 -0
- package/src/server/action-handler.ts +122 -16
- package/src/server/actions.ts +39 -53
- package/src/server/als-registry.ts +108 -20
- package/src/server/asset-headers.ts +8 -34
- package/src/server/body-limits.ts +10 -2
- package/src/server/build-manifest.ts +13 -56
- package/src/server/canonicalize.ts +6 -3
- package/src/server/coalesce-tick.ts +75 -0
- package/src/server/compress.ts +34 -7
- package/src/server/cookie-context.ts +484 -0
- package/src/server/cookie-parsing.ts +147 -0
- package/src/server/csrf.ts +39 -6
- package/src/server/default-logger.ts +99 -0
- package/src/server/deny-boundary.ts +311 -0
- package/src/server/deny-renderer.ts +80 -64
- package/src/server/dev-source-map.ts +31 -0
- package/src/server/early-hints-sender.ts +3 -2
- package/src/server/early-hints.ts +37 -27
- package/src/server/error-boundary-wrapper.ts +61 -22
- package/src/server/fallback-error.ts +79 -102
- package/src/server/flight-injection-state.ts +113 -0
- package/src/server/flight-scripts.ts +62 -0
- package/src/server/form-data.ts +101 -5
- package/src/server/html-injector-core.ts +437 -0
- package/src/server/html-injectors.ts +256 -251
- package/src/server/index.ts +29 -183
- package/src/server/internal.ts +165 -0
- package/src/server/logger.ts +67 -36
- package/src/server/metadata-routes.ts +44 -19
- package/src/server/middleware-runner.ts +75 -4
- package/src/server/node-stream-transforms.ts +331 -0
- package/src/server/param-coercion.ts +206 -0
- package/src/server/pipeline-helpers.ts +204 -0
- package/src/server/pipeline-interception.ts +32 -18
- package/src/server/pipeline-metadata.ts +13 -0
- package/src/server/pipeline-outcome.ts +197 -0
- package/src/server/pipeline-phases.ts +527 -0
- package/src/server/pipeline.ts +213 -382
- package/src/server/port-resolution.ts +215 -0
- package/src/server/primitives.ts +126 -63
- package/src/server/render-timeout.ts +108 -0
- package/src/server/render-utils.ts +31 -0
- package/src/server/request-context.ts +168 -337
- package/src/server/route-element-builder.ts +481 -222
- package/src/server/route-handler.ts +31 -4
- package/src/server/route-matcher.ts +144 -277
- package/src/server/rsc-entry/action-middleware-runner.ts +167 -0
- package/src/server/rsc-entry/api-handler.ts +69 -32
- package/src/server/rsc-entry/error-renderer.ts +306 -89
- package/src/server/rsc-entry/helpers.ts +160 -59
- package/src/server/rsc-entry/index.ts +299 -329
- package/src/server/rsc-entry/render-route.ts +311 -0
- package/src/server/rsc-entry/revalidate-renderer.ts +344 -0
- package/src/server/rsc-entry/rsc-payload.ts +71 -26
- package/src/server/rsc-entry/rsc-stream.ts +85 -13
- package/src/server/rsc-entry/ssr-bridge.ts +18 -5
- package/src/server/rsc-entry/ssr-renderer.ts +273 -43
- package/src/server/rsc-entry/wrap-action-dispatch.ts +449 -0
- package/src/server/safe-load.ts +60 -0
- package/src/server/sensitive-fields.ts +230 -0
- package/src/server/sitemap-generator.ts +338 -0
- package/src/server/sitemap-handler.ts +148 -0
- package/src/server/slot-resolver.ts +258 -257
- package/src/server/ssr-bridge-types.ts +124 -0
- package/src/server/ssr-entry.ts +206 -78
- package/src/server/ssr-render.ts +345 -82
- package/src/server/ssr-wrappers.tsx +141 -0
- package/src/server/state-tree-diff.ts +30 -23
- package/src/server/status-code-resolver.ts +115 -130
- package/src/server/stream-utils.ts +213 -0
- package/src/server/tracing.ts +38 -11
- package/src/server/tree-builder.ts +204 -90
- package/src/server/tree-match.ts +220 -0
- package/src/server/types.ts +78 -9
- package/src/server/utils/escape-html.ts +20 -0
- package/src/server/utils/mdx-file.ts +22 -0
- package/src/server/version-skew.ts +104 -0
- package/src/shared/head-header.ts +69 -0
- package/src/shared/href-validation.ts +159 -0
- package/src/shared/merge-search-params.ts +55 -0
- package/src/shared/redirect-type.ts +17 -0
- package/src/shims/font-google.ts +1 -1
- package/src/shims/font-local.ts +34 -0
- package/src/shims/headers.ts +122 -1
- package/src/shims/navigation-client.ts +51 -29
- package/src/shims/navigation.ts +14 -7
- package/src/utils/state-machine.ts +111 -0
- package/dist/_chunks/als-registry-B7DbZ2hS.js +0 -41
- package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
- package/dist/_chunks/debug-B3Gypr3D.js +0 -108
- package/dist/_chunks/debug-B3Gypr3D.js.map +0 -1
- package/dist/_chunks/format-RyoGQL74.js +0 -164
- package/dist/_chunks/format-RyoGQL74.js.map +0 -1
- package/dist/_chunks/interception-BOoWmLUA.js +0 -676
- package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
- package/dist/_chunks/metadata-routes-Cjmvi3rQ.js.map +0 -1
- package/dist/_chunks/request-context-BQUC8PHn.js +0 -330
- package/dist/_chunks/request-context-BQUC8PHn.js.map +0 -1
- package/dist/_chunks/ssr-data-MjmprTmO.js.map +0 -1
- package/dist/_chunks/tracing-CemImE6h.js +0 -187
- package/dist/_chunks/tracing-CemImE6h.js.map +0 -1
- package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
- package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
- package/dist/_chunks/use-query-states-D5KaffOK.js.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/segment-merger.d.ts +0 -119
- package/dist/client/segment-merger.d.ts.map +0 -1
- package/dist/client/stale-reload.d.ts +0 -44
- package/dist/client/stale-reload.d.ts.map +0 -1
- package/dist/client/transition-root.d.ts +0 -74
- package/dist/client/transition-root.d.ts.map +0 -1
- package/dist/client/use-navigation-pending.d.ts +0 -26
- package/dist/client/use-navigation-pending.d.ts.map +0 -1
- package/dist/client/use-params.d.ts.map +0 -1
- package/dist/plugins/cache-transform.d.ts +0 -36
- package/dist/plugins/cache-transform.d.ts.map +0 -1
- package/dist/plugins/dev-error-overlay.d.ts +0 -60
- package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
- package/dist/plugins/dev-logs.d.ts.map +0 -1
- package/dist/plugins/dynamic-transform.d.ts +0 -72
- package/dist/plugins/dynamic-transform.d.ts.map +0 -1
- package/dist/plugins/server-action-exports.d.ts +0 -26
- package/dist/plugins/server-action-exports.d.ts.map +0 -1
- package/dist/routing/status-file-lint.d.ts +0 -33
- package/dist/routing/status-file-lint.d.ts.map +0 -1
- package/dist/search-params/analyze.d.ts +0 -54
- package/dist/search-params/analyze.d.ts.map +0 -1
- package/dist/search-params/builtin-codecs.d.ts +0 -105
- package/dist/search-params/builtin-codecs.d.ts.map +0 -1
- package/dist/search-params/codecs.d.ts +0 -53
- package/dist/search-params/codecs.d.ts.map +0 -1
- package/dist/search-params/create.d.ts +0 -106
- package/dist/search-params/create.d.ts.map +0 -1
- package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
- package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
- package/dist/server/dev-logger.d.ts.map +0 -1
- package/dist/server/dev-span-processor.d.ts +0 -29
- package/dist/server/dev-span-processor.d.ts.map +0 -1
- package/dist/server/dev-warnings.d.ts +0 -129
- package/dist/server/dev-warnings.d.ts.map +0 -1
- package/dist/server/flush.d.ts +0 -74
- package/dist/server/flush.d.ts.map +0 -1
- package/dist/server/manifest-status-resolver.d.ts +0 -58
- package/dist/server/manifest-status-resolver.d.ts.map +0 -1
- package/dist/server/prerender.d.ts +0 -77
- package/dist/server/prerender.d.ts.map +0 -1
- package/dist/utils/directive-parser.d.ts +0 -70
- package/dist/utils/directive-parser.d.ts.map +0 -1
- package/src/cache/register-cached-function.ts +0 -103
- package/src/client/browser-entry.ts +0 -678
- package/src/client/link-status-provider.tsx +0 -30
- package/src/client/segment-merger.ts +0 -339
- package/src/client/stale-reload.ts +0 -87
- package/src/client/transition-root.tsx +0 -166
- package/src/client/use-navigation-pending.ts +0 -38
- package/src/plugins/cache-transform.ts +0 -199
- package/src/plugins/dev-error-overlay.ts +0 -230
- package/src/plugins/dynamic-transform.ts +0 -161
- package/src/plugins/server-action-exports.ts +0 -220
- package/src/routing/status-file-lint.ts +0 -112
- package/src/search-params/analyze.ts +0 -192
- package/src/search-params/builtin-codecs.ts +0 -228
- package/src/search-params/codecs.ts +0 -153
- package/src/search-params/create.ts +0 -321
- package/src/server/dev-fetch-instrumentation.ts +0 -96
- package/src/server/dev-span-processor.ts +0 -78
- package/src/server/dev-warnings.ts +0 -283
- package/src/server/flush.ts +0 -182
- package/src/server/manifest-status-resolver.ts +0 -215
- package/src/server/prerender.ts +0 -139
- package/src/utils/directive-parser.ts +0 -529
- /package/src/{server/dev-logger.ts → dev-tools/logger.ts} +0 -0
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, relative, 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,344 +22,267 @@ 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
|
-
import { timberServerActionExports } from './plugins/server-action-exports';
|
|
18
25
|
import { timberBuildManifest } from './plugins/build-manifest';
|
|
19
|
-
import { timberDevLogs } from './
|
|
26
|
+
import { timberDevLogs } from './dev-tools/logs';
|
|
27
|
+
import { timberDevBrowserLogs } from './dev-tools/browser-logs';
|
|
20
28
|
import { timberReactProd } from './plugins/react-prod';
|
|
21
29
|
import { timberChunks } from './plugins/chunks';
|
|
30
|
+
import { clientChunkGroup } from './plugins/client-chunks';
|
|
22
31
|
import { timberServerBundle } from './plugins/server-bundle';
|
|
32
|
+
import { timberCacheTransform } from './plugins/cache';
|
|
33
|
+
import { timberCloudflareWasm } from './plugins/cloudflare-wasm';
|
|
23
34
|
import { timberAdapterBuild } from './plugins/adapter-build';
|
|
24
35
|
import { timberBuildReport } from './plugins/build-report';
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
36
|
+
import { createNoopTimer } from './utils/startup-timer';
|
|
37
|
+
import { resolveEncryptionKeyExpression, shouldEnableEncryption } from './server/action-encryption';
|
|
38
|
+
import { createHoldingServer } from './dev-tools/holding-server.js';
|
|
39
|
+
import { resolveStartPort, startDevServerPort } from './server/port-resolution.js';
|
|
40
|
+
import type { TimberUserConfig } from './config-types.js';
|
|
41
|
+
import type { PluginContext } from './plugin-context.js';
|
|
42
|
+
import {
|
|
43
|
+
createPluginContext,
|
|
44
|
+
loadTimberConfigFile,
|
|
45
|
+
mergeFileConfig,
|
|
46
|
+
resolveAppDir,
|
|
47
|
+
resolveClientJavascript,
|
|
48
|
+
resolveBuildDir,
|
|
49
|
+
} from './plugin-context.js';
|
|
40
50
|
|
|
41
|
-
|
|
42
|
-
export interface ResolvedClientJavascript {
|
|
43
|
-
disabled: boolean;
|
|
44
|
-
enableHMRInDev: boolean;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface TimberUserConfig {
|
|
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
|
-
* Control Server-Timing header output.
|
|
112
|
-
*
|
|
113
|
-
* - `'detailed'` — per-phase breakdown (proxy, middleware, render). Useful
|
|
114
|
-
* for APM / network monitoring. Exposes phase names to clients.
|
|
115
|
-
* - `'total'` — single `total;dur=N` entry. Safe to expose, gives
|
|
116
|
-
* browser DevTools useful timing without internal details.
|
|
117
|
-
* - `false` — no Server-Timing header at all.
|
|
118
|
-
*
|
|
119
|
-
* Default: `'detailed'` in dev, `'total'` in production.
|
|
120
|
-
*
|
|
121
|
-
* This is separate from `debug` / `TIMBER_DEBUG` — it's an intentional
|
|
122
|
-
* decision to expose timing data to clients, not a side effect of debug
|
|
123
|
-
* logging.
|
|
124
|
-
*/
|
|
125
|
-
serverTiming?: 'detailed' | 'total' | false;
|
|
126
|
-
/**
|
|
127
|
-
* Override the app directory location. By default, timber auto-detects
|
|
128
|
-
* `app/` at the project root, falling back to `src/app/`.
|
|
129
|
-
*
|
|
130
|
-
* Set this to a relative path from the project root (e.g. `'src/app'`)
|
|
131
|
-
* to use a custom location.
|
|
132
|
-
*/
|
|
133
|
-
appDir?: string;
|
|
134
|
-
/** MDX compilation options passed to @mdx-js/rollup. See design/20-content-collections.md. */
|
|
135
|
-
mdx?: {
|
|
136
|
-
remarkPlugins?: unknown[];
|
|
137
|
-
rehypePlugins?: unknown[];
|
|
138
|
-
recmaPlugins?: unknown[];
|
|
139
|
-
remarkRehypeOptions?: Record<string, unknown>;
|
|
140
|
-
};
|
|
141
|
-
/**
|
|
142
|
-
* Built-in top-loader progress bar for client navigations.
|
|
143
|
-
* Shows an animated bar at the top of the viewport during RSC navigations.
|
|
144
|
-
* Enabled by default — set `enabled: false` to opt out.
|
|
145
|
-
*
|
|
146
|
-
* Users who want a fully custom progress indicator should disable this
|
|
147
|
-
* and use `useNavigationPending()` directly.
|
|
148
|
-
*
|
|
149
|
-
* See LOCAL-336 for design decisions.
|
|
150
|
-
*/
|
|
151
|
-
topLoader?: {
|
|
152
|
-
/** Whether the top-loader is enabled. Default: true. */
|
|
153
|
-
enabled?: boolean;
|
|
154
|
-
/** Bar color. Default: '#2299DD'. */
|
|
155
|
-
color?: string;
|
|
156
|
-
/** Bar height in pixels. Default: 3. */
|
|
157
|
-
height?: number;
|
|
158
|
-
/** Show subtle glow/shadow effect. Default: true. */
|
|
159
|
-
shadow?: boolean;
|
|
160
|
-
/** Delay in ms before showing the bar (avoids flash on fast navs). Default: 0. */
|
|
161
|
-
delay?: number;
|
|
162
|
-
/** CSS z-index. Default: 1600. */
|
|
163
|
-
zIndex?: number;
|
|
164
|
-
};
|
|
165
|
-
}
|
|
51
|
+
// ── Public API ────────────────────────────────────────────────────────────
|
|
166
52
|
|
|
167
|
-
|
|
168
|
-
* Resolve `clientJavascript` into a fully resolved config.
|
|
169
|
-
*/
|
|
170
|
-
export function resolveClientJavascript(config: TimberUserConfig): ResolvedClientJavascript {
|
|
171
|
-
if (config.clientJavascript !== undefined) {
|
|
172
|
-
if (typeof config.clientJavascript === 'boolean') {
|
|
173
|
-
// `clientJavascript: false` → disabled
|
|
174
|
-
// `clientJavascript: true` → enabled (default)
|
|
175
|
-
return {
|
|
176
|
-
disabled: !config.clientJavascript,
|
|
177
|
-
enableHMRInDev: !config.clientJavascript, // default true when disabled
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
// Object form
|
|
181
|
-
return {
|
|
182
|
-
disabled: config.clientJavascript.disabled,
|
|
183
|
-
enableHMRInDev: config.clientJavascript.enableHMRInDev ?? config.clientJavascript.disabled,
|
|
184
|
-
};
|
|
185
|
-
}
|
|
53
|
+
export type { TimberUserConfig } from './config-types.js';
|
|
186
54
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
55
|
+
// Metadata route handler types — re-exported so user-authored metadata
|
|
56
|
+
// route files (sitemap.ts, robots.ts, manifest.ts, icon.tsx, etc.) can
|
|
57
|
+
// import them from the package root without reaching into ./server.
|
|
58
|
+
// The canonical location for these types is '@timber-js/app/server'; this
|
|
59
|
+
// root re-export is a convenience for typed metadata route handlers.
|
|
60
|
+
// See design/16-metadata.md §"Metadata Routes".
|
|
61
|
+
export type { Metadata, MetadataRoute, MetadataHandler, MetadataResult } from './server/types.js';
|
|
190
62
|
|
|
191
63
|
/**
|
|
192
|
-
*
|
|
64
|
+
* Route map interface — augmented by the generated timber-routes.d.ts.
|
|
193
65
|
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
66
|
+
* Each key is a route path pattern. Values have:
|
|
67
|
+
* segmentParams: shape of URL segment params (e.g. { id: string })
|
|
68
|
+
* searchParams: parsed type from search-params.ts, or {} if none
|
|
69
|
+
*
|
|
70
|
+
* This interface is empty by default and populated via codegen.
|
|
71
|
+
* See design/09-typescript.md §"Typed Routes".
|
|
197
72
|
*/
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
/** Resolved client JavaScript configuration */
|
|
201
|
-
clientJavascript: ResolvedClientJavascript;
|
|
202
|
-
/** The scanned route tree (populated by timber-routing, consumed by timber-entries) */
|
|
203
|
-
routeTree: RouteTree | null;
|
|
204
|
-
/** Absolute path to the app/ directory */
|
|
205
|
-
appDir: string;
|
|
206
|
-
/** Absolute path to the project root */
|
|
207
|
-
root: string;
|
|
208
|
-
/** Whether the dev server is running (set by timber-root-sync in configResolved) */
|
|
209
|
-
dev: boolean;
|
|
210
|
-
/** CSS build manifest (populated by adapter after client build, null in dev) */
|
|
211
|
-
buildManifest: BuildManifest | null;
|
|
212
|
-
/** Startup timer for profiling cold start phases (active in dev, no-op in prod) */
|
|
213
|
-
timer: StartupTimer;
|
|
214
|
-
}
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type, typescript/no-empty-interface
|
|
74
|
+
export interface Routes {}
|
|
215
75
|
|
|
216
76
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
77
|
+
* Type-safe helper for timber.config.ts files.
|
|
78
|
+
*
|
|
79
|
+
* A pass-through identity function that provides autocomplete and
|
|
80
|
+
* type checking for timber configuration. No runtime validation —
|
|
81
|
+
* purely a DX convenience (same pattern as Vite's defineConfig).
|
|
221
82
|
*
|
|
222
|
-
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* // timber.config.ts
|
|
86
|
+
* import { defineConfig } from '@timber-js/app';
|
|
87
|
+
*
|
|
88
|
+
* export default defineConfig({
|
|
89
|
+
* output: 'server',
|
|
90
|
+
* pageExtensions: ['tsx', 'ts', 'mdx'],
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
223
93
|
*/
|
|
224
|
-
export function
|
|
225
|
-
|
|
226
|
-
const explicit = join(root, configAppDir);
|
|
227
|
-
if (!existsSync(explicit)) {
|
|
228
|
-
throw new Error(`[timber] Configured appDir "${configAppDir}" does not exist at ${explicit}`);
|
|
229
|
-
}
|
|
230
|
-
return explicit;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const rootApp = join(root, 'app');
|
|
234
|
-
if (existsSync(rootApp)) return rootApp;
|
|
235
|
-
|
|
236
|
-
const srcApp = join(root, 'src', 'app');
|
|
237
|
-
if (existsSync(srcApp)) return srcApp;
|
|
238
|
-
|
|
239
|
-
throw new Error(
|
|
240
|
-
`[timber] Could not find app directory. Expected "app/" or "src/app/" in ${root}. ` +
|
|
241
|
-
`You can set appDir in timber.config.ts to specify a custom location.`
|
|
242
|
-
);
|
|
94
|
+
export function defineConfig(config: TimberUserConfig): TimberUserConfig {
|
|
95
|
+
return config;
|
|
243
96
|
}
|
|
244
97
|
|
|
245
|
-
|
|
246
|
-
const projectRoot = root ?? process.cwd();
|
|
247
|
-
const resolvedConfig: TimberUserConfig = { output: 'server', ...config };
|
|
248
|
-
// Timer starts as active — swapped to noop in configResolved for production builds
|
|
249
|
-
return {
|
|
250
|
-
config: resolvedConfig,
|
|
251
|
-
clientJavascript: resolveClientJavascript(resolvedConfig),
|
|
252
|
-
routeTree: null,
|
|
253
|
-
appDir: join(projectRoot, 'app'),
|
|
254
|
-
root: projectRoot,
|
|
255
|
-
dev: false,
|
|
256
|
-
buildManifest: null,
|
|
257
|
-
timer: createStartupTimer(),
|
|
258
|
-
};
|
|
259
|
-
}
|
|
98
|
+
// ── Private helpers ───────────────────────────────────────────────────────
|
|
260
99
|
|
|
261
100
|
/**
|
|
262
|
-
*
|
|
263
|
-
* Returns the config object or null if no config file is found.
|
|
264
|
-
*/
|
|
265
|
-
async function loadTimberConfigFile(root: string): Promise<TimberUserConfig | null> {
|
|
266
|
-
const configNames = ['timber.config.ts', 'timber.config.js', 'timber.config.mjs'];
|
|
267
|
-
|
|
268
|
-
for (const name of configNames) {
|
|
269
|
-
const configPath = join(root, name);
|
|
270
|
-
if (existsSync(configPath)) {
|
|
271
|
-
const mod = await import(pathToFileURL(configPath).href);
|
|
272
|
-
return (mod.default ?? mod) as TimberUserConfig;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return null;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Detect config keys set in both inline (vite.config.ts) and file (timber.config.ts)
|
|
280
|
-
* and warn the user. The `output` key is excluded because it defaults to 'server'
|
|
281
|
-
* in createPluginContext and would always appear as an inline key.
|
|
101
|
+
* Resolve the React Compiler plugin via @rolldown/plugin-babel.
|
|
282
102
|
*
|
|
283
|
-
*
|
|
103
|
+
* Uses the `reactCompilerPreset` from @vitejs/plugin-react, which:
|
|
104
|
+
* - Uses Babel ONLY for the compiler pass (OXC handles JSX)
|
|
105
|
+
* - Automatically scopes to client environment via applyToEnvironmentHook
|
|
106
|
+
* - Uses react/compiler-runtime built into React 19
|
|
107
|
+
*
|
|
108
|
+
* @rolldown/plugin-babel and babel-plugin-react-compiler are optional peer deps.
|
|
109
|
+
* If either is missing, require() fails with a clear error message.
|
|
284
110
|
*/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
):
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
console.warn(
|
|
298
|
-
`[timber] Config conflict: ${conflicts.map((k) => `"${k}"`).join(', ')} set in both ` +
|
|
299
|
-
`vite.config.ts (inline) and timber.config.ts. ` +
|
|
300
|
-
`Move all config to timber.config.ts to avoid confusion. ` +
|
|
301
|
-
`The inline value from vite.config.ts will be used.`
|
|
111
|
+
function resolveReactCompilerPlugin(
|
|
112
|
+
config: true | { compilationMode?: string; target?: string },
|
|
113
|
+
req: NodeJS.Require
|
|
114
|
+
): PluginOption {
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
116
|
+
let babel: any;
|
|
117
|
+
try {
|
|
118
|
+
babel = req('@rolldown/plugin-babel');
|
|
119
|
+
} catch {
|
|
120
|
+
throw new Error(
|
|
121
|
+
'[timber] reactCompiler requires @rolldown/plugin-babel. ' +
|
|
122
|
+
'Install it: pnpm add -D @rolldown/plugin-babel babel-plugin-react-compiler'
|
|
302
123
|
);
|
|
303
124
|
}
|
|
304
|
-
|
|
125
|
+
const options = typeof config === 'object' ? config : {};
|
|
126
|
+
const babelPlugin = babel.default ?? babel;
|
|
127
|
+
return babelPlugin({
|
|
128
|
+
presets: [reactCompilerPreset(options as Parameters<typeof reactCompilerPreset>[0])],
|
|
129
|
+
}) as PluginOption;
|
|
305
130
|
}
|
|
306
131
|
|
|
307
132
|
/**
|
|
308
|
-
*
|
|
309
|
-
*
|
|
133
|
+
* Build the options object for @vitejs/plugin-rsc.
|
|
134
|
+
*
|
|
135
|
+
* Uses a getter for `enableActionEncryption` so the RSC plugin reads
|
|
136
|
+
* the value lazily — after ctx.dev is set in configResolved. This lets
|
|
137
|
+
* `actionEncryption.disableInDev` work correctly even though the RSC
|
|
138
|
+
* plugin is created before Vite resolves the command.
|
|
310
139
|
*/
|
|
311
|
-
function
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
140
|
+
function createRscOptions(
|
|
141
|
+
ctx: PluginContext,
|
|
142
|
+
encryptionKeyExpr: string | undefined
|
|
143
|
+
): Record<string, unknown> {
|
|
144
|
+
const options: Record<string, unknown> = {
|
|
145
|
+
serverHandler: false,
|
|
146
|
+
customClientEntry: true,
|
|
147
|
+
entries: {
|
|
148
|
+
rsc: 'virtual:timber-rsc-entry',
|
|
149
|
+
ssr: 'virtual:timber-ssr-entry',
|
|
150
|
+
client: 'virtual:timber-browser-entry',
|
|
151
|
+
},
|
|
152
|
+
// Group client references by layout boundary to balance route-scoped code
|
|
153
|
+
// splitting with HTTP request count. A constant group name ('client-refs')
|
|
154
|
+
// would collapse all routes into one chunk — any page downloads every
|
|
155
|
+
// client component. Per-serverChunk grouping creates many sub-500B files.
|
|
156
|
+
// Layout-boundary grouping is the middle ground: components under the same
|
|
157
|
+
// layout segment share a chunk. See design/27-chunking-strategy.md, TIM-440, TIM-499.
|
|
158
|
+
clientChunks: (meta: { id: string; normalizedId: string; serverChunk: string }) =>
|
|
159
|
+
clientChunkGroup(meta, ctx.appDir, ctx.root),
|
|
327
160
|
};
|
|
328
|
-
}
|
|
329
161
|
|
|
330
|
-
|
|
331
|
-
|
|
162
|
+
// Bound args encryption — AES-256-GCM authenticated encryption for
|
|
163
|
+
// closure variables in 'use server' functions. Always on in production,
|
|
164
|
+
// configurable in dev. See design/08-forms-and-actions.md §"Bound Args Encryption".
|
|
165
|
+
//
|
|
166
|
+
// Uses a getter so the RSC plugin reads the value lazily in its transform
|
|
167
|
+
// hooks, after ctx.dev is set in configResolved. This lets disableInDev
|
|
168
|
+
// work correctly — ctx.dev is false at construction time but true during
|
|
169
|
+
// dev server transforms.
|
|
170
|
+
Object.defineProperty(options, 'enableActionEncryption', {
|
|
171
|
+
get() {
|
|
172
|
+
return shouldEnableEncryption(ctx.dev, ctx.config.actionEncryption);
|
|
173
|
+
},
|
|
174
|
+
enumerable: true,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// When TIMBER_ACTIONS_ENCRYPTION_KEY is set, pass it as a runtime expression
|
|
178
|
+
// so the RSC plugin uses it instead of auto-generating a per-build key.
|
|
179
|
+
if (encryptionKeyExpr) {
|
|
180
|
+
options.defineEncryptionKey = encryptionKeyExpr;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return options;
|
|
332
184
|
}
|
|
333
185
|
|
|
186
|
+
// NOTE: 'use cache' directive transform removed — future feature pending design doc.
|
|
187
|
+
// The timber.cache() API (createCache) remains available for explicit caching.
|
|
188
|
+
// See design/06-caching.md.
|
|
189
|
+
|
|
190
|
+
// ── Main plugin factory ──────────────────────────────────────────────────
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Create the timber Vite plugin array.
|
|
194
|
+
*
|
|
195
|
+
* Loads timber.config.ts and all dependencies synchronously before
|
|
196
|
+
* constructing the plugin array. This ensures ALL plugins — including
|
|
197
|
+
* the RSC plugin and React Compiler — see the fully merged config
|
|
198
|
+
* (inline + file-based). No async, no deferred config, no stale reads.
|
|
199
|
+
*
|
|
200
|
+
* Requires Node >= 22.12 for synchronous require() of ESM modules
|
|
201
|
+
* (@vitejs/plugin-rsc is ESM-only).
|
|
202
|
+
*
|
|
203
|
+
* Previous versions used async loading and deferred config merging,
|
|
204
|
+
* causing file-based config for reactCompiler, actionEncryption, and
|
|
205
|
+
* output mode to be silently ignored. See TIM-451.
|
|
206
|
+
*/
|
|
334
207
|
export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
335
208
|
const ctx = createPluginContext(config);
|
|
336
|
-
|
|
337
|
-
//
|
|
338
|
-
//
|
|
209
|
+
|
|
210
|
+
// Resolve dependencies from the consumer's project (process.cwd()),
|
|
211
|
+
// not from timber's own node_modules. This is critical for pnpm link:
|
|
212
|
+
// when linked, timber's node_modules has a separate vite instance, and
|
|
213
|
+
// the RSC plugin must use the same vite instance as the dev server.
|
|
214
|
+
const consumerRequire = createRequire(join(process.cwd(), 'package.json'));
|
|
215
|
+
|
|
216
|
+
// ── Step 1: Load @vitejs/plugin-rsc ─────────────────────────────────
|
|
217
|
+
// Synchronous require() works for ESM modules on Node 22.12+.
|
|
218
|
+
ctx.timer.start('rsc-plugin-import');
|
|
219
|
+
const rscMod = consumerRequire('@vitejs/plugin-rsc');
|
|
220
|
+
const vitePluginRsc = rscMod.default ?? rscMod;
|
|
221
|
+
ctx.timer.end('rsc-plugin-import');
|
|
222
|
+
|
|
223
|
+
// ── Step 2: Compute config-dependent options ────────────────────────
|
|
224
|
+
// encryptionKeyExpr is env-based and doesn't depend on file config.
|
|
225
|
+
const encryptionKeyExpr = resolveEncryptionKeyExpression();
|
|
226
|
+
|
|
227
|
+
// ── Step 3: Pre-load file config for plugin resolution ──────────────
|
|
228
|
+
// Load timber.config.ts eagerly from process.cwd() so we can resolve
|
|
229
|
+
// plugins (like React Compiler) and add them to the top-level array.
|
|
230
|
+
// Vite's config() hook return type is Omit<UserConfig, 'plugins'> —
|
|
231
|
+
// plugins returned from config() are silently ignored. See TIM-632.
|
|
232
|
+
//
|
|
233
|
+
// The config() hook still loads from the correct Vite root (which may
|
|
234
|
+
// differ from cwd in monorepo setups — see TIM-498), but only for
|
|
235
|
+
// non-plugin config merging.
|
|
236
|
+
const earlyFileConfig = loadTimberConfigFile(process.cwd());
|
|
237
|
+
|
|
238
|
+
// ── Step 4: Build rootSync plugin ───────────────────────────────────
|
|
239
|
+
// rootSync loads timber.config.ts from Vite's resolved root and merges
|
|
240
|
+
// it into ctx.config. Plugin resolution is handled eagerly above — the
|
|
241
|
+
// config() hook must NOT return a `plugins` field (Vite ignores it).
|
|
339
242
|
const rootSync: Plugin = {
|
|
340
243
|
name: 'timber-root-sync',
|
|
341
|
-
async config(userConfig, { command }) {
|
|
342
|
-
// Load timber.config.ts
|
|
343
|
-
//
|
|
344
|
-
//
|
|
345
|
-
|
|
244
|
+
async config(userConfig, { command, isPreview }) {
|
|
245
|
+
// ── Load timber.config.ts from the correct root ───────────────
|
|
246
|
+
// Vite's `config` hook fires before `configResolved`. The user's
|
|
247
|
+
// `root` option (if set) tells us where the project lives.
|
|
248
|
+
// `resolve()` mirrors Vite's own root resolution logic.
|
|
249
|
+
const viteRoot = resolve(userConfig.root ?? process.cwd());
|
|
346
250
|
ctx.timer.start('config-load');
|
|
347
|
-
const fileConfig =
|
|
251
|
+
const fileConfig = loadTimberConfigFile(viteRoot);
|
|
348
252
|
if (fileConfig) {
|
|
349
|
-
mergeFileConfig(ctx, fileConfig);
|
|
253
|
+
ctx.config = mergeFileConfig(ctx.config, fileConfig);
|
|
350
254
|
ctx.clientJavascript = resolveClientJavascript(ctx.config);
|
|
351
255
|
}
|
|
256
|
+
// Apply defaults AFTER merge so file-based config isn't overridden
|
|
257
|
+
// by defaults that were baked into the inline config object.
|
|
258
|
+
ctx.config.output ??= 'server';
|
|
352
259
|
ctx.timer.end('config-load');
|
|
353
260
|
|
|
261
|
+
// ── Resolve build output directory ─────────────────────────
|
|
262
|
+
// Priority: timber.config.ts `buildDir` > Vite `build.outDir` > .timber/dist
|
|
263
|
+
// Set Vite's build.outDir so the RSC plugin and all environment
|
|
264
|
+
// builds write to the correct location.
|
|
265
|
+
const viteOutDir = userConfig.build?.outDir;
|
|
266
|
+
const timberBuildDir = ctx.config.buildDir;
|
|
267
|
+
const resolvedRoot = resolve(userConfig.root ?? process.cwd());
|
|
268
|
+
ctx.buildDir = resolveBuildDir(resolvedRoot, timberBuildDir, viteOutDir);
|
|
269
|
+
|
|
270
|
+
// Warn if the Vite root differs from cwd and the re-loaded config
|
|
271
|
+
// has reactCompiler but the early cwd-based load missed it. In this
|
|
272
|
+
// edge case the user must move reactCompiler to inline config.
|
|
273
|
+
if (viteRoot !== process.cwd()) {
|
|
274
|
+
const hasCompilerInReloaded = !config?.reactCompiler && ctx.config.reactCompiler;
|
|
275
|
+
const hadCompilerInEarly = !config?.reactCompiler && earlyFileConfig?.reactCompiler;
|
|
276
|
+
if (hasCompilerInReloaded && !hadCompilerInEarly) {
|
|
277
|
+
console.warn(
|
|
278
|
+
'[timber] reactCompiler is set in timber.config.ts but could not be ' +
|
|
279
|
+
'registered because the config file is in a non-cwd root directory. ' +
|
|
280
|
+
'Move reactCompiler to the inline timber() config in vite.config.ts, or ' +
|
|
281
|
+
'run vite from the project root directory.'
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
354
286
|
// Force production JSX transform for builds.
|
|
355
287
|
//
|
|
356
288
|
// Vite determines dev vs prod JSX via `isProduction`, which checks
|
|
@@ -364,8 +296,104 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
364
296
|
// We explicitly set `oxc.jsx.development: false` for builds so
|
|
365
297
|
// the client bundle always uses jsx/jsxs from react/jsx-runtime,
|
|
366
298
|
// regardless of the ambient NODE_ENV value.
|
|
299
|
+
// ── Resolve dev/preview port (TIM-842) ───────────────────────
|
|
300
|
+
// Default port is 3000 with auto-bump on conflict. Explicit user
|
|
301
|
+
// overrides (`--port`, `PORT` env, `vite.config.ts` server.port)
|
|
302
|
+
// are honored as-is and fail loudly via `strictPort: true`.
|
|
303
|
+
//
|
|
304
|
+
// For dev (`command === 'serve' && !isPreview`) we start the
|
|
305
|
+
// holding server and use its `listen()` as the probe, pairing
|
|
306
|
+
// the probe with the real bind to eliminate TOCTOU races.
|
|
307
|
+
//
|
|
308
|
+
// For `vite preview` (`command === 'serve' && isPreview`) we
|
|
309
|
+
// resolve the config/env port but delegate the actual bind +
|
|
310
|
+
// auto-bump to Vite's own preview server. Starting the holding
|
|
311
|
+
// server in preview mode would self-conflict because the dev
|
|
312
|
+
// plugin's `configureServer` handoff does not run for preview;
|
|
313
|
+
// the holding server would keep the port occupied while Vite's
|
|
314
|
+
// preview tried to bind the same port.
|
|
315
|
+
//
|
|
316
|
+
// See design/21-dev-server.md §"Default Port and Auto-Bump".
|
|
317
|
+
let resolvedDevPort: number | null = null;
|
|
318
|
+
let resolvedDevPortExplicit = false;
|
|
319
|
+
if (command === 'serve' && !isPreview) {
|
|
320
|
+
ctx.holdingServer = createHoldingServer();
|
|
321
|
+
const holdingRef = ctx.holdingServer;
|
|
322
|
+
const result = await startDevServerPort({
|
|
323
|
+
configPort:
|
|
324
|
+
typeof userConfig.server?.port === 'number' ? userConfig.server.port : undefined,
|
|
325
|
+
envPort: process.env.PORT,
|
|
326
|
+
listen: (p) => holdingRef.listen(p),
|
|
327
|
+
});
|
|
328
|
+
if (!result.bound) {
|
|
329
|
+
// Holding server failed to bind. Drop the reference so the
|
|
330
|
+
// dev-server plugin doesn't try to close a server that was
|
|
331
|
+
// never listening.
|
|
332
|
+
ctx.holdingServer = null;
|
|
333
|
+
}
|
|
334
|
+
if (result.bound || result.explicit) {
|
|
335
|
+
// When bound, use the probed port with strictPort so Vite
|
|
336
|
+
// doesn't re-bump. When unbound but explicit, still forward
|
|
337
|
+
// the port so Vite surfaces the conflict via strictPort.
|
|
338
|
+
// When unbound and implicit, skip — let Vite auto-bump.
|
|
339
|
+
resolvedDevPort = result.port;
|
|
340
|
+
resolvedDevPortExplicit = result.explicit;
|
|
341
|
+
}
|
|
342
|
+
} else if (command === 'serve' && isPreview) {
|
|
343
|
+
// Preview mode: resolve the starting port from config/env/
|
|
344
|
+
// default but do NOT probe. Vite's preview server handles the
|
|
345
|
+
// bind itself, with `preview.strictPort` controlling whether
|
|
346
|
+
// an in-use port auto-bumps (implicit) or errors (explicit).
|
|
347
|
+
const previewConfigPort =
|
|
348
|
+
typeof userConfig.preview?.port === 'number'
|
|
349
|
+
? userConfig.preview.port
|
|
350
|
+
: typeof userConfig.server?.port === 'number'
|
|
351
|
+
? userConfig.server.port
|
|
352
|
+
: undefined;
|
|
353
|
+
const start = resolveStartPort({
|
|
354
|
+
configPort: previewConfigPort,
|
|
355
|
+
envPort: process.env.PORT,
|
|
356
|
+
});
|
|
357
|
+
resolvedDevPort = start.port;
|
|
358
|
+
resolvedDevPortExplicit = start.explicit;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Derive relative buildOutDir from the absolute ctx.buildDir (set above)
|
|
362
|
+
// so Vite's config receives a root-relative path.
|
|
363
|
+
const buildOutDir = relative(resolvedRoot, ctx.buildDir);
|
|
364
|
+
|
|
365
|
+
// Set per-environment build.outDir so Vite's RSC plugin writes
|
|
366
|
+
// each environment to the correct subdirectory under our buildDir.
|
|
367
|
+
// Without this, the RSC plugin defaults to dist/<envName> instead
|
|
368
|
+
// of <buildOutDir>/<envName>.
|
|
369
|
+
const envOutDirs: Record<string, { build: { outDir: string } }> = {};
|
|
370
|
+
for (const envName of ['rsc', 'ssr', 'client']) {
|
|
371
|
+
envOutDirs[envName] = { build: { outDir: join(buildOutDir, envName) } };
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Exclude @timber-js/app packages from the dep optimizer.
|
|
375
|
+
// The shims plugin intercepts @timber-js/app/* imports per-environment
|
|
376
|
+
// (e.g. replacing @timber-js/app/server with a stub in the client env).
|
|
377
|
+
// The dep optimizer runs before per-environment resolution, so it would
|
|
378
|
+
// pre-bundle @timber-js/app/cookies with the real server code inlined,
|
|
379
|
+
// pulling AsyncLocalStorage into the browser bundle.
|
|
380
|
+
const timberOptimizeDepsExclude = [
|
|
381
|
+
'@timber-js/app',
|
|
382
|
+
'@timber-js/app/server',
|
|
383
|
+
'@timber-js/app/client',
|
|
384
|
+
'@timber-js/app/cookies',
|
|
385
|
+
'@timber-js/app/cache',
|
|
386
|
+
'@timber-js/app/search-params',
|
|
387
|
+
'@timber-js/app/segment-params',
|
|
388
|
+
'@timber-js/app/params',
|
|
389
|
+
'@timber-js/app/codec',
|
|
390
|
+
];
|
|
391
|
+
|
|
367
392
|
if (command === 'build') {
|
|
368
393
|
return {
|
|
394
|
+
build: { outDir: buildOutDir },
|
|
395
|
+
environments: envOutDirs,
|
|
396
|
+
optimizeDeps: { exclude: timberOptimizeDepsExclude },
|
|
369
397
|
oxc: {
|
|
370
398
|
jsx: {
|
|
371
399
|
development: false,
|
|
@@ -373,11 +401,60 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
373
401
|
},
|
|
374
402
|
};
|
|
375
403
|
}
|
|
404
|
+
|
|
405
|
+
// Dev/preview mode: set outDir so dev-time references are
|
|
406
|
+
// consistent, and surface the resolved port to Vite.
|
|
407
|
+
//
|
|
408
|
+
// For dev, we set strictPort: true so Vite uses exactly the port
|
|
409
|
+
// the holding server probed for — without strictPort, Vite would
|
|
410
|
+
// run its own auto-bump starting from `port`, which would skip
|
|
411
|
+
// straight past whatever holding-server-bumped port we picked.
|
|
412
|
+
//
|
|
413
|
+
// For `vite preview`, we set `preview.strictPort` based on
|
|
414
|
+
// whether the user explicitly set the port. Implicit (default)
|
|
415
|
+
// preview uses strictPort: false so Vite's preview server can
|
|
416
|
+
// auto-bump from 3000. Explicit preview uses strictPort: true
|
|
417
|
+
// so conflicts fail loudly, matching the dev behavior and the
|
|
418
|
+
// TIM-842 spec.
|
|
419
|
+
const serverConfig: { port?: number; strictPort?: boolean } = {};
|
|
420
|
+
const previewConfig: { port?: number; strictPort?: boolean } = {};
|
|
421
|
+
if (resolvedDevPort != null) {
|
|
422
|
+
if (!isPreview) {
|
|
423
|
+
serverConfig.port = resolvedDevPort;
|
|
424
|
+
serverConfig.strictPort = true;
|
|
425
|
+
}
|
|
426
|
+
previewConfig.port = resolvedDevPort;
|
|
427
|
+
previewConfig.strictPort = resolvedDevPortExplicit;
|
|
428
|
+
}
|
|
429
|
+
return {
|
|
430
|
+
build: { outDir: buildOutDir },
|
|
431
|
+
environments: envOutDirs,
|
|
432
|
+
optimizeDeps: { exclude: timberOptimizeDepsExclude },
|
|
433
|
+
server: serverConfig,
|
|
434
|
+
preview: previewConfig,
|
|
435
|
+
};
|
|
376
436
|
},
|
|
377
437
|
configResolved(resolved) {
|
|
378
438
|
ctx.root = resolved.root;
|
|
379
439
|
ctx.appDir = resolveAppDir(resolved.root, ctx.config.appDir);
|
|
380
440
|
ctx.dev = resolved.command === 'serve';
|
|
441
|
+
|
|
442
|
+
// Register all timber config file candidates as Vite config file
|
|
443
|
+
// dependencies so Vite's built-in restart-on-change handles them
|
|
444
|
+
// (including atomic writes that emit unlink+add instead of change).
|
|
445
|
+
// All candidates are registered — not just the one that exists — so
|
|
446
|
+
// that creating a config file after server start also triggers a
|
|
447
|
+
// restart. The watcher.add() call in dev-server.ts ensures all
|
|
448
|
+
// candidates are in the watch set.
|
|
449
|
+
// See design/21-dev-server.md §HMR Wiring.
|
|
450
|
+
const configNames = ['timber.config.ts', 'timber.config.js', 'timber.config.mjs'];
|
|
451
|
+
for (const name of configNames) {
|
|
452
|
+
resolved.configFileDependencies.push(resolve(resolved.root, name));
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// Sync buildDir from Vite's resolved build.outDir. Vite keeps
|
|
456
|
+
// outDir as-is (may be relative), so resolve against root.
|
|
457
|
+
ctx.buildDir = resolve(resolved.root, resolved.build.outDir);
|
|
381
458
|
// In production builds, swap to a no-op timer to avoid overhead
|
|
382
459
|
if (!ctx.dev) {
|
|
383
460
|
ctx.timer = createNoopTimer();
|
|
@@ -385,19 +462,49 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
385
462
|
// Start the overall dev server setup timer — ends in timber-dev-server
|
|
386
463
|
ctx.timer.start('dev-server-setup');
|
|
387
464
|
}
|
|
465
|
+
|
|
466
|
+
// Validate config and check peer dependencies at startup.
|
|
467
|
+
// Errors are logged to stderr but don't block startup — Vite may
|
|
468
|
+
// still work partially, and the errors guide the user to fix things.
|
|
469
|
+
/* eslint-disable no-var-requires -- sync require for startup validation */
|
|
470
|
+
const { validateConfig, formatConfigErrors, checkPeerDependencies, formatMissingPeers } =
|
|
471
|
+
require('./config-validation.js') as typeof import('./config-validation.js');
|
|
472
|
+
/* eslint-enable no-var-requires */
|
|
473
|
+
|
|
474
|
+
const configErrors = validateConfig(ctx.config);
|
|
475
|
+
if (configErrors.length > 0) {
|
|
476
|
+
process.stderr.write(`${formatConfigErrors(configErrors)}\n\n`);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
const peerResults = checkPeerDependencies(ctx.root);
|
|
480
|
+
const peerWarning = formatMissingPeers(peerResults);
|
|
481
|
+
if (peerWarning) {
|
|
482
|
+
process.stderr.write(`${peerWarning}\n\n`);
|
|
483
|
+
}
|
|
388
484
|
},
|
|
389
485
|
};
|
|
486
|
+
|
|
487
|
+
// ── Step 5: Resolve optional plugins ────────────────────────────────
|
|
488
|
+
// React Compiler — resolved eagerly from either inline or file config.
|
|
489
|
+
// Vite's config() hook return type is Omit<UserConfig, 'plugins'>, so
|
|
490
|
+
// plugins MUST be in the top-level array — returning them from config()
|
|
491
|
+
// silently drops them. See TIM-632.
|
|
492
|
+
//
|
|
493
|
+
// Inline config takes precedence. File config (from the early cwd-based
|
|
494
|
+
// load) is used when inline config doesn't set reactCompiler.
|
|
495
|
+
const reactCompilerPlugins: PluginOption[] = [];
|
|
496
|
+
const effectiveReactCompiler = config?.reactCompiler ?? earlyFileConfig?.reactCompiler;
|
|
497
|
+
if (effectiveReactCompiler) {
|
|
498
|
+
reactCompilerPlugins.push(resolveReactCompilerPlugin(effectiveReactCompiler, consumerRequire));
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// ── Step 6: Assemble plugin array ─────────────────────────────────────
|
|
390
502
|
// @vitejs/plugin-rsc handles:
|
|
391
503
|
// - RSC/SSR/client environment setup
|
|
392
504
|
// - "use client" directive → client reference proxy transformation
|
|
393
505
|
// - "use server" directive → server reference transformation
|
|
394
506
|
// - Client reference tracking and module map generation
|
|
395
507
|
//
|
|
396
|
-
// Loaded via dynamic import() because @vitejs/plugin-rsc is ESM-only.
|
|
397
|
-
// Vite's config loader uses esbuild to transpile to CJS, which breaks
|
|
398
|
-
// static imports of ESM-only packages. The dynamic import() is preserved
|
|
399
|
-
// by esbuild and runs natively in ESM at runtime.
|
|
400
|
-
//
|
|
401
508
|
// serverHandler: false — timber has its own dev server (timber-dev-server)
|
|
402
509
|
// entries — tells the RSC plugin about timber's virtual entry modules so
|
|
403
510
|
// it correctly wires up the browser entry (needed for React Fast Refresh
|
|
@@ -410,30 +517,6 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
410
517
|
// We do NOT set customBuildApp — the RSC plugin's orchestration is correct
|
|
411
518
|
// and handles bundle ordering, asset manifest generation, and environment
|
|
412
519
|
// imports manifest. See @vitejs/plugin-rsc's buildApp implementation.
|
|
413
|
-
// Resolve @vitejs/plugin-rsc from the consumer's project (process.cwd()),
|
|
414
|
-
// not from timber's own node_modules. This is critical for pnpm link:
|
|
415
|
-
// when linked, timber's node_modules has a separate vite instance, and
|
|
416
|
-
// the RSC plugin must use the same vite instance as the dev server.
|
|
417
|
-
const consumerRequire = createRequire(join(process.cwd(), 'package.json'));
|
|
418
|
-
const rscPluginPath = consumerRequire.resolve('@vitejs/plugin-rsc');
|
|
419
|
-
ctx.timer.start('rsc-plugin-import');
|
|
420
|
-
const rscPluginsPromise = import(pathToFileURL(rscPluginPath).href).then(
|
|
421
|
-
({ default: vitePluginRsc }) => {
|
|
422
|
-
ctx.timer.end('rsc-plugin-import');
|
|
423
|
-
return vitePluginRsc({
|
|
424
|
-
serverHandler: false,
|
|
425
|
-
customClientEntry: true,
|
|
426
|
-
entries: {
|
|
427
|
-
rsc: 'virtual:timber-rsc-entry',
|
|
428
|
-
ssr: 'virtual:timber-ssr-entry',
|
|
429
|
-
client: 'virtual:timber-browser-entry',
|
|
430
|
-
},
|
|
431
|
-
// No custom clientChunks — Rolldown handles natural code splitting.
|
|
432
|
-
// See design/27-chunking-strategy.md and LOCAL-337.
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
);
|
|
436
|
-
|
|
437
520
|
return [
|
|
438
521
|
rootSync,
|
|
439
522
|
timberReactProd(),
|
|
@@ -442,38 +525,26 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
442
525
|
// following Vinext's convention — the RSC plugin's virtual browser entry
|
|
443
526
|
// coordinates with plugin-react via __vite_plugin_react_preamble_installed__.
|
|
444
527
|
react(),
|
|
445
|
-
|
|
446
|
-
|
|
528
|
+
...reactCompilerPlugins,
|
|
529
|
+
vitePluginRsc(createRscOptions(ctx, encryptionKeyExpr)),
|
|
447
530
|
timberShims(ctx),
|
|
448
531
|
timberRouting(ctx),
|
|
449
532
|
timberEntries(ctx),
|
|
450
533
|
timberBuildManifest(ctx),
|
|
451
|
-
timberCache(ctx),
|
|
452
534
|
timberStaticBuild(ctx),
|
|
453
|
-
timberDynamicTransform(ctx),
|
|
454
535
|
timberFonts(ctx),
|
|
455
536
|
timberMdx(ctx),
|
|
537
|
+
timberCacheTransform(ctx),
|
|
456
538
|
timberContent(ctx),
|
|
457
539
|
timberServerBundle(), // Bundle all deps in server environments for prod
|
|
540
|
+
timberCloudflareWasm(ctx), // Externalize WASM for Cloudflare Workers
|
|
458
541
|
timberChunks(),
|
|
459
542
|
timberBuildReport(ctx), // Post-build: route table with bundle sizes
|
|
460
543
|
timberAdapterBuild(ctx), // Post-build: invoke adapter.buildOutput()
|
|
461
544
|
timberDevLogs(ctx), // Dev-only: forward server console.* to browser console
|
|
545
|
+
timberDevBrowserLogs(ctx), // Dev-only: forward browser console.* to server terminal
|
|
462
546
|
timberDevServer(ctx), // Must be last — configureServer post-hook runs after all watchers
|
|
463
547
|
];
|
|
464
548
|
}
|
|
465
549
|
|
|
466
|
-
/**
|
|
467
|
-
* Route map interface — augmented by the generated timber-routes.d.ts.
|
|
468
|
-
*
|
|
469
|
-
* Each key is a route path pattern. Values have:
|
|
470
|
-
* params: shape of URL params (e.g. { id: string })
|
|
471
|
-
* searchParams: parsed type from search-params.ts, or {} if none
|
|
472
|
-
*
|
|
473
|
-
* This interface is empty by default and populated via codegen.
|
|
474
|
-
* See design/09-typescript.md §"Typed Routes".
|
|
475
|
-
*/
|
|
476
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
477
|
-
export interface Routes {}
|
|
478
|
-
|
|
479
550
|
export default timber;
|