@timber-js/app 0.2.0-alpha.21 → 0.2.0-alpha.210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/agent-skill.md +346 -0
- package/bin/timber.mjs +15 -1
- package/dist/_chunks/actions-Rjk4htmA.js +1199 -0
- package/dist/_chunks/actions-Rjk4htmA.js.map +1 -0
- package/dist/_chunks/als-registry-DaxkVjt5.js +45 -0
- package/dist/_chunks/als-registry-DaxkVjt5.js.map +1 -0
- package/dist/_chunks/als-slots-BEEIPKYm.js +26 -0
- package/dist/_chunks/als-slots-BEEIPKYm.js.map +1 -0
- package/dist/_chunks/base-path-DaQrzbez.js +80 -0
- package/dist/_chunks/base-path-DaQrzbez.js.map +1 -0
- package/dist/_chunks/build-manifest-DWppEdLB.js +86 -0
- package/dist/_chunks/build-manifest-DWppEdLB.js.map +1 -0
- package/dist/_chunks/build-output-helper-RV_BRcF1.js +367 -0
- package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +1 -0
- package/dist/_chunks/cache-api-DGdYfNJn.js +1182 -0
- package/dist/_chunks/cache-api-DGdYfNJn.js.map +1 -0
- package/dist/_chunks/canonicalize-CgHoscYO.js +66 -0
- package/dist/_chunks/canonicalize-CgHoscYO.js.map +1 -0
- package/dist/_chunks/chains-BoO51joc.js +413 -0
- package/dist/_chunks/chains-BoO51joc.js.map +1 -0
- package/dist/_chunks/cli-check-ajNY3B2e.js +252 -0
- package/dist/_chunks/cli-check-ajNY3B2e.js.map +1 -0
- package/dist/_chunks/cli-context-By7k2xVo.js +70 -0
- package/dist/_chunks/cli-context-By7k2xVo.js.map +1 -0
- package/dist/_chunks/cli-schema-sync-D2eI8jEg.js +299 -0
- package/dist/_chunks/cli-schema-sync-D2eI8jEg.js.map +1 -0
- package/dist/_chunks/cloudflare-Byxl8FWP.js +1333 -0
- package/dist/_chunks/cloudflare-Byxl8FWP.js.map +1 -0
- package/dist/_chunks/codec-registry-oOUxugz3.js +21 -0
- package/dist/_chunks/codec-registry-oOUxugz3.js.map +1 -0
- package/dist/_chunks/codegen-Bps1sLKJ.js +432 -0
- package/dist/_chunks/codegen-Bps1sLKJ.js.map +1 -0
- package/dist/_chunks/convention-lint-DLmhGsRS.js +590 -0
- package/dist/_chunks/convention-lint-DLmhGsRS.js.map +1 -0
- package/dist/_chunks/dev-server-v97rQH4b.js +2039 -0
- package/dist/_chunks/dev-server-v97rQH4b.js.map +1 -0
- package/dist/_chunks/dist-DtrJyBbw.js +386 -0
- package/dist/_chunks/dist-DtrJyBbw.js.map +1 -0
- package/dist/_chunks/error-boundary-DsNScGRM.js +1024 -0
- package/dist/_chunks/error-boundary-DsNScGRM.js.map +1 -0
- package/dist/_chunks/fast-hash-C-tVYrLb.js +41 -0
- package/dist/_chunks/fast-hash-C-tVYrLb.js.map +1 -0
- package/dist/_chunks/format-BKclgVbk.js +14 -0
- package/dist/_chunks/format-BKclgVbk.js.map +1 -0
- package/dist/_chunks/fs-identity-BRKuL215.js +207 -0
- package/dist/_chunks/fs-identity-BRKuL215.js.map +1 -0
- package/dist/_chunks/graph-cache-CYiUS2aS.js +303 -0
- package/dist/_chunks/graph-cache-CYiUS2aS.js.map +1 -0
- package/dist/_chunks/href-validation-BIrxavIy.js +213 -0
- package/dist/_chunks/href-validation-BIrxavIy.js.map +1 -0
- package/dist/_chunks/json-lossy-check-CVuRs2hG.js +66 -0
- package/dist/_chunks/json-lossy-check-CVuRs2hG.js.map +1 -0
- package/dist/_chunks/live-graph-9cSnn_h9.js +150 -0
- package/dist/_chunks/live-graph-9cSnn_h9.js.map +1 -0
- package/dist/_chunks/logger-BP0LN6vP.js +662 -0
- package/dist/_chunks/logger-BP0LN6vP.js.map +1 -0
- package/dist/_chunks/{metadata-routes-Cjmvi3rQ.js → metadata-routes-DSDjM_hJ.js} +71 -27
- package/dist/_chunks/metadata-routes-DSDjM_hJ.js.map +1 -0
- package/dist/_chunks/navigation-root-BQfo1-kG.js +126 -0
- package/dist/_chunks/navigation-root-BQfo1-kG.js.map +1 -0
- package/dist/_chunks/param-value-C8TNYchQ.js +66 -0
- package/dist/_chunks/param-value-C8TNYchQ.js.map +1 -0
- package/dist/_chunks/plugin-context-BPBPc3lL.js +345 -0
- package/dist/_chunks/plugin-context-BPBPc3lL.js.map +1 -0
- package/dist/_chunks/poison-rules-DoEhbqaY.js +110 -0
- package/dist/_chunks/poison-rules-DoEhbqaY.js.map +1 -0
- package/dist/_chunks/poison-scan-vGV7Re0B.js +101 -0
- package/dist/_chunks/poison-scan-vGV7Re0B.js.map +1 -0
- package/dist/_chunks/purge-store-Byr8XOjU.js +14 -0
- package/dist/_chunks/purge-store-Byr8XOjU.js.map +1 -0
- package/dist/_chunks/render-timeout-DOf_BBcO.js +46 -0
- package/dist/_chunks/render-timeout-DOf_BBcO.js.map +1 -0
- package/dist/_chunks/resolve-schema-CBR6Lm4i.js +50 -0
- package/dist/_chunks/resolve-schema-CBR6Lm4i.js.map +1 -0
- package/dist/_chunks/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/_chunks/rsc-cache-key-ClUiXQnK.js +243 -0
- package/dist/_chunks/rsc-cache-key-ClUiXQnK.js.map +1 -0
- package/dist/_chunks/rsc-media-type-DDc7duTD.js +61 -0
- package/dist/_chunks/rsc-media-type-DDc7duTD.js.map +1 -0
- package/dist/_chunks/rsc-payload-path-dffcs4jp.js +54 -0
- package/dist/_chunks/rsc-payload-path-dffcs4jp.js.map +1 -0
- package/dist/_chunks/scan-BoP17W3w.js +140 -0
- package/dist/_chunks/scan-BoP17W3w.js.map +1 -0
- package/dist/_chunks/scanner-DmqdxzbW.js +2056 -0
- package/dist/_chunks/scanner-DmqdxzbW.js.map +1 -0
- package/dist/_chunks/schema-bridge-C83xa9lT.js +199 -0
- package/dist/_chunks/schema-bridge-C83xa9lT.js.map +1 -0
- package/dist/_chunks/segment-classify-C539Pa2O.js +197 -0
- package/dist/_chunks/segment-classify-C539Pa2O.js.map +1 -0
- package/dist/_chunks/segment-context-xtPUGfdq.js +137 -0
- package/dist/_chunks/segment-context-xtPUGfdq.js.map +1 -0
- package/dist/_chunks/segment-keys-D5hu1hz4.js +62 -0
- package/dist/_chunks/segment-keys-D5hu1hz4.js.map +1 -0
- package/dist/_chunks/singleflight-BeVMMKi0.js +55 -0
- package/dist/_chunks/singleflight-BeVMMKi0.js.map +1 -0
- package/dist/_chunks/sizeof-BM1409x2.js +36 -0
- package/dist/_chunks/sizeof-BM1409x2.js.map +1 -0
- package/dist/_chunks/ssr-data-nA3I70_n.js +49 -0
- package/dist/_chunks/ssr-data-nA3I70_n.js.map +1 -0
- package/dist/_chunks/state-BhNGPsdi.js +50 -0
- package/dist/_chunks/state-BhNGPsdi.js.map +1 -0
- package/dist/_chunks/status-page-marker-BRX9Ib-d.js +564 -0
- package/dist/_chunks/status-page-marker-BRX9Ib-d.js.map +1 -0
- package/dist/_chunks/tree-match-6yihorhk.js +169 -0
- package/dist/_chunks/tree-match-6yihorhk.js.map +1 -0
- package/dist/_chunks/use-query-states-I3JMng6J.js +226 -0
- package/dist/_chunks/use-query-states-I3JMng6J.js.map +1 -0
- package/dist/_chunks/walkers-Czu2jXFq.js +144 -0
- package/dist/_chunks/walkers-Czu2jXFq.js.map +1 -0
- package/dist/_chunks/write-file-atomic-D1qWqHb4.js +32 -0
- package/dist/_chunks/write-file-atomic-D1qWqHb4.js.map +1 -0
- package/dist/adapters/build-output-helper.d.ts +72 -0
- package/dist/adapters/build-output-helper.d.ts.map +1 -0
- package/dist/adapters/canonicalize-module.d.ts +8 -0
- package/dist/adapters/canonicalize-module.d.ts.map +1 -0
- package/dist/adapters/cloudflare-dev.d.ts +109 -0
- package/dist/adapters/cloudflare-dev.d.ts.map +1 -0
- package/dist/adapters/cloudflare-dev.js +74 -0
- package/dist/adapters/cloudflare-dev.js.map +1 -0
- package/dist/adapters/cloudflare-kv-cache.d.ts +65 -0
- package/dist/adapters/cloudflare-kv-cache.d.ts.map +1 -0
- package/dist/adapters/cloudflare-kv-cache.js +123 -0
- package/dist/adapters/cloudflare-kv-cache.js.map +1 -0
- package/dist/adapters/cloudflare.d.ts +224 -24
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +2 -188
- package/dist/adapters/compress-module.d.ts +25 -4
- package/dist/adapters/compress-module.d.ts.map +1 -1
- package/dist/adapters/fs-identity.d.ts +63 -0
- package/dist/adapters/fs-identity.d.ts.map +1 -0
- package/dist/adapters/nitro-presets.d.ts +31 -0
- package/dist/adapters/nitro-presets.d.ts.map +1 -0
- package/dist/adapters/nitro-preview.d.ts +64 -0
- package/dist/adapters/nitro-preview.d.ts.map +1 -0
- package/dist/adapters/nitro.d.ts +54 -37
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +631 -359
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/shared.d.ts +67 -0
- package/dist/adapters/shared.d.ts.map +1 -0
- package/dist/adapters/types.d.ts +122 -16
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/adapters/types.js +0 -0
- package/dist/analyze/chains.d.ts +124 -0
- package/dist/analyze/chains.d.ts.map +1 -0
- package/dist/analyze/classify.d.ts +151 -0
- package/dist/analyze/classify.d.ts.map +1 -0
- package/dist/analyze/crawl-entry.d.ts +17 -0
- package/dist/analyze/crawl-entry.d.ts.map +1 -0
- package/dist/analyze/crawl-entry.js +313 -0
- package/dist/analyze/crawl-entry.js.map +1 -0
- package/dist/analyze/crawl.d.ts +134 -0
- package/dist/analyze/crawl.d.ts.map +1 -0
- package/dist/analyze/graph-cache.d.ts +104 -0
- package/dist/analyze/graph-cache.d.ts.map +1 -0
- package/dist/analyze/graph-command.d.ts +43 -0
- package/dist/analyze/graph-command.d.ts.map +1 -0
- package/dist/analyze/graph-command.js +472 -0
- package/dist/analyze/graph-command.js.map +1 -0
- package/dist/analyze/live-graph.d.ts +81 -0
- package/dist/analyze/live-graph.d.ts.map +1 -0
- package/dist/analyze/poison-rules.d.ts +72 -0
- package/dist/analyze/poison-rules.d.ts.map +1 -0
- package/dist/analyze/poison-scan.d.ts +48 -0
- package/dist/analyze/poison-scan.d.ts.map +1 -0
- package/dist/analyze/scan.d.ts +73 -0
- package/dist/analyze/scan.d.ts.map +1 -0
- package/dist/cache/cache-api.d.ts +48 -0
- package/dist/cache/cache-api.d.ts.map +1 -0
- package/dist/cache/fast-hash.d.ts +5 -0
- package/dist/cache/fast-hash.d.ts.map +1 -1
- package/dist/cache/handler-store.d.ts +33 -0
- package/dist/cache/handler-store.d.ts.map +1 -0
- package/dist/cache/index.d.ts +32 -9
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +3 -326
- package/dist/cache/invalidation-epoch.d.ts +43 -0
- package/dist/cache/invalidation-epoch.d.ts.map +1 -0
- package/dist/cache/json-lossy-check.d.ts +11 -0
- package/dist/cache/json-lossy-check.d.ts.map +1 -0
- package/dist/cache/redis-handler.d.ts +141 -9
- package/dist/cache/redis-handler.d.ts.map +1 -1
- package/dist/cache/singleflight.d.ts +21 -2
- package/dist/cache/singleflight.d.ts.map +1 -1
- package/dist/cache/sizeof.d.ts +22 -0
- package/dist/cache/sizeof.d.ts.map +1 -0
- package/dist/cache/stable-stringify.d.ts +9 -0
- package/dist/cache/stable-stringify.d.ts.map +1 -1
- package/dist/cache/store.d.ts +53 -0
- package/dist/cache/store.d.ts.map +1 -0
- package/dist/cache/stores/cloudflare-kv.d.ts +38 -0
- package/dist/cache/stores/cloudflare-kv.d.ts.map +1 -0
- package/dist/cache/stores/cloudflare-kv.js +29 -0
- package/dist/cache/stores/cloudflare-kv.js.map +1 -0
- package/dist/cache/stores/memory.d.ts +42 -0
- package/dist/cache/stores/memory.d.ts.map +1 -0
- package/dist/cache/stores/memory.js +90 -0
- package/dist/cache/stores/memory.js.map +1 -0
- package/dist/cache/stores/redis.d.ts +69 -0
- package/dist/cache/stores/redis.d.ts.map +1 -0
- package/dist/cache/stores/redis.js +35 -0
- package/dist/cache/stores/redis.js.map +1 -0
- package/dist/cache/stores/vercel.d.ts +36 -0
- package/dist/cache/stores/vercel.d.ts.map +1 -0
- package/dist/cache/stores/vercel.js +33 -0
- package/dist/cache/stores/vercel.js.map +1 -0
- package/dist/cache/tag-aware-handler.d.ts +52 -0
- package/dist/cache/tag-aware-handler.d.ts.map +1 -0
- package/dist/cache/timber-cache.d.ts +21 -11
- package/dist/cache/timber-cache.d.ts.map +1 -1
- package/dist/cdn/cloudflare-purge.d.ts +23 -0
- package/dist/cdn/cloudflare-purge.d.ts.map +1 -0
- package/dist/cdn/cloudflare-purge.js +30 -0
- package/dist/cdn/cloudflare-purge.js.map +1 -0
- package/dist/cdn/fastly-purge.d.ts +25 -0
- package/dist/cdn/fastly-purge.d.ts.map +1 -0
- package/dist/cdn/fastly-purge.js +33 -0
- package/dist/cdn/fastly-purge.js.map +1 -0
- package/dist/cdn/headers.d.ts +97 -0
- package/dist/cdn/headers.d.ts.map +1 -0
- package/dist/cdn/index.d.ts +5 -0
- package/dist/cdn/index.d.ts.map +1 -0
- package/dist/cdn/index.js +94 -0
- package/dist/cdn/index.js.map +1 -0
- package/dist/cdn/purge-store.d.ts +23 -0
- package/dist/cdn/purge-store.d.ts.map +1 -0
- package/dist/cdn/workers-cache-purge.d.ts +20 -0
- package/dist/cdn/workers-cache-purge.d.ts.map +1 -0
- package/dist/cdn/workers-cache-purge.js +35 -0
- package/dist/cdn/workers-cache-purge.js.map +1 -0
- package/dist/cli-check.d.ts +133 -0
- package/dist/cli-check.d.ts.map +1 -0
- package/dist/cli-context.d.ts +54 -0
- package/dist/cli-context.d.ts.map +1 -0
- package/dist/cli-schema-sync.d.ts +59 -0
- package/dist/cli-schema-sync.d.ts.map +1 -0
- package/dist/cli.d.ts +85 -13
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +224 -63
- package/dist/cli.js.map +1 -1
- package/dist/client/browser-dev.d.ts +42 -2
- package/dist/client/browser-dev.d.ts.map +1 -1
- package/dist/client/browser-entry/action-dispatch.d.ts +19 -0
- package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -0
- package/dist/client/browser-entry/action-queue.d.ts +63 -0
- package/dist/client/browser-entry/action-queue.d.ts.map +1 -0
- package/dist/client/browser-entry/hmr.d.ts +21 -0
- package/dist/client/browser-entry/hmr.d.ts.map +1 -0
- package/dist/client/browser-entry/hydrate.d.ts +53 -0
- package/dist/client/browser-entry/hydrate.d.ts.map +1 -0
- package/dist/client/browser-entry/index.d.ts +30 -0
- package/dist/client/browser-entry/index.d.ts.map +1 -0
- package/dist/client/browser-entry/post-hydration.d.ts +26 -0
- package/dist/client/browser-entry/post-hydration.d.ts.map +1 -0
- package/dist/client/browser-entry/router-init.d.ts +41 -0
- package/dist/client/browser-entry/router-init.d.ts.map +1 -0
- package/dist/client/browser-entry/rsc-stream.d.ts +32 -0
- package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -0
- package/dist/client/browser-entry/scroll.d.ts +28 -0
- package/dist/client/browser-entry/scroll.d.ts.map +1 -0
- package/dist/client/deny-last-resort.d.ts +29 -0
- package/dist/client/deny-last-resort.d.ts.map +1 -0
- package/dist/client/error-boundary.d.ts +58 -9
- package/dist/client/error-boundary.d.ts.map +1 -1
- package/dist/client/error-boundary.js +2 -126
- package/dist/client/error-reconstituter.d.ts +55 -0
- package/dist/client/error-reconstituter.d.ts.map +1 -0
- package/dist/client/form.d.ts +16 -27
- package/dist/client/form.d.ts.map +1 -1
- package/dist/client/global-context.d.ts +15 -0
- package/dist/client/global-context.d.ts.map +1 -0
- package/dist/client/history.d.ts +50 -9
- package/dist/client/history.d.ts.map +1 -1
- package/dist/client/index.d.ts +20 -33
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +330 -1150
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +20 -0
- package/dist/client/internal.d.ts.map +1 -0
- package/dist/client/internal.js +792 -0
- package/dist/client/internal.js.map +1 -0
- package/dist/client/link.d.ts +85 -60
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/location-search.d.ts +12 -0
- package/dist/client/location-search.d.ts.map +1 -0
- package/dist/client/navigation-api.d.ts +133 -0
- package/dist/client/navigation-api.d.ts.map +1 -0
- package/dist/client/navigation-commit.d.ts +111 -0
- package/dist/client/navigation-commit.d.ts.map +1 -0
- package/dist/client/navigation-context.d.ts +54 -36
- package/dist/client/navigation-context.d.ts.map +1 -1
- package/dist/client/navigation-root.d.ts +106 -0
- package/dist/client/navigation-root.d.ts.map +1 -0
- package/dist/client/navigation-transition.d.ts +192 -0
- package/dist/client/navigation-transition.d.ts.map +1 -0
- package/dist/client/nuqs-adapter.d.ts +1 -1
- package/dist/client/nuqs-adapter.d.ts.map +1 -1
- package/dist/client/params-context.d.ts +81 -0
- package/dist/client/params-context.d.ts.map +1 -0
- package/dist/client/react-root.d.ts +45 -0
- package/dist/client/react-root.d.ts.map +1 -0
- package/dist/client/router-effects.d.ts +137 -0
- package/dist/client/router-effects.d.ts.map +1 -0
- package/dist/client/router-lifecycle.d.ts +98 -0
- package/dist/client/router-lifecycle.d.ts.map +1 -0
- package/dist/client/router-pipeline.d.ts +84 -0
- package/dist/client/router-pipeline.d.ts.map +1 -0
- package/dist/client/router-ref.d.ts +2 -2
- package/dist/client/router-ref.d.ts.map +1 -1
- package/dist/client/router-skew.d.ts +21 -0
- package/dist/client/router-skew.d.ts.map +1 -0
- package/dist/client/router-types.d.ts +334 -0
- package/dist/client/router-types.d.ts.map +1 -0
- package/dist/client/router-url.d.ts +24 -0
- package/dist/client/router-url.d.ts.map +1 -0
- package/dist/client/router.d.ts +1 -97
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/rsc-fetch.d.ts +110 -28
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +186 -25
- package/dist/client/segment-cache.d.ts.map +1 -1
- package/dist/client/segment-context.d.ts.map +1 -1
- package/dist/client/segment-outlet.d.ts +68 -0
- package/dist/client/segment-outlet.d.ts.map +1 -0
- package/dist/client/segment-update-context.d.ts +15 -0
- package/dist/client/segment-update-context.d.ts.map +1 -0
- package/dist/client/shallow-url.d.ts +10 -0
- package/dist/client/shallow-url.d.ts.map +1 -0
- package/dist/client/slot-content-cache-context.d.ts +35 -0
- package/dist/client/slot-content-cache-context.d.ts.map +1 -0
- package/dist/client/slot-context.d.ts +31 -0
- package/dist/client/slot-context.d.ts.map +1 -0
- package/dist/client/slot-outlet.d.ts +16 -0
- package/dist/client/slot-outlet.d.ts.map +1 -0
- package/dist/client/slot-provider.d.ts +25 -0
- package/dist/client/slot-provider.d.ts.map +1 -0
- package/dist/client/ssr-data.d.ts +26 -50
- package/dist/client/ssr-data.d.ts.map +1 -1
- package/dist/client/stale-client.d.ts +69 -0
- package/dist/client/stale-client.d.ts.map +1 -0
- package/dist/client/state.d.ts +21 -13
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/status-page-marker.d.ts +25 -0
- package/dist/client/status-page-marker.d.ts.map +1 -0
- package/dist/client/top-loader.d.ts +7 -6
- package/dist/client/top-loader.d.ts.map +1 -1
- package/dist/client/unload-guard.d.ts +5 -0
- package/dist/client/unload-guard.d.ts.map +1 -1
- package/dist/client/use-cookie.d.ts +12 -0
- package/dist/client/use-cookie.d.ts.map +1 -1
- package/dist/client/use-link-status.d.ts +5 -5
- package/dist/client/use-link-status.d.ts.map +1 -1
- package/dist/client/use-pathname.d.ts +13 -11
- package/dist/client/use-pathname.d.ts.map +1 -1
- package/dist/client/use-pending-navigation.d.ts +23 -0
- package/dist/client/use-pending-navigation.d.ts.map +1 -0
- package/dist/client/use-query-states.d.ts +10 -4
- package/dist/client/use-query-states.d.ts.map +1 -1
- package/dist/client/use-router.d.ts +15 -8
- package/dist/client/use-router.d.ts.map +1 -1
- package/dist/client/use-search-params.d.ts +15 -8
- package/dist/client/use-search-params.d.ts.map +1 -1
- package/dist/client/use-segment-params.d.ts +55 -0
- package/dist/client/use-segment-params.d.ts.map +1 -0
- package/dist/codec.d.ts +69 -0
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +76 -0
- package/dist/codec.js.map +1 -0
- package/dist/config-types.d.ts +323 -0
- package/dist/config-types.d.ts.map +1 -0
- package/dist/config-validation.d.ts +68 -0
- package/dist/config-validation.d.ts.map +1 -0
- package/dist/cookies/define-cookie.d.ts +58 -25
- package/dist/cookies/define-cookie.d.ts.map +1 -1
- package/dist/cookies/index.d.ts +3 -2
- package/dist/cookies/index.d.ts.map +1 -1
- package/dist/cookies/index.js +256 -36
- package/dist/cookies/index.js.map +1 -1
- package/dist/cookies/json-cookie.d.ts +64 -0
- package/dist/cookies/json-cookie.d.ts.map +1 -0
- package/dist/cookies/validation.d.ts +34 -0
- package/dist/cookies/validation.d.ts.map +1 -0
- package/dist/dev-tools/404-page.d.ts +50 -0
- package/dist/dev-tools/404-page.d.ts.map +1 -0
- package/dist/dev-tools/browser-logs.d.ts +40 -0
- package/dist/dev-tools/browser-logs.d.ts.map +1 -0
- package/dist/dev-tools/dev-page-shell.d.ts +95 -0
- package/dist/dev-tools/dev-page-shell.d.ts.map +1 -0
- package/dist/dev-tools/error-page.d.ts +32 -0
- package/dist/dev-tools/error-page.d.ts.map +1 -0
- package/dist/dev-tools/holding-server.d.ts +46 -0
- package/dist/dev-tools/holding-server.d.ts.map +1 -0
- package/dist/dev-tools/hydration-overlay.d.ts +11 -0
- package/dist/dev-tools/hydration-overlay.d.ts.map +1 -0
- package/dist/dev-tools/index.d.ts +31 -0
- package/dist/dev-tools/index.d.ts.map +1 -0
- package/dist/dev-tools/instrumentation.d.ts +74 -0
- package/dist/dev-tools/instrumentation.d.ts.map +1 -0
- package/dist/{server/dev-logger.d.ts → dev-tools/logger.d.ts} +1 -1
- package/dist/dev-tools/logger.d.ts.map +1 -0
- package/dist/{plugins/dev-logs.d.ts → dev-tools/logs.d.ts} +17 -3
- package/dist/dev-tools/logs.d.ts.map +1 -0
- package/dist/{plugins/dev-error-overlay.d.ts → dev-tools/overlay.d.ts} +15 -25
- package/dist/dev-tools/overlay.d.ts.map +1 -0
- package/dist/dev-tools/stack-classifier.d.ts +34 -0
- package/dist/dev-tools/stack-classifier.d.ts.map +1 -0
- package/dist/dev-tools/terminal.d.ts +28 -0
- package/dist/dev-tools/terminal.d.ts.map +1 -0
- package/dist/fonts/ast-walk.d.ts +68 -0
- package/dist/fonts/ast-walk.d.ts.map +1 -0
- package/dist/fonts/ast.d.ts +112 -8
- package/dist/fonts/ast.d.ts.map +1 -1
- package/dist/fonts/bundle.d.ts +50 -0
- package/dist/fonts/bundle.d.ts.map +1 -0
- package/dist/fonts/css.d.ts +1 -1
- package/dist/fonts/dev-middleware.d.ts +22 -0
- package/dist/fonts/dev-middleware.d.ts.map +1 -0
- package/dist/fonts/fallbacks.d.ts +0 -7
- package/dist/fonts/fallbacks.d.ts.map +1 -1
- package/dist/fonts/google.d.ts +5 -3
- package/dist/fonts/google.d.ts.map +1 -1
- package/dist/fonts/local.d.ts +5 -5
- package/dist/fonts/local.d.ts.map +1 -1
- package/dist/fonts/paths.d.ts +43 -0
- package/dist/fonts/paths.d.ts.map +1 -0
- package/dist/fonts/pipeline.d.ts +177 -0
- package/dist/fonts/pipeline.d.ts.map +1 -0
- package/dist/fonts/transform.d.ts +82 -0
- package/dist/fonts/transform.d.ts.map +1 -0
- package/dist/fonts/types.d.ts +47 -1
- package/dist/fonts/types.d.ts.map +1 -1
- package/dist/fonts/virtual-modules.d.ts +77 -0
- package/dist/fonts/virtual-modules.d.ts.map +1 -0
- package/dist/index.d.ts +35 -181
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8844 -14244
- package/dist/index.js.map +1 -1
- package/dist/params/codec-registry.d.ts +26 -0
- package/dist/params/codec-registry.d.ts.map +1 -0
- package/dist/params/define-schema.d.ts +81 -0
- package/dist/params/define-schema.d.ts.map +1 -0
- package/dist/params/index.d.ts +5 -0
- package/dist/params/index.d.ts.map +1 -0
- package/dist/params/index.js +34 -0
- package/dist/params/index.js.map +1 -0
- package/dist/params/resolve-schema.d.ts +34 -0
- package/dist/params/resolve-schema.d.ts.map +1 -0
- package/dist/plugin-context.d.ts +262 -0
- package/dist/plugin-context.d.ts.map +1 -0
- package/dist/plugins/build-manifest.d.ts +7 -3
- package/dist/plugins/build-manifest.d.ts.map +1 -1
- package/dist/plugins/build-report.d.ts +61 -11
- package/dist/plugins/build-report.d.ts.map +1 -1
- package/dist/plugins/cache.d.ts +64 -0
- package/dist/plugins/cache.d.ts.map +1 -0
- package/dist/plugins/callsite-ast.d.ts +117 -0
- package/dist/plugins/callsite-ast.d.ts.map +1 -0
- package/dist/plugins/callsite-jsx.d.ts +35 -0
- package/dist/plugins/callsite-jsx.d.ts.map +1 -0
- package/dist/plugins/chunks.d.ts +11 -4
- package/dist/plugins/chunks.d.ts.map +1 -1
- package/dist/plugins/client-chunks.d.ts +40 -0
- package/dist/plugins/client-chunks.d.ts.map +1 -0
- package/dist/plugins/cloudflare-wasm.d.ts +21 -0
- package/dist/plugins/cloudflare-wasm.d.ts.map +1 -0
- package/dist/plugins/content.d.ts +1 -1
- package/dist/plugins/content.d.ts.map +1 -1
- package/dist/plugins/dev-discovery.d.ts +123 -0
- package/dist/plugins/dev-discovery.d.ts.map +1 -0
- package/dist/plugins/dev-server.d.ts +24 -1
- package/dist/plugins/dev-server.d.ts.map +1 -1
- package/dist/plugins/entries.d.ts +28 -4
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/plugins/fonts.d.ts +35 -74
- package/dist/plugins/fonts.d.ts.map +1 -1
- package/dist/plugins/graph-endpoint.d.ts +112 -0
- package/dist/plugins/graph-endpoint.d.ts.map +1 -0
- package/dist/plugins/mdx.d.ts +18 -5
- package/dist/plugins/mdx.d.ts.map +1 -1
- package/dist/plugins/post-build.d.ts +110 -0
- package/dist/plugins/post-build.d.ts.map +1 -0
- package/dist/plugins/prebuilt-capture.d.ts +67 -0
- package/dist/plugins/prebuilt-capture.d.ts.map +1 -0
- package/dist/plugins/prebuilt-options-analysis.d.ts +40 -0
- package/dist/plugins/prebuilt-options-analysis.d.ts.map +1 -0
- package/dist/plugins/prebuilt.d.ts +98 -0
- package/dist/plugins/prebuilt.d.ts.map +1 -0
- package/dist/plugins/prerender-sugar.d.ts +39 -0
- package/dist/plugins/prerender-sugar.d.ts.map +1 -0
- package/dist/plugins/react-resolve.d.ts +49 -0
- package/dist/plugins/react-resolve.d.ts.map +1 -0
- package/dist/plugins/request-dep/analysis.d.ts +106 -0
- package/dist/plugins/request-dep/analysis.d.ts.map +1 -0
- package/dist/plugins/request-dep/index.d.ts +75 -0
- package/dist/plugins/request-dep/index.d.ts.map +1 -0
- package/dist/plugins/request-dep/origin.d.ts +61 -0
- package/dist/plugins/request-dep/origin.d.ts.map +1 -0
- package/dist/plugins/routing.d.ts +1 -1
- package/dist/plugins/routing.d.ts.map +1 -1
- package/dist/plugins/rsc-assets-manifest.d.ts +33 -0
- package/dist/plugins/rsc-assets-manifest.d.ts.map +1 -0
- package/dist/plugins/server-bundle.d.ts.map +1 -1
- package/dist/plugins/shims.d.ts +29 -5
- package/dist/plugins/shims.d.ts.map +1 -1
- package/dist/plugins/static-build.d.ts +246 -26
- package/dist/plugins/static-build.d.ts.map +1 -1
- package/dist/routing/codegen-shared.d.ts +26 -0
- package/dist/routing/codegen-shared.d.ts.map +1 -0
- package/dist/routing/codegen-types.d.ts +61 -0
- package/dist/routing/codegen-types.d.ts.map +1 -0
- package/dist/routing/codegen-write.d.ts +42 -0
- package/dist/routing/codegen-write.d.ts.map +1 -0
- package/dist/routing/codegen.d.ts +8 -3
- package/dist/routing/codegen.d.ts.map +1 -1
- package/dist/routing/collision-probe.d.ts +104 -0
- package/dist/routing/collision-probe.d.ts.map +1 -0
- package/dist/routing/collision-spaces.d.ts +26 -0
- package/dist/routing/collision-spaces.d.ts.map +1 -0
- package/dist/routing/convention-lint.d.ts +55 -0
- package/dist/routing/convention-lint.d.ts.map +1 -0
- package/dist/routing/export-detect.d.ts +91 -0
- package/dist/routing/export-detect.d.ts.map +1 -0
- package/dist/routing/file-cache.d.ts +8 -0
- package/dist/routing/file-cache.d.ts.map +1 -0
- package/dist/routing/index.d.ts +13 -7
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +5 -2
- package/dist/routing/interception-overlap.d.ts +35 -0
- package/dist/routing/interception-overlap.d.ts.map +1 -0
- package/dist/routing/interception.d.ts +234 -10
- package/dist/routing/interception.d.ts.map +1 -1
- package/dist/routing/link-codegen.d.ts +105 -0
- package/dist/routing/link-codegen.d.ts.map +1 -0
- package/dist/routing/manifest-codegen.d.ts +26 -0
- package/dist/routing/manifest-codegen.d.ts.map +1 -0
- package/dist/routing/scanner.d.ts +14 -10
- package/dist/routing/scanner.d.ts.map +1 -1
- package/dist/routing/schema-validation.d.ts +35 -0
- package/dist/routing/schema-validation.d.ts.map +1 -0
- package/dist/routing/segment-classify.d.ts +114 -0
- package/dist/routing/segment-classify.d.ts.map +1 -0
- package/dist/routing/segment-codegen.d.ts +38 -0
- package/dist/routing/segment-codegen.d.ts.map +1 -0
- package/dist/routing/segment-keys.d.ts +118 -0
- package/dist/routing/segment-keys.d.ts.map +1 -0
- package/dist/routing/slot-placement.d.ts +48 -0
- package/dist/routing/slot-placement.d.ts.map +1 -0
- package/dist/routing/types.d.ts +81 -26
- package/dist/routing/types.d.ts.map +1 -1
- package/dist/routing/walkers.d.ts +57 -0
- package/dist/routing/walkers.d.ts.map +1 -0
- package/dist/rsc-runtime/rsc.d.ts +1 -1
- package/dist/rsc-runtime/rsc.d.ts.map +1 -1
- package/dist/rsc-runtime/ssr.d.ts +14 -0
- package/dist/rsc-runtime/ssr.d.ts.map +1 -1
- package/dist/rsc-runtime/transforms.d.ts +13 -0
- package/dist/rsc-runtime/transforms.d.ts.map +1 -0
- package/dist/schema-bridge.d.ts +145 -0
- package/dist/schema-bridge.d.ts.map +1 -0
- package/dist/search-params/define.d.ts +262 -0
- package/dist/search-params/define.d.ts.map +1 -0
- package/dist/search-params/index.d.ts +3 -7
- package/dist/search-params/index.d.ts.map +1 -1
- package/dist/search-params/index.js +179 -360
- package/dist/search-params/index.js.map +1 -1
- package/dist/search-params/parse-total.d.ts +81 -0
- package/dist/search-params/parse-total.d.ts.map +1 -0
- package/dist/search-params/serialize-equal.d.ts +9 -0
- package/dist/search-params/serialize-equal.d.ts.map +1 -0
- package/dist/search-params/wrappers.d.ts +76 -0
- package/dist/search-params/wrappers.d.ts.map +1 -0
- package/dist/server/access-gate.d.ts +98 -10
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/action-client.d.ts +44 -9
- package/dist/server/action-client.d.ts.map +1 -1
- package/dist/server/action-encryption.d.ts +76 -0
- package/dist/server/action-encryption.d.ts.map +1 -0
- package/dist/server/action-handler.d.ts +40 -5
- package/dist/server/action-handler.d.ts.map +1 -1
- package/dist/server/actions.d.ts +78 -40
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +166 -16
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/body-limits.d.ts.map +1 -1
- package/dist/server/build-manifest.d.ts +25 -30
- package/dist/server/build-manifest.d.ts.map +1 -1
- package/dist/server/canonicalize.d.ts +10 -0
- package/dist/server/canonicalize.d.ts.map +1 -1
- package/dist/server/chain-url-parts.d.ts +82 -0
- package/dist/server/chain-url-parts.d.ts.map +1 -0
- package/dist/server/children-interception.d.ts +49 -0
- package/dist/server/children-interception.d.ts.map +1 -0
- package/dist/server/coalesce-tick.d.ts +40 -0
- package/dist/server/coalesce-tick.d.ts.map +1 -0
- package/dist/server/compress.d.ts.map +1 -1
- package/dist/server/cookie-context.d.ts +149 -0
- package/dist/server/cookie-context.d.ts.map +1 -0
- package/dist/server/cookie-parsing.d.ts +65 -0
- package/dist/server/cookie-parsing.d.ts.map +1 -0
- package/dist/server/csp-nonce.d.ts +36 -0
- package/dist/server/csp-nonce.d.ts.map +1 -0
- package/dist/server/csrf.d.ts +58 -15
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/debug.d.ts +0 -1
- package/dist/server/debug.d.ts.map +1 -1
- package/dist/server/default-logger.d.ts +23 -0
- package/dist/server/default-logger.d.ts.map +1 -0
- package/dist/server/default-status-page.d.ts +45 -0
- package/dist/server/default-status-page.d.ts.map +1 -0
- package/dist/server/deny-boundary.d.ts +257 -0
- package/dist/server/deny-boundary.d.ts.map +1 -0
- package/dist/server/deny-renderer.d.ts +21 -15
- package/dist/server/deny-renderer.d.ts.map +1 -1
- package/dist/server/early-hints-sender.d.ts.map +1 -1
- package/dist/server/early-hints.d.ts +14 -12
- package/dist/server/early-hints.d.ts.map +1 -1
- package/dist/server/error-boundary-wrapper.d.ts +102 -10
- package/dist/server/error-boundary-wrapper.d.ts.map +1 -1
- package/dist/server/error-response-headers.d.ts +3 -0
- package/dist/server/error-response-headers.d.ts.map +1 -0
- package/dist/server/fallback-error.d.ts +19 -7
- package/dist/server/fallback-error.d.ts.map +1 -1
- package/dist/server/flight-injection-state.d.ts +66 -0
- package/dist/server/flight-injection-state.d.ts.map +1 -0
- package/dist/server/flight-scripts.d.ts +45 -0
- package/dist/server/flight-scripts.d.ts.map +1 -0
- package/dist/server/form-data.d.ts +41 -0
- package/dist/server/form-data.d.ts.map +1 -1
- package/dist/server/form-flash.d.ts +2 -2
- package/dist/server/head-response.d.ts +35 -0
- package/dist/server/head-response.d.ts.map +1 -0
- package/dist/server/html-injector-core.d.ts +257 -0
- package/dist/server/html-injector-core.d.ts.map +1 -0
- package/dist/server/html-injectors.d.ts +84 -42
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/index.d.ts +17 -54
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +195 -2922
- package/dist/server/index.js.map +1 -1
- package/dist/server/instrumentation.d.ts +11 -4
- package/dist/server/instrumentation.d.ts.map +1 -1
- package/dist/server/internal.d.ts +47 -0
- package/dist/server/internal.d.ts.map +1 -0
- package/dist/server/internal.js +4645 -0
- package/dist/server/internal.js.map +1 -0
- package/dist/server/json-status-response.d.ts +34 -0
- package/dist/server/json-status-response.d.ts.map +1 -0
- package/dist/server/logger.d.ts +78 -7
- package/dist/server/logger.d.ts.map +1 -1
- package/dist/server/metadata-collector.d.ts +73 -0
- package/dist/server/metadata-collector.d.ts.map +1 -0
- package/dist/server/metadata-platform.d.ts +2 -2
- package/dist/server/metadata-render.d.ts +2 -2
- package/dist/server/metadata-render.d.ts.map +1 -1
- package/dist/server/metadata-routes.d.ts +71 -11
- package/dist/server/metadata-routes.d.ts.map +1 -1
- package/dist/server/metadata-social.d.ts +2 -2
- package/dist/server/metadata.d.ts +10 -2
- package/dist/server/metadata.d.ts.map +1 -1
- package/dist/server/middleware-runner.d.ts +20 -5
- package/dist/server/middleware-runner.d.ts.map +1 -1
- package/dist/server/node-stream-transforms.d.ts +105 -0
- package/dist/server/node-stream-transforms.d.ts.map +1 -0
- package/dist/server/nuqs-ssr-provider.d.ts +7 -3
- package/dist/server/nuqs-ssr-provider.d.ts.map +1 -1
- package/dist/server/param-coercion.d.ts +83 -0
- package/dist/server/param-coercion.d.ts.map +1 -0
- package/dist/server/pipeline-helpers.d.ts +193 -0
- package/dist/server/pipeline-helpers.d.ts.map +1 -0
- package/dist/server/pipeline-interception.d.ts +70 -9
- package/dist/server/pipeline-interception.d.ts.map +1 -1
- package/dist/server/pipeline-metadata.d.ts +7 -1
- package/dist/server/pipeline-metadata.d.ts.map +1 -1
- package/dist/server/pipeline-outcome.d.ts +59 -0
- package/dist/server/pipeline-outcome.d.ts.map +1 -0
- package/dist/server/pipeline-phases.d.ts +70 -0
- package/dist/server/pipeline-phases.d.ts.map +1 -0
- package/dist/server/pipeline.d.ts +147 -23
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/port-resolution.d.ts +31 -0
- package/dist/server/port-resolution.d.ts.map +1 -0
- package/dist/server/prebuilt/cache-key.d.ts +63 -0
- package/dist/server/prebuilt/cache-key.d.ts.map +1 -0
- package/dist/server/prebuilt/capture-render.d.ts +25 -0
- package/dist/server/prebuilt/capture-render.d.ts.map +1 -0
- package/dist/server/prebuilt/capture-routes.d.ts +37 -0
- package/dist/server/prebuilt/capture-routes.d.ts.map +1 -0
- package/dist/server/prebuilt/capture-state.d.ts +101 -0
- package/dist/server/prebuilt/capture-state.d.ts.map +1 -0
- package/dist/server/prebuilt/key-discipline.d.ts +52 -0
- package/dist/server/prebuilt/key-discipline.d.ts.map +1 -0
- package/dist/server/prebuilt/lifetime.d.ts +38 -0
- package/dist/server/prebuilt/lifetime.d.ts.map +1 -0
- package/dist/server/prebuilt/manifest-tag-index.d.ts +27 -0
- package/dist/server/prebuilt/manifest-tag-index.d.ts.map +1 -0
- package/dist/server/prebuilt/overlay.d.ts +100 -0
- package/dist/server/prebuilt/overlay.d.ts.map +1 -0
- package/dist/server/prebuilt/payload-source.d.ts +79 -0
- package/dist/server/prebuilt/payload-source.d.ts.map +1 -0
- package/dist/server/prebuilt/slots.d.ts +106 -0
- package/dist/server/prebuilt/slots.d.ts.map +1 -0
- package/dist/server/prebuilt/synthetic-store.d.ts +67 -0
- package/dist/server/prebuilt/synthetic-store.d.ts.map +1 -0
- package/dist/server/prebuilt-builder.d.ts +121 -0
- package/dist/server/prebuilt-builder.d.ts.map +1 -0
- package/dist/server/prebuilt-runtime.d.ts +111 -0
- package/dist/server/prebuilt-runtime.d.ts.map +1 -0
- package/dist/server/primitives.d.ts +101 -90
- package/dist/server/primitives.d.ts.map +1 -1
- package/dist/server/publish-params.d.ts +33 -0
- package/dist/server/publish-params.d.ts.map +1 -0
- package/dist/server/react-cache-bridge.d.ts +59 -0
- package/dist/server/react-cache-bridge.d.ts.map +1 -0
- package/dist/server/react-cache-scope.d.ts +49 -0
- package/dist/server/react-cache-scope.d.ts.map +1 -0
- package/dist/server/render-timeout.d.ts +66 -0
- package/dist/server/render-timeout.d.ts.map +1 -0
- package/dist/server/render-utils.d.ts +35 -0
- package/dist/server/render-utils.d.ts.map +1 -0
- package/dist/server/request-context.d.ts +128 -103
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-dep.d.ts +15 -0
- package/dist/server/request-dep.d.ts.map +1 -0
- package/dist/server/response-cache-policy.d.ts +3 -0
- package/dist/server/response-cache-policy.d.ts.map +1 -0
- package/dist/server/route-element-builder.d.ts +57 -30
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/route-element-helpers.d.ts +12 -0
- package/dist/server/route-element-helpers.d.ts.map +1 -0
- package/dist/server/route-handler.d.ts +1 -1
- package/dist/server/route-handler.d.ts.map +1 -1
- package/dist/server/route-matcher.d.ts +55 -38
- package/dist/server/route-matcher.d.ts.map +1 -1
- package/dist/server/route-module-loader.d.ts +37 -0
- package/dist/server/route-module-loader.d.ts.map +1 -0
- package/dist/server/rsc-cache-key-guard.d.ts +78 -0
- package/dist/server/rsc-cache-key-guard.d.ts.map +1 -0
- package/dist/server/rsc-entry/action-dispatcher.d.ts +67 -0
- package/dist/server/rsc-entry/action-dispatcher.d.ts.map +1 -0
- package/dist/server/rsc-entry/action-middleware-runner.d.ts +66 -0
- package/dist/server/rsc-entry/action-middleware-runner.d.ts.map +1 -0
- package/dist/server/rsc-entry/api-handler.d.ts +19 -3
- package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
- package/dist/server/rsc-entry/deny-fallback.d.ts +55 -0
- package/dist/server/rsc-entry/deny-fallback.d.ts.map +1 -0
- package/dist/server/rsc-entry/error-renderer.d.ts +35 -21
- package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/helpers.d.ts +14 -59
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts +30 -6
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts +50 -0
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -0
- package/dist/server/rsc-entry/render-signals.d.ts +65 -0
- package/dist/server/rsc-entry/render-signals.d.ts.map +1 -0
- package/dist/server/rsc-entry/revalidate-renderer.d.ts +98 -0
- package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -0
- package/dist/server/rsc-entry/rsc-payload.d.ts +30 -6
- package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts +12 -30
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-bridge.d.ts +6 -2
- package/dist/server/rsc-entry/ssr-bridge.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +44 -7
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/rsc-error-envelope.d.ts +11 -0
- package/dist/server/rsc-error-envelope.d.ts.map +1 -0
- package/dist/server/safe-load.d.ts +39 -0
- package/dist/server/safe-load.d.ts.map +1 -0
- package/dist/server/sensitive-fields.d.ts +74 -0
- package/dist/server/sensitive-fields.d.ts.map +1 -0
- package/dist/server/signal-identity.d.ts +43 -0
- package/dist/server/signal-identity.d.ts.map +1 -0
- package/dist/server/sitemap-generator.d.ts +130 -0
- package/dist/server/sitemap-generator.d.ts.map +1 -0
- package/dist/server/sitemap-handler.d.ts +22 -0
- package/dist/server/sitemap-handler.d.ts.map +1 -0
- package/dist/server/skippable-prefix.d.ts +29 -0
- package/dist/server/skippable-prefix.d.ts.map +1 -0
- package/dist/server/slot-interception.d.ts +80 -0
- package/dist/server/slot-interception.d.ts.map +1 -0
- package/dist/server/slot-resolver.d.ts +138 -7
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/slot-subtree-contain.d.ts +54 -0
- package/dist/server/slot-subtree-contain.d.ts.map +1 -0
- package/dist/server/ssr-bridge-types.d.ts +198 -0
- package/dist/server/ssr-bridge-types.d.ts.map +1 -0
- package/dist/server/ssr-entry.d.ts +8 -47
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-render.d.ts +60 -27
- package/dist/server/ssr-render.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts +93 -0
- package/dist/server/ssr-wrappers.d.ts.map +1 -0
- package/dist/server/state-tree-diff.d.ts +44 -9
- package/dist/server/state-tree-diff.d.ts.map +1 -1
- package/dist/server/static-generator.d.ts +112 -0
- package/dist/server/static-generator.d.ts.map +1 -0
- package/dist/server/static-not-found.d.ts +52 -0
- package/dist/server/static-not-found.d.ts.map +1 -0
- package/dist/server/status-code-resolver.d.ts +26 -15
- package/dist/server/status-code-resolver.d.ts.map +1 -1
- package/dist/server/stream-utils.d.ts +59 -0
- package/dist/server/stream-utils.d.ts.map +1 -0
- package/dist/server/tracing.d.ts +57 -26
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/server/tree-match.d.ts +59 -0
- package/dist/server/tree-match.d.ts.map +1 -0
- package/dist/server/types.d.ts +89 -8
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/utils/element-type.d.ts +50 -0
- package/dist/server/utils/element-type.d.ts.map +1 -0
- package/dist/server/utils/escape-html.d.ts +14 -0
- package/dist/server/utils/escape-html.d.ts.map +1 -0
- package/dist/server/version-skew.d.ts +61 -0
- package/dist/server/version-skew.d.ts.map +1 -0
- package/dist/server/workers-cache-bridge.d.ts +26 -0
- package/dist/server/workers-cache-bridge.d.ts.map +1 -0
- package/dist/shared/als-slots.d.ts +42 -0
- package/dist/shared/als-slots.d.ts.map +1 -0
- package/dist/shared/base-path.d.ts +56 -0
- package/dist/shared/base-path.d.ts.map +1 -0
- package/dist/shared/csrf-reject.d.ts +16 -0
- package/dist/shared/csrf-reject.d.ts.map +1 -0
- package/dist/shared/error-digest.d.ts +28 -0
- package/dist/shared/error-digest.d.ts.map +1 -0
- package/dist/shared/href-validation.d.ts +49 -0
- package/dist/shared/href-validation.d.ts.map +1 -0
- package/dist/shared/merge-search-params.d.ts +22 -0
- package/dist/shared/merge-search-params.d.ts.map +1 -0
- package/dist/shared/param-value.d.ts +104 -0
- package/dist/shared/param-value.d.ts.map +1 -0
- package/dist/shared/payload-root.d.ts +110 -0
- package/dist/shared/payload-root.d.ts.map +1 -0
- package/dist/shared/redirect-type.d.ts +17 -0
- package/dist/shared/redirect-type.d.ts.map +1 -0
- package/dist/shared/rsc-cache-key.d.ts +163 -0
- package/dist/shared/rsc-cache-key.d.ts.map +1 -0
- package/dist/shared/rsc-error-envelope.d.ts +16 -0
- package/dist/shared/rsc-error-envelope.d.ts.map +1 -0
- package/dist/shared/rsc-manifest.d.ts +28 -0
- package/dist/shared/rsc-manifest.d.ts.map +1 -0
- package/dist/shared/rsc-media-type.d.ts +52 -0
- package/dist/shared/rsc-media-type.d.ts.map +1 -0
- package/dist/shared/rsc-payload-path.d.ts +48 -0
- package/dist/shared/rsc-payload-path.d.ts.map +1 -0
- package/dist/shared/segment-info.d.ts +66 -0
- package/dist/shared/segment-info.d.ts.map +1 -0
- package/dist/shared/slot-params.d.ts +52 -0
- package/dist/shared/slot-params.d.ts.map +1 -0
- package/dist/shared/static-platform-files.d.ts +71 -0
- package/dist/shared/static-platform-files.d.ts.map +1 -0
- package/dist/shared/status-reason-phrase.d.ts +26 -0
- package/dist/shared/status-reason-phrase.d.ts.map +1 -0
- package/dist/shims/font-google.d.ts +1 -1
- package/dist/shims/font-google.d.ts.map +1 -1
- package/dist/shims/font-google.js +42 -0
- package/dist/shims/font-google.js.map +1 -0
- package/dist/shims/font-local.d.ts +26 -0
- package/dist/shims/font-local.d.ts.map +1 -0
- package/dist/shims/font-local.js +20 -0
- package/dist/shims/font-local.js.map +1 -0
- package/dist/shims/headers.d.ts +53 -1
- package/dist/shims/headers.d.ts.map +1 -1
- package/dist/shims/image.d.ts +120 -120
- package/dist/shims/image.d.ts.map +1 -1
- package/dist/shims/navigation-client.d.ts +25 -12
- package/dist/shims/navigation-client.d.ts.map +1 -1
- package/dist/shims/navigation-rsc.d.ts +21 -0
- package/dist/shims/navigation-rsc.d.ts.map +1 -0
- package/dist/shims/navigation.d.ts +10 -5
- package/dist/shims/navigation.d.ts.map +1 -1
- package/dist/utils/state-machine.d.ts +80 -0
- package/dist/utils/state-machine.d.ts.map +1 -0
- package/dist/utils/write-file-atomic.d.ts +17 -0
- package/dist/utils/write-file-atomic.d.ts.map +1 -0
- package/docs/api/30-api-server.mdx +239 -0
- package/docs/api/31-api-client.mdx +170 -0
- package/docs/api/32-api-cache.mdx +339 -0
- package/docs/api/33-api-search-params.mdx +176 -0
- package/docs/api/34-api-config.mdx +359 -0
- package/docs/api/35-api-typescript.mdx +91 -0
- package/docs/api/36-cli.mdx +202 -0
- package/docs/learn/00-introduction.mdx +109 -0
- package/docs/learn/01-quick-start.mdx +94 -0
- package/docs/learn/02-pages-and-layouts.mdx +147 -0
- package/docs/learn/03-fetching-data.mdx +227 -0
- package/docs/learn/04-access-control.mdx +115 -0
- package/docs/learn/05-the-flush-point.mdx +175 -0
- package/docs/learn/06-typed-params.mdx +275 -0
- package/docs/learn/07-typed-routes.mdx +108 -0
- package/docs/learn/08-forms-and-actions.mdx +146 -0
- package/docs/learn/09-streaming.mdx +140 -0
- package/docs/learn/10-caching.mdx +270 -0
- package/docs/learn/11-middleware.mdx +164 -0
- package/docs/learn/12-error-handling.mdx +192 -0
- package/docs/learn/13-deploying.mdx +287 -0
- package/llms.txt +55 -0
- package/package.json +120 -29
- package/src/adapters/build-output-helper.ts +353 -0
- package/src/adapters/canonicalize-module.ts +29 -0
- package/src/adapters/cloudflare-dev.ts +183 -0
- package/src/adapters/cloudflare-kv-cache.ts +207 -0
- package/src/adapters/cloudflare.ts +809 -150
- package/src/adapters/compress-module.ts +110 -86
- package/src/adapters/fs-identity.ts +155 -0
- package/src/adapters/nitro-presets.ts +124 -0
- package/src/adapters/nitro-preview.ts +476 -0
- package/src/adapters/nitro.ts +317 -457
- package/src/adapters/raw-imports.d.ts +5 -0
- package/src/adapters/shared.ts +283 -0
- package/src/adapters/types.ts +127 -17
- package/src/adapters/wrangler.d.ts +7 -0
- package/src/analyze/chains.ts +411 -0
- package/src/analyze/classify.ts +259 -0
- package/src/analyze/crawl-entry.ts +68 -0
- package/src/analyze/crawl.ts +500 -0
- package/src/analyze/graph-cache.ts +331 -0
- package/src/analyze/graph-command.ts +762 -0
- package/src/analyze/live-graph.ts +232 -0
- package/src/analyze/poison-rules.ts +165 -0
- package/src/analyze/poison-scan.ts +162 -0
- package/src/analyze/scan.ts +149 -0
- package/src/cache/cache-api.ts +107 -0
- package/src/cache/fast-hash.ts +5 -0
- package/src/cache/handler-store.ts +76 -0
- package/src/cache/index.ts +115 -22
- package/src/cache/invalidation-epoch.ts +93 -0
- package/src/cache/json-lossy-check.ts +69 -0
- package/src/cache/redis-handler.ts +198 -20
- package/src/cache/singleflight.ts +72 -6
- package/src/cache/sizeof.ts +35 -0
- package/src/cache/stable-stringify.ts +65 -2
- package/src/cache/store.ts +71 -0
- package/src/cache/stores/cloudflare-kv.ts +52 -0
- package/src/cache/stores/memory.ts +125 -0
- package/src/cache/stores/redis.ts +97 -0
- package/src/cache/stores/vercel.ts +59 -0
- package/src/cache/tag-aware-handler.ts +254 -0
- package/src/cache/timber-cache.ts +165 -40
- package/src/cdn/cloudflare-purge.ts +50 -0
- package/src/cdn/fastly-purge.ts +63 -0
- package/src/cdn/headers.ts +153 -0
- package/src/cdn/index.ts +23 -0
- package/src/cdn/purge-store.ts +34 -0
- package/src/cdn/workers-cache-purge.ts +34 -0
- package/src/cli-check.ts +417 -0
- package/src/cli-context.ts +119 -0
- package/src/cli-schema-sync.ts +401 -0
- package/src/cli.ts +330 -78
- package/src/client/browser-dev.ts +192 -5
- package/src/client/browser-entry/action-dispatch.ts +237 -0
- package/src/client/browser-entry/action-queue.ts +152 -0
- package/src/client/browser-entry/hmr.ts +70 -0
- package/src/client/browser-entry/hydrate.ts +143 -0
- package/src/client/browser-entry/index.ts +120 -0
- package/src/client/browser-entry/post-hydration.ts +99 -0
- package/src/client/browser-entry/router-init.ts +406 -0
- package/src/client/browser-entry/rsc-stream.ts +145 -0
- package/src/client/browser-entry/scroll.ts +50 -0
- package/src/client/deny-last-resort.tsx +54 -0
- package/src/client/error-boundary.tsx +279 -61
- package/src/client/error-reconstituter.tsx +84 -0
- package/src/client/form.tsx +36 -32
- package/src/client/global-context.ts +31 -0
- package/src/client/history.ts +74 -11
- package/src/client/index.ts +89 -53
- package/src/client/internal.ts +54 -0
- package/src/client/link.tsx +468 -151
- package/src/client/location-search.ts +15 -0
- package/src/client/navigation-api.ts +380 -0
- package/src/client/navigation-commit.ts +318 -0
- package/src/client/navigation-context.ts +67 -134
- package/src/client/navigation-root.tsx +236 -0
- package/src/client/navigation-transition.ts +337 -0
- package/src/client/nuqs-adapter.tsx +21 -9
- package/src/client/params-context.ts +187 -0
- package/src/client/react-root.ts +82 -0
- package/src/client/router-effects.ts +235 -0
- package/src/client/router-lifecycle.ts +354 -0
- package/src/client/router-pipeline.ts +458 -0
- package/src/client/router-ref.ts +3 -3
- package/src/client/router-skew.ts +30 -0
- package/src/client/router-types.ts +370 -0
- package/src/client/router-url.ts +32 -0
- package/src/client/router.ts +491 -424
- package/src/client/rsc-fetch.ts +510 -109
- package/src/client/segment-cache.ts +362 -41
- package/src/client/segment-context.ts +7 -4
- package/src/client/segment-outlet.tsx +96 -0
- package/src/client/segment-update-context.ts +23 -0
- package/src/client/shallow-url.ts +22 -0
- package/src/client/slot-content-cache-context.ts +43 -0
- package/src/client/slot-context.ts +50 -0
- package/src/client/slot-outlet.tsx +22 -0
- package/src/client/slot-provider.tsx +32 -0
- package/src/client/ssr-data.ts +27 -67
- package/src/client/stale-client.ts +191 -0
- package/src/client/state.ts +31 -24
- package/src/client/status-page-marker.tsx +32 -0
- package/src/client/top-loader.tsx +13 -10
- package/src/client/unload-guard.ts +35 -3
- package/src/client/use-cookie.ts +70 -18
- package/src/client/use-link-status.ts +7 -7
- package/src/client/use-pathname.ts +22 -31
- package/src/client/use-pending-navigation.ts +40 -0
- package/src/client/use-query-states.ts +206 -36
- package/src/client/use-router.ts +31 -9
- package/src/client/use-search-params.ts +38 -49
- package/src/client/use-segment-params.ts +69 -0
- package/src/client/use-selected-layout-segment.ts +2 -2
- package/src/codec.ts +149 -0
- package/src/config-types.ts +323 -0
- package/src/config-validation.ts +464 -0
- package/src/cookies/define-cookie.ts +222 -53
- package/src/cookies/index.ts +13 -2
- package/src/cookies/json-cookie.ts +105 -0
- package/src/cookies/validation.ts +192 -0
- package/src/dev-tools/404-page.ts +286 -0
- package/src/dev-tools/browser-logs.ts +55 -0
- package/src/dev-tools/dev-page-shell.ts +278 -0
- package/src/dev-tools/error-page.ts +331 -0
- package/src/dev-tools/holding-server.ts +185 -0
- package/src/dev-tools/hydration-overlay.ts +158 -0
- package/src/dev-tools/index.ts +79 -0
- package/src/dev-tools/instrumentation.ts +261 -0
- package/src/{server/dev-logger.ts → dev-tools/logger.ts} +33 -51
- package/src/{plugins/dev-logs.ts → dev-tools/logs.ts} +122 -26
- package/src/{plugins/dev-error-overlay.ts → dev-tools/overlay.ts} +25 -80
- package/src/dev-tools/stack-classifier.ts +75 -0
- package/src/dev-tools/terminal.ts +182 -0
- package/src/fonts/ast-walk.ts +235 -0
- package/src/fonts/ast.ts +479 -128
- package/src/fonts/bundle.ts +138 -0
- package/src/fonts/css.ts +1 -1
- package/src/fonts/dev-middleware.ts +85 -0
- package/src/fonts/fallbacks.ts +0 -23
- package/src/fonts/google.ts +101 -19
- package/src/fonts/local.ts +12 -11
- package/src/fonts/paths.ts +58 -0
- package/src/fonts/pipeline.ts +348 -0
- package/src/fonts/transform.ts +311 -0
- package/src/fonts/types.ts +52 -1
- package/src/fonts/virtual-modules.ts +179 -0
- package/src/index.ts +494 -380
- package/src/params/codec-registry.ts +34 -0
- package/src/params/define-schema.ts +115 -0
- package/src/params/index.ts +17 -0
- package/src/params/resolve-schema.ts +84 -0
- package/src/plugin-context.ts +502 -0
- package/src/plugins/build-manifest.ts +204 -36
- package/src/plugins/build-report.ts +299 -87
- package/src/plugins/cache.ts +243 -0
- package/src/plugins/callsite-ast.ts +472 -0
- package/src/plugins/callsite-jsx.ts +243 -0
- package/src/plugins/chunks.ts +74 -5
- package/src/plugins/client-chunks.ts +185 -0
- package/src/plugins/cloudflare-wasm.ts +141 -0
- package/src/plugins/content.ts +5 -1
- package/src/plugins/dev-discovery.ts +218 -0
- package/src/plugins/dev-server.ts +360 -97
- package/src/plugins/entries.ts +142 -16
- package/src/plugins/fonts.ts +260 -657
- package/src/plugins/graph-endpoint.ts +532 -0
- package/src/plugins/mdx.ts +108 -35
- package/src/plugins/post-build.ts +327 -0
- package/src/plugins/prebuilt-capture.ts +213 -0
- package/src/plugins/prebuilt-options-analysis.ts +175 -0
- package/src/plugins/prebuilt.ts +670 -0
- package/src/plugins/prerender-sugar.ts +316 -0
- package/src/plugins/react-resolve.ts +149 -0
- package/src/plugins/request-dep/analysis.ts +447 -0
- package/src/plugins/request-dep/index.ts +376 -0
- package/src/plugins/request-dep/origin.ts +310 -0
- package/src/plugins/routing.ts +273 -277
- package/src/plugins/rsc-assets-manifest.ts +251 -0
- package/src/plugins/server-bundle.ts +99 -14
- package/src/plugins/shims.ts +260 -97
- package/src/plugins/static-build.ts +681 -71
- package/src/react-canary.d.ts +2 -0
- package/src/routing/codegen-shared.ts +39 -0
- package/src/routing/codegen-types.ts +62 -0
- package/src/routing/codegen-write.ts +163 -0
- package/src/routing/codegen.ts +349 -232
- package/src/routing/collision-probe.ts +438 -0
- package/src/routing/collision-spaces.ts +281 -0
- package/src/routing/convention-lint.ts +651 -0
- package/src/routing/export-detect.ts +536 -0
- package/src/routing/file-cache.ts +23 -0
- package/src/routing/index.ts +16 -7
- package/src/routing/interception-overlap.ts +141 -0
- package/src/routing/interception.ts +1044 -67
- package/src/routing/link-codegen.ts +280 -0
- package/src/routing/manifest-codegen.ts +232 -0
- package/src/routing/scanner.ts +417 -223
- package/src/routing/schema-validation.ts +155 -0
- package/src/routing/segment-classify.ts +280 -0
- package/src/routing/segment-codegen.ts +99 -0
- package/src/routing/segment-keys.ts +186 -0
- package/src/routing/slot-placement.ts +97 -0
- package/src/routing/types.ts +82 -26
- package/src/routing/walkers.ts +98 -0
- package/src/rsc-runtime/rsc.ts +9 -0
- package/src/rsc-runtime/ssr.ts +51 -0
- package/src/rsc-runtime/transforms.ts +13 -0
- package/src/rsc-runtime/vendor-types.d.ts +27 -0
- package/src/schema-bridge.ts +382 -0
- package/src/search-params/define.ts +677 -0
- package/src/search-params/index.ts +14 -20
- package/src/search-params/parse-total.ts +91 -0
- package/src/search-params/serialize-equal.ts +14 -0
- package/src/search-params/wrappers.ts +150 -0
- package/src/server/access-gate.tsx +195 -56
- package/src/server/action-client.ts +126 -33
- package/src/server/action-encryption.ts +144 -0
- package/src/server/action-handler.ts +457 -111
- package/src/server/actions.ts +172 -85
- package/src/server/als-registry.ts +224 -25
- package/src/server/body-limits.ts +10 -2
- package/src/server/build-manifest.ts +33 -57
- package/src/server/canonicalize.ts +6 -3
- package/src/server/chain-url-parts.ts +163 -0
- package/src/server/children-interception.ts +116 -0
- package/src/server/coalesce-tick.ts +75 -0
- package/src/server/compress.ts +43 -8
- package/src/server/cookie-context.ts +454 -0
- package/src/server/cookie-parsing.ts +163 -0
- package/src/server/csp-nonce.ts +58 -0
- package/src/server/csrf.ts +228 -35
- package/src/server/debug.ts +0 -1
- package/src/server/default-logger.ts +100 -0
- package/src/server/default-status-page.ts +88 -0
- package/src/server/deny-boundary.ts +527 -0
- package/src/server/deny-renderer.ts +201 -179
- package/src/server/early-hints-sender.ts +4 -3
- package/src/server/early-hints.ts +39 -29
- package/src/server/error-boundary-wrapper.ts +160 -44
- package/src/server/error-response-headers.ts +18 -0
- package/src/server/fallback-error.ts +88 -104
- package/src/server/flight-injection-state.ts +113 -0
- package/src/server/flight-scripts.ts +67 -0
- package/src/server/form-data.ts +124 -12
- package/src/server/form-flash.ts +3 -3
- package/src/server/head-response.ts +54 -0
- package/src/server/html-injector-core.ts +512 -0
- package/src/server/html-injectors.ts +270 -255
- package/src/server/index.ts +36 -192
- package/src/server/instrumentation.ts +11 -4
- package/src/server/internal.ts +168 -0
- package/src/server/json-status-response.ts +105 -0
- package/src/server/logger.ts +126 -38
- package/src/server/metadata-collector.ts +177 -0
- package/src/server/metadata-platform.ts +2 -2
- package/src/server/metadata-render.ts +30 -8
- package/src/server/metadata-routes.ts +220 -24
- package/src/server/metadata-social.ts +2 -2
- package/src/server/metadata.ts +23 -2
- package/src/server/middleware-runner.ts +32 -5
- package/src/server/node-stream-transforms.ts +323 -0
- package/src/server/nuqs-ssr-provider.tsx +8 -7
- package/src/server/param-coercion.ts +201 -0
- package/src/server/pipeline-helpers.ts +485 -0
- package/src/server/pipeline-interception.ts +241 -32
- package/src/server/pipeline-metadata.ts +15 -1
- package/src/server/pipeline-outcome.ts +290 -0
- package/src/server/pipeline-phases.ts +496 -0
- package/src/server/pipeline.ts +385 -427
- package/src/server/port-resolution.ts +53 -0
- package/src/server/prebuilt/cache-key.ts +299 -0
- package/src/server/prebuilt/capture-render.ts +118 -0
- package/src/server/prebuilt/capture-routes.ts +104 -0
- package/src/server/prebuilt/capture-state.ts +196 -0
- package/src/server/prebuilt/key-discipline.ts +122 -0
- package/src/server/prebuilt/lifetime.ts +151 -0
- package/src/server/prebuilt/manifest-tag-index.ts +46 -0
- package/src/server/prebuilt/overlay.ts +256 -0
- package/src/server/prebuilt/payload-source.ts +202 -0
- package/src/server/prebuilt/slots.ts +202 -0
- package/src/server/prebuilt/synthetic-store.ts +125 -0
- package/src/server/prebuilt-builder.ts +514 -0
- package/src/server/prebuilt-runtime.ts +813 -0
- package/src/server/primitives.ts +153 -171
- package/src/server/publish-params.ts +42 -0
- package/src/server/react-cache-bridge.ts +124 -0
- package/src/server/react-cache-scope.ts +104 -0
- package/src/server/render-timeout.ts +128 -0
- package/src/server/render-utils.ts +45 -0
- package/src/server/request-context.ts +269 -332
- package/src/server/request-dep.ts +37 -0
- package/src/server/response-cache-policy.ts +45 -0
- package/src/server/route-element-builder.ts +514 -355
- package/src/server/route-element-helpers.ts +37 -0
- package/src/server/route-handler.ts +67 -27
- package/src/server/route-matcher.ts +238 -267
- package/src/server/route-module-loader.ts +161 -0
- package/src/server/rsc-cache-key-guard.ts +122 -0
- package/src/server/rsc-entry/action-dispatcher.ts +142 -0
- package/src/server/rsc-entry/action-middleware-runner.ts +130 -0
- package/src/server/rsc-entry/api-handler.ts +49 -81
- package/src/server/rsc-entry/deny-fallback.ts +151 -0
- package/src/server/rsc-entry/error-renderer.ts +301 -113
- package/src/server/rsc-entry/helpers.ts +90 -115
- package/src/server/rsc-entry/index.ts +370 -350
- package/src/server/rsc-entry/render-route.ts +229 -0
- package/src/server/rsc-entry/render-signals.ts +108 -0
- package/src/server/rsc-entry/revalidate-renderer.ts +349 -0
- package/src/server/rsc-entry/rsc-payload.ts +192 -72
- package/src/server/rsc-entry/rsc-stream.ts +128 -131
- package/src/server/rsc-entry/ssr-bridge.ts +19 -6
- package/src/server/rsc-entry/ssr-renderer.ts +300 -137
- package/src/server/rsc-error-envelope.ts +18 -0
- package/src/server/rsc-prop-warnings.ts +1 -1
- package/src/server/safe-load.ts +53 -0
- package/src/server/sensitive-fields.ts +230 -0
- package/src/server/server-only-guard-noop.js +3 -0
- package/src/server/server-timing.ts +1 -1
- package/src/server/signal-identity.ts +112 -0
- package/src/server/sitemap-generator.ts +337 -0
- package/src/server/sitemap-handler.ts +157 -0
- package/src/server/skippable-prefix.ts +172 -0
- package/src/server/slot-interception.ts +168 -0
- package/src/server/slot-resolver.ts +707 -300
- package/src/server/slot-subtree-contain.ts +273 -0
- package/src/server/ssr-bridge-types.ts +201 -0
- package/src/server/ssr-entry.ts +225 -104
- package/src/server/ssr-render.ts +354 -91
- package/src/server/ssr-wrappers.tsx +162 -0
- package/src/server/state-tree-diff.ts +85 -30
- package/src/server/static-generator.ts +680 -0
- package/src/server/static-not-found.ts +134 -0
- package/src/server/status-code-resolver.ts +107 -148
- package/src/server/stream-utils.ts +343 -0
- package/src/server/tracing.ts +163 -68
- package/src/server/tree-match.ts +494 -0
- package/src/server/types.ts +96 -11
- package/src/server/utils/element-type.ts +88 -0
- package/src/server/utils/escape-html.ts +20 -0
- package/src/server/version-skew.ts +104 -0
- package/src/server/waituntil-bridge.ts +1 -1
- package/src/server/workers-cache-bridge.ts +33 -0
- package/src/shared/als-slots.ts +74 -0
- package/src/shared/base-path.ts +80 -0
- package/src/shared/csrf-reject.ts +15 -0
- package/src/shared/error-digest.ts +46 -0
- package/src/shared/href-validation.ts +159 -0
- package/src/shared/merge-search-params.ts +55 -0
- package/src/shared/param-value.ts +281 -0
- package/src/shared/payload-root.ts +153 -0
- package/src/shared/redirect-type.ts +17 -0
- package/src/shared/rsc-cache-key.ts +269 -0
- package/src/shared/rsc-error-envelope.ts +16 -0
- package/src/shared/rsc-manifest.ts +29 -0
- package/src/shared/rsc-media-type.ts +59 -0
- package/src/shared/rsc-payload-path.ts +52 -0
- package/src/shared/segment-info.ts +67 -0
- package/src/shared/slot-params.ts +109 -0
- package/src/shared/static-platform-files.ts +75 -0
- package/src/shared/status-reason-phrase.ts +61 -0
- package/src/shims/font-google.ts +1 -1
- package/src/shims/font-local.ts +34 -0
- package/src/shims/headers.ts +122 -1
- package/src/shims/navigation-client.ts +36 -32
- package/src/shims/navigation-rsc.ts +47 -0
- package/src/shims/navigation.ts +10 -7
- package/src/utils/state-machine.ts +111 -0
- package/src/utils/write-file-atomic.ts +32 -0
- package/dist/_chunks/als-registry-B7DbZ2hS.js +0 -41
- package/dist/_chunks/als-registry-B7DbZ2hS.js.map +0 -1
- package/dist/_chunks/debug-B3Gypr3D.js +0 -108
- package/dist/_chunks/debug-B3Gypr3D.js.map +0 -1
- package/dist/_chunks/format-RyoGQL74.js +0 -164
- package/dist/_chunks/format-RyoGQL74.js.map +0 -1
- package/dist/_chunks/interception-BOoWmLUA.js +0 -676
- package/dist/_chunks/interception-BOoWmLUA.js.map +0 -1
- package/dist/_chunks/metadata-routes-Cjmvi3rQ.js.map +0 -1
- package/dist/_chunks/request-context-BQUC8PHn.js +0 -330
- package/dist/_chunks/request-context-BQUC8PHn.js.map +0 -1
- package/dist/_chunks/ssr-data-MjmprTmO.js +0 -88
- package/dist/_chunks/ssr-data-MjmprTmO.js.map +0 -1
- package/dist/_chunks/tracing-CemImE6h.js +0 -187
- package/dist/_chunks/tracing-CemImE6h.js.map +0 -1
- package/dist/_chunks/use-cookie-DX-l1_5E.js +0 -91
- package/dist/_chunks/use-cookie-DX-l1_5E.js.map +0 -1
- package/dist/_chunks/use-query-states-D5KaffOK.js +0 -109
- package/dist/_chunks/use-query-states-D5KaffOK.js.map +0 -1
- package/dist/adapters/cloudflare.js.map +0 -1
- package/dist/cache/index.js.map +0 -1
- package/dist/cache/register-cached-function.d.ts +0 -17
- package/dist/cache/register-cached-function.d.ts.map +0 -1
- package/dist/client/browser-entry.d.ts +0 -21
- package/dist/client/browser-entry.d.ts.map +0 -1
- package/dist/client/error-boundary.js.map +0 -1
- package/dist/client/head.d.ts +0 -16
- package/dist/client/head.d.ts.map +0 -1
- package/dist/client/link-status-provider.d.ts +0 -11
- package/dist/client/link-status-provider.d.ts.map +0 -1
- package/dist/client/segment-merger.d.ts +0 -119
- package/dist/client/segment-merger.d.ts.map +0 -1
- package/dist/client/stale-reload.d.ts +0 -44
- package/dist/client/stale-reload.d.ts.map +0 -1
- package/dist/client/transition-root.d.ts +0 -74
- package/dist/client/transition-root.d.ts.map +0 -1
- package/dist/client/types.d.ts +0 -14
- package/dist/client/types.d.ts.map +0 -1
- package/dist/client/use-navigation-pending.d.ts +0 -26
- package/dist/client/use-navigation-pending.d.ts.map +0 -1
- package/dist/client/use-params.d.ts +0 -92
- package/dist/client/use-params.d.ts.map +0 -1
- package/dist/content/index.d.ts +0 -11
- package/dist/content/index.d.ts.map +0 -1
- package/dist/content/index.js +0 -2
- package/dist/plugins/adapter-build.d.ts +0 -18
- package/dist/plugins/adapter-build.d.ts.map +0 -1
- package/dist/plugins/cache-transform.d.ts +0 -36
- package/dist/plugins/cache-transform.d.ts.map +0 -1
- package/dist/plugins/dev-error-overlay.d.ts.map +0 -1
- package/dist/plugins/dev-logs.d.ts.map +0 -1
- package/dist/plugins/dynamic-transform.d.ts +0 -72
- package/dist/plugins/dynamic-transform.d.ts.map +0 -1
- package/dist/plugins/server-action-exports.d.ts +0 -26
- package/dist/plugins/server-action-exports.d.ts.map +0 -1
- package/dist/routing/status-file-lint.d.ts +0 -33
- package/dist/routing/status-file-lint.d.ts.map +0 -1
- package/dist/search-params/analyze.d.ts +0 -54
- package/dist/search-params/analyze.d.ts.map +0 -1
- package/dist/search-params/builtin-codecs.d.ts +0 -105
- package/dist/search-params/builtin-codecs.d.ts.map +0 -1
- package/dist/search-params/codecs.d.ts +0 -53
- package/dist/search-params/codecs.d.ts.map +0 -1
- package/dist/search-params/create.d.ts +0 -106
- package/dist/search-params/create.d.ts.map +0 -1
- package/dist/search-params/registry.d.ts +0 -20
- package/dist/search-params/registry.d.ts.map +0 -1
- package/dist/server/asset-headers.d.ts +0 -42
- package/dist/server/asset-headers.d.ts.map +0 -1
- package/dist/server/client-module-map.d.ts +0 -47
- package/dist/server/client-module-map.d.ts.map +0 -1
- package/dist/server/dev-fetch-instrumentation.d.ts +0 -22
- package/dist/server/dev-fetch-instrumentation.d.ts.map +0 -1
- package/dist/server/dev-logger.d.ts.map +0 -1
- package/dist/server/dev-span-processor.d.ts +0 -29
- package/dist/server/dev-span-processor.d.ts.map +0 -1
- package/dist/server/dev-warnings.d.ts +0 -129
- package/dist/server/dev-warnings.d.ts.map +0 -1
- package/dist/server/flush.d.ts +0 -74
- package/dist/server/flush.d.ts.map +0 -1
- package/dist/server/manifest-status-resolver.d.ts +0 -58
- package/dist/server/manifest-status-resolver.d.ts.map +0 -1
- package/dist/server/prerender.d.ts +0 -77
- package/dist/server/prerender.d.ts.map +0 -1
- package/dist/server/tree-builder.d.ts +0 -126
- package/dist/server/tree-builder.d.ts.map +0 -1
- package/dist/utils/directive-parser.d.ts +0 -70
- package/dist/utils/directive-parser.d.ts.map +0 -1
- package/src/cache/register-cached-function.ts +0 -103
- package/src/client/browser-entry.ts +0 -678
- package/src/client/head.ts +0 -61
- package/src/client/link-status-provider.tsx +0 -30
- package/src/client/segment-merger.ts +0 -339
- package/src/client/stale-reload.ts +0 -87
- package/src/client/transition-root.tsx +0 -166
- package/src/client/types.ts +0 -21
- package/src/client/use-navigation-pending.ts +0 -38
- package/src/client/use-params.ts +0 -141
- package/src/content/index.ts +0 -13
- package/src/plugins/adapter-build.ts +0 -118
- package/src/plugins/cache-transform.ts +0 -199
- package/src/plugins/dynamic-transform.ts +0 -161
- package/src/plugins/server-action-exports.ts +0 -220
- package/src/routing/status-file-lint.ts +0 -112
- package/src/search-params/analyze.ts +0 -192
- package/src/search-params/builtin-codecs.ts +0 -228
- package/src/search-params/codecs.ts +0 -153
- package/src/search-params/create.ts +0 -321
- package/src/search-params/registry.ts +0 -31
- package/src/server/asset-headers.ts +0 -81
- package/src/server/client-module-map.ts +0 -58
- package/src/server/dev-fetch-instrumentation.ts +0 -96
- package/src/server/dev-span-processor.ts +0 -78
- package/src/server/dev-warnings.ts +0 -283
- package/src/server/flush.ts +0 -182
- package/src/server/manifest-status-resolver.ts +0 -215
- package/src/server/prerender.ts +0 -139
- package/src/server/tree-builder.ts +0 -382
- package/src/shims/server-only-noop.js +0 -6
- package/src/utils/directive-parser.ts +0 -529
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server-v97rQH4b.js","names":[],"sources":["../../../../node_modules/.pnpm/srvx@1.0.5/node_modules/srvx/dist/adapters/node.mjs","../../src/dev-tools/stack-classifier.ts","../../src/dev-tools/terminal.ts","../../src/dev-tools/overlay.ts","../../src/server/utils/escape-html.ts","../../src/dev-tools/dev-page-shell.ts","../../src/dev-tools/error-page.ts","../../src/config-validation.ts","../../src/plugins/graph-endpoint.ts","../../src/server/compress.ts","../../src/plugins/dev-server.ts"],"sourcesContent":["import { FastURL, lazyInherit } from \"../_chunks/_url.mjs\";\nimport { createWaitUntil, fmtURL, printListening, resolvePortAndHost, resolveTLSOptions } from \"../_chunks/_utils2.mjs\";\nimport { createBodyTooLargeError, limitBodyStream } from \"../body-limit.mjs\";\nimport { errorPlugin, gracefulShutdownPlugin, wrapFetch } from \"../_chunks/_plugins.mjs\";\nimport { HOST_RE, forwardedHopValue, resolveClientIP, trustedHops } from \"../_chunks/_trust-proxy.mjs\";\nimport nodeHTTP, { IncomingMessage, ServerResponse } from \"node:http\";\nimport { Duplex, PassThrough, Readable, addAbortSignal } from \"node:stream\";\nimport { pipeline as pipeline$1 } from \"node:stream/promises\";\nimport nodeHTTPS from \"node:https\";\nimport nodeHTTP2 from \"node:http2\";\nfunction sendNodeResponse(nodeRes, webRes) {\n\ttry {\n\t\treturn _sendNodeResponse(nodeRes, webRes, false) || Promise.resolve();\n\t} catch (error) {\n\t\treturn Promise.reject(error);\n\t}\n}\nfunction sendNodeResponseDetached(nodeRes, webRes, silent) {\n\ttry {\n\t\treturn _sendNodeResponse(nodeRes, webRes, true);\n\t} catch (error) {\n\t\thandleSendError(nodeRes, error, silent);\n\t}\n}\nfunction handleSendError(nodeRes, error, silent) {\n\tif (!silent) console.error(\"[srvx] Failed to send response:\", error);\n\tfailResponse(nodeRes);\n}\nfunction sendErrorResponse(nodeRes, error, silent) {\n\tif (!silent) console.error(\"[srvx] Unhandled error in fetch handler:\", error);\n\tfailResponse(nodeRes);\n}\nfunction failResponse(nodeRes) {\n\tif (nodeRes.writableEnded) return;\n\tif (nodeRes.headersSent) nodeRes.destroy();\n\telse {\n\t\tnodeRes.statusCode = 500;\n\t\tif (nodeRes.req?.httpVersion !== \"2.0\") nodeRes.statusMessage = \"\";\n\t\tnodeRes.end();\n\t}\n}\nfunction _sendNodeResponse(nodeRes, webRes, detached) {\n\tif (!webRes) {\n\t\tnodeRes.statusCode = 500;\n\t\treturn endNodeResponse(nodeRes, detached);\n\t}\n\tif (webRes._toNodeResponse) {\n\t\tconst res = webRes._toNodeResponse();\n\t\tif (res.body) {\n\t\t\tif (res.body instanceof ReadableStream) {\n\t\t\t\twriteHead(nodeRes, res.status, res.statusText, res.headers);\n\t\t\t\treturn streamBody(res.body, nodeRes);\n\t\t\t} else if (typeof res.body?.pipe === \"function\") return pipeBody(res.body, nodeRes, res.status, res.statusText, res.headers);\n\t\t\twriteHead(nodeRes, res.status, res.statusText, res.headers);\n\t\t\tnodeRes.write(res.body);\n\t\t} else writeHead(nodeRes, res.status, res.statusText, res.headers);\n\t\treturn endNodeResponse(nodeRes, detached);\n\t}\n\tconst rawHeaders = [];\n\tfor (const [key, value] of webRes.headers) rawHeaders.push(key, value);\n\twriteHead(nodeRes, webRes.status, webRes.statusText, rawHeaders);\n\treturn webRes.body ? streamBody(webRes.body, nodeRes) : endNodeResponse(nodeRes, detached);\n}\nfunction writeHead(nodeRes, status, statusText, rawHeaders) {\n\tif (!nodeRes.headersSent) {\n\t\tif (nodeRes.req?.httpVersion === \"2.0\") nodeRes.writeHead(status, rawHeaders);\n\t\telse nodeRes.writeHead(status, safeStatusText(statusText), rawHeaders);\n\t}\n}\nconst INVALID_REASON_PHRASE_RE = /[^\\t\\u0020-\\u007E\\u0080-\\u00FF]/g;\nfunction safeStatusText(statusText) {\n\treturn typeof statusText === \"string\" && statusText ? statusText.replace(INVALID_REASON_PHRASE_RE, \"\") : statusText;\n}\nfunction endNodeResponse(nodeRes, detached) {\n\tif (detached) {\n\t\tnodeRes.end();\n\t\treturn;\n\t}\n\treturn new Promise((resolve) => nodeRes.end(resolve));\n}\nfunction pipeBody(stream, nodeRes, status, statusText, headers) {\n\tif (nodeRes.destroyed) {\n\t\tstream.destroy?.();\n\t\treturn;\n\t}\n\tif (nodeRes.req?.method === \"HEAD\") {\n\t\tif (typeof stream.destroy === \"function\") stream.destroy();\n\t\telse stream.abort?.();\n\t\twriteHead(nodeRes, status, statusText, headers);\n\t\treturn endNodeResponse(nodeRes);\n\t}\n\tif (typeof stream.on !== \"function\" || typeof stream.destroy !== \"function\") {\n\t\twriteHead(nodeRes, status, statusText, headers);\n\t\tstream.pipe(nodeRes);\n\t\treturn new Promise((resolve) => nodeRes.on(\"close\", resolve));\n\t}\n\tif (stream.destroyed) {\n\t\twriteHead(nodeRes, 500, \"Internal Server Error\", []);\n\t\treturn endNodeResponse(nodeRes);\n\t}\n\treturn new Promise((resolve) => {\n\t\tfunction cleanup() {\n\t\t\tstream.off(\"error\", onEarlyError);\n\t\t\tstream.off(\"readable\", onReadable);\n\t\t\tnodeRes.off(\"close\", onResClose);\n\t\t}\n\t\tfunction onEarlyError() {\n\t\t\tcleanup();\n\t\t\tstream.destroy();\n\t\t\twriteHead(nodeRes, 500, \"Internal Server Error\", []);\n\t\t\tendNodeResponse(nodeRes).then(resolve);\n\t\t}\n\t\tfunction onReadable() {\n\t\t\tcleanup();\n\t\t\tif (nodeRes.destroyed) {\n\t\t\t\tstream.destroy();\n\t\t\t\treturn resolve();\n\t\t\t}\n\t\t\twriteHead(nodeRes, status, statusText, headers);\n\t\t\tpipeline$1(stream, nodeRes).catch(() => {}).then(() => resolve());\n\t\t}\n\t\tfunction onResClose() {\n\t\t\tcleanup();\n\t\t\tstream.destroy();\n\t\t\tresolve();\n\t\t}\n\t\tstream.once(\"error\", onEarlyError);\n\t\tstream.once(\"readable\", onReadable);\n\t\tnodeRes.once(\"close\", onResClose);\n\t});\n}\nfunction streamBody(stream, nodeRes) {\n\tif (nodeRes.destroyed) {\n\t\tstream.cancel().catch(() => {});\n\t\treturn;\n\t}\n\tif (nodeRes.req?.method === \"HEAD\") {\n\t\tstream.cancel().catch(() => {});\n\t\treturn endNodeResponse(nodeRes);\n\t}\n\tconst reader = stream.getReader();\n\tfunction streamCancel(error) {\n\t\treader.cancel(error).catch(() => {});\n\t\tif (error) nodeRes.destroy(error);\n\t}\n\tfunction streamHandle({ done, value }) {\n\t\ttry {\n\t\t\tif (done) nodeRes.end();\n\t\t\telse if (nodeRes.write(value)) reader.read().then(streamHandle, streamCancel);\n\t\t\telse nodeRes.once(\"drain\", () => reader.read().then(streamHandle, streamCancel));\n\t\t} catch (error) {\n\t\t\tstreamCancel(error instanceof Error ? error : void 0);\n\t\t}\n\t}\n\tnodeRes.on(\"close\", streamCancel);\n\tnodeRes.on(\"error\", streamCancel);\n\treader.read().then(streamHandle, streamCancel);\n\treturn reader.closed.catch(streamCancel).finally(() => {\n\t\tnodeRes.off(\"close\", streamCancel);\n\t\tnodeRes.off(\"error\", streamCancel);\n\t});\n}\nvar NodeRequestURL = class extends FastURL {\n\tconstructor({ req, hops = 0 }) {\n\t\tconst path = req.url || \"/\";\n\t\tconst trusted = hops > 0;\n\t\tconst forwardedHost = forwardedHopValue(req.headers[\"x-forwarded-host\"], hops);\n\t\tlet host = (forwardedHost && HOST_RE.test(forwardedHost) ? forwardedHost : void 0) || req.headers.host || req.headers[\":authority\"];\n\t\tif (host && !HOST_RE.test(host)) host = \"_invalid_\";\n\t\telse if (!host) {\n\t\t\tif (req.socket) host = `${req.socket.localFamily === \"IPv6\" ? \"[\" + req.socket.localAddress + \"]\" : req.socket.localAddress}:${req.socket?.localPort || \"80\"}`;\n\t\t\telse host = \"localhost\";\n\t\t}\n\t\tconst forwardedProto = forwardedHopValue(req.headers[\"x-forwarded-proto\"], hops);\n\t\tconst protocol = req.socket?.encrypted || forwardedProto === \"https\" || trusted && req.headers[\":scheme\"] === \"https\" ? \"https:\" : \"http:\";\n\t\tif (path[0] === \"/\") {\n\t\t\tconst qIndex = path.indexOf(\"?\");\n\t\t\tsuper({\n\t\t\t\tprotocol,\n\t\t\t\thost,\n\t\t\t\tpathname: qIndex === -1 ? path : path.slice(0, qIndex) || \"/\",\n\t\t\t\tsearch: qIndex === -1 ? \"\" : path.slice(qIndex) || \"\"\n\t\t\t});\n\t\t} else if (path === \"*\") super({\n\t\t\tprotocol,\n\t\t\thost,\n\t\t\tpathname: \"/*\",\n\t\t\tsearch: \"\"\n\t\t});\n\t\telse {\n\t\t\tconst target = URL.canParse(path) ? new URL(path) : void 0;\n\t\t\tif (target) {\n\t\t\t\tconst targetHost = target.host;\n\t\t\t\tconst targetPath = target.pathname;\n\t\t\t\tsuper({\n\t\t\t\t\tprotocol,\n\t\t\t\t\thost: targetHost ? HOST_RE.test(targetHost) ? targetHost : \"_invalid_\" : host,\n\t\t\t\t\tpathname: targetPath ? targetPath[0] === \"/\" ? targetPath : `/${targetPath}` : \"/\",\n\t\t\t\t\tsearch: target.search\n\t\t\t\t});\n\t\t\t} else super({\n\t\t\t\tprotocol,\n\t\t\t\thost,\n\t\t\t\tpathname: \"/\",\n\t\t\t\tsearch: \"\"\n\t\t\t});\n\t\t}\n\t}\n};\nfunction isValidAbsoluteForm(target) {\n\tif (!URL.canParse(target)) return false;\n\tconst url = new URL(target);\n\treturn (url.protocol === \"http:\" || url.protocol === \"https:\") && url.host !== \"\";\n}\nconst _nonJoinedHeaders = /* @__PURE__ */ new Set([\n\t\"age\",\n\t\"authorization\",\n\t\"content-length\",\n\t\"content-type\",\n\t\"etag\",\n\t\"expires\",\n\t\"from\",\n\t\"host\",\n\t\"if-modified-since\",\n\t\"if-unmodified-since\",\n\t\"last-modified\",\n\t\"location\",\n\t\"max-forwards\",\n\t\"proxy-authorization\",\n\t\"referer\",\n\t\"retry-after\",\n\t\"server\",\n\t\"user-agent\"\n]);\nconst _validHeaderNameRE = /^[!#$%&'*+\\-.^_`|~\\dA-Za-z]+$/;\nfunction _isRepeated(rawHeaders, lowerName) {\n\tlet seen = false;\n\tfor (let i = 0; i < rawHeaders.length; i += 2) {\n\t\tconst key = rawHeaders[i];\n\t\tif (key.length === lowerName.length && key.toLowerCase() === lowerName) {\n\t\t\tif (seen) return true;\n\t\t\tseen = true;\n\t\t}\n\t}\n\treturn false;\n}\nconst NodeRequestHeaders = /* @__PURE__ */ (() => {\n\tconst NativeHeaders = globalThis.Headers;\n\tclass Headers {\n\t\t#req;\n\t\t#headers;\n\t\tconstructor(req) {\n\t\t\tthis.#req = req;\n\t\t}\n\t\tstatic [Symbol.hasInstance](val) {\n\t\t\treturn val instanceof NativeHeaders;\n\t\t}\n\t\t_adopt(headers) {\n\t\t\tthis.#headers = headers;\n\t\t}\n\t\tget _headers() {\n\t\t\tif (!this.#headers) {\n\t\t\t\tconst headers = new NativeHeaders();\n\t\t\t\tconst rawHeaders = this.#req.rawHeaders;\n\t\t\t\tconst len = rawHeaders.length;\n\t\t\t\tfor (let i = 0; i < len; i += 2) {\n\t\t\t\t\tconst key = rawHeaders[i];\n\t\t\t\t\tif (key.charCodeAt(0) === 58) continue;\n\t\t\t\t\tconst value = rawHeaders[i + 1];\n\t\t\t\t\theaders.append(key, value);\n\t\t\t\t}\n\t\t\t\tthis.#headers = headers;\n\t\t\t}\n\t\t\treturn this.#headers;\n\t\t}\n\t\tget(name) {\n\t\t\tif (this.#headers) return this.#headers.get(name);\n\t\t\tconst lower = name.toLowerCase();\n\t\t\tif (lower.charCodeAt(0) === 58) return this._headers.get(name);\n\t\t\tconst value = this.#req.headers[lower];\n\t\t\tif (typeof value === \"string\") return _nonJoinedHeaders.has(lower) && _isRepeated(this.#req.rawHeaders, lower) ? this._headers.get(name) : value;\n\t\t\tif (Array.isArray(value)) return value.join(\", \");\n\t\t\treturn lower !== \"__proto__\" && _validHeaderNameRE.test(name) ? null : this._headers.get(name);\n\t\t}\n\t\thas(name) {\n\t\t\tif (this.#headers) return this.#headers.has(name);\n\t\t\tconst lower = name.toLowerCase();\n\t\t\tif (lower.charCodeAt(0) === 58) return this._headers.has(name);\n\t\t\tif (Object.hasOwn(this.#req.headers, lower)) return true;\n\t\t\treturn lower !== \"__proto__\" && _validHeaderNameRE.test(name) ? false : this._headers.has(name);\n\t\t}\n\t\tgetSetCookie() {\n\t\t\tif (this.#headers) return this.#headers.getSetCookie();\n\t\t\tconst value = this.#req.headers[\"set-cookie\"];\n\t\t\treturn Array.isArray(value) ? value.slice() : value ? [value] : [];\n\t\t}\n\t\tentries() {\n\t\t\treturn this._headers.entries();\n\t\t}\n\t\t[Symbol.iterator]() {\n\t\t\treturn this.entries();\n\t\t}\n\t}\n\tlazyInherit(Headers.prototype, NativeHeaders.prototype, \"_headers\");\n\tObject.setPrototypeOf(Headers, NativeHeaders);\n\tObject.setPrototypeOf(Headers.prototype, NativeHeaders.prototype);\n\treturn Headers;\n})();\nconst kNativeRequest = /* @__PURE__ */ Symbol.for(\"srvx.nativeRequest\");\nfunction bodyUnusable() {\n\treturn /* @__PURE__ */ new TypeError(\"Body is unusable: Body has already been read\");\n}\nfunction abortError() {\n\treturn new DOMException(\"The request was aborted.\", \"AbortError\");\n}\nfunction erroredStream(error) {\n\treturn new ReadableStream({ start(controller) {\n\t\tcontroller.error(error);\n\t} });\n}\nfunction isClientGone(req) {\n\treturn req.aborted || !!req.errored || req.destroyed && !req.complete;\n}\nfunction isBodySourceFinished(req) {\n\treturn isClientGone(req) || req.destroyed || req.readableEnded;\n}\nconst NodeRequest = /* @__PURE__ */ (() => {\n\tconst NativeRequest = getNativeRequest();\n\tclass Request {\n\t\truntime;\n\t\twaitUntil;\n\t\t#req;\n\t\t#url;\n\t\t#bodyStream;\n\t\t#bodyUsed = false;\n\t\t#request;\n\t\t#headers;\n\t\t#abortController;\n\t\t#maxRequestBodySize;\n\t\t#trustProxy;\n\t\t#ip;\n\t\t#ipResolved = false;\n\t\t#remoteAddress;\n\t\t#remoteResolved = false;\n\t\t#hops;\n\t\tconstructor(ctx) {\n\t\t\tthis.#req = ctx.req;\n\t\t\tthis.#maxRequestBodySize = ctx.maxRequestBodySize;\n\t\t\tthis.#trustProxy = ctx.trustProxy;\n\t\t\tthis.runtime = {\n\t\t\t\tname: \"node\",\n\t\t\t\tnode: ctx\n\t\t\t};\n\t\t}\n\t\tstatic [Symbol.hasInstance](val) {\n\t\t\treturn val instanceof NativeRequest;\n\t\t}\n\t\t#remoteAddr() {\n\t\t\tif (!this.#remoteResolved) {\n\t\t\t\tthis.#remoteResolved = true;\n\t\t\t\tthis.#remoteAddress = this.#req.socket?.remoteAddress;\n\t\t\t}\n\t\t\treturn this.#remoteAddress;\n\t\t}\n\t\t#resolveHops() {\n\t\t\tif (this.#hops === void 0) this.#hops = trustedHops(this.#trustProxy, this.#remoteAddr(), this.#req.headers[\"x-forwarded-for\"]);\n\t\t\treturn this.#hops;\n\t\t}\n\t\tget ip() {\n\t\t\tif (this.#ipResolved) return this.#ip;\n\t\t\tthis.#ipResolved = true;\n\t\t\treturn this.#ip = resolveClientIP(this.#trustProxy, this.#remoteAddr(), this.#req.headers[\"x-forwarded-for\"]);\n\t\t}\n\t\tget method() {\n\t\t\tif (this.#request) return this.#request.method;\n\t\t\treturn this.#req.method || \"GET\";\n\t\t}\n\t\tget _url() {\n\t\t\treturn this.#url ||= new NodeRequestURL({\n\t\t\t\treq: this.#req,\n\t\t\t\thops: this.#resolveHops()\n\t\t\t});\n\t\t}\n\t\tset _url(url) {\n\t\t\tthis.#url = url;\n\t\t}\n\t\tget url() {\n\t\t\tif (this.#request) return this.#request.url;\n\t\t\treturn this._url.href;\n\t\t}\n\t\tget headers() {\n\t\t\treturn this.#headers ||= new NodeRequestHeaders(this.#req);\n\t\t}\n\t\tget _abortController() {\n\t\t\tif (!this.#abortController) {\n\t\t\t\tthis.#abortController = new AbortController();\n\t\t\t\tconst { req, res } = this.runtime.node;\n\t\t\t\tconst abortController = this.#abortController;\n\t\t\t\tconst abort = (err) => abortController.abort?.(err);\n\t\t\t\tif (res) {\n\t\t\t\t\tconst onClose = () => {\n\t\t\t\t\t\tconst reqError = req.errored;\n\t\t\t\t\t\tif (reqError) abort(reqError);\n\t\t\t\t\t\telse if (!res.writableEnded) abort();\n\t\t\t\t\t};\n\t\t\t\t\tres.once(\"close\", onClose);\n\t\t\t\t\tif (res.destroyed || isClientGone(req)) onClose();\n\t\t\t\t} else {\n\t\t\t\t\tconst onClose = () => {\n\t\t\t\t\t\tif (!req.complete || req.aborted) abort();\n\t\t\t\t\t};\n\t\t\t\t\treq.once(\"close\", onClose);\n\t\t\t\t\tif (isClientGone(req)) onClose();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.#abortController;\n\t\t}\n\t\tget signal() {\n\t\t\treturn this.#request ? this.#request.signal : this._abortController.signal;\n\t\t}\n\t\t#hasBody() {\n\t\t\tconst method = this.method;\n\t\t\treturn method !== \"GET\" && method !== \"HEAD\";\n\t\t}\n\t\tget body() {\n\t\t\tif (this.#request) return this.#request.body;\n\t\t\tif (this.#bodyStream === void 0) {\n\t\t\t\tlet stream = null;\n\t\t\t\tif (this.#hasBody() && !this.#bodyUsed) {\n\t\t\t\t\tif (isBodySourceFinished(this.#req)) stream = erroredStream(this.#bodyError());\n\t\t\t\t\telse stream = Readable.toWeb(this.#req);\n\t\t\t\t}\n\t\t\t\tif (stream && this.#maxRequestBodySize !== void 0) stream = limitBodyStream(stream, this.#maxRequestBodySize);\n\t\t\t\tthis.#bodyStream = stream;\n\t\t\t}\n\t\t\treturn this.#bodyStream;\n\t\t}\n\t\tget bodyUsed() {\n\t\t\tif (this.#isBodyUsed()) return true;\n\t\t\treturn this.#request ? this.#request.bodyUsed : false;\n\t\t}\n\t\t#isBodyUsed() {\n\t\t\tif (!this.#bodyUsed && this.#bodyStream && Readable.isDisturbed(this.#bodyStream)) this.#bodyUsed = true;\n\t\t\treturn this.#bodyUsed;\n\t\t}\n\t\t#bodyError() {\n\t\t\tconst signal = this._abortController.signal;\n\t\t\tif (signal.aborted) return signal.reason;\n\t\t\treturn this.#req.errored || (isClientGone(this.#req) ? abortError() : bodyUnusable());\n\t\t}\n\t\t#readBuffered() {\n\t\t\tif (\"rawBody\" in this.#req && Buffer.isBuffer(this.#req.rawBody)) return readBody(this.#req, this.#maxRequestBodySize);\n\t\t\tif (isBodySourceFinished(this.#req)) return Promise.reject(this.#bodyError());\n\t\t\treturn readBody(this.#req, this.#maxRequestBodySize);\n\t\t}\n\t\ttext() {\n\t\t\tif (this.#isBodyUsed()) return Promise.reject(bodyUnusable());\n\t\t\tif (this.#request) return this.#request.text();\n\t\t\tif (!this.#hasBody()) return Promise.resolve(\"\");\n\t\t\tthis.#bodyUsed = true;\n\t\t\tif (this.#bodyStream !== void 0) try {\n\t\t\t\treturn new Response(this.#bodyStream).text();\n\t\t\t} catch (error) {\n\t\t\t\treturn Promise.reject(error);\n\t\t\t}\n\t\t\treturn this.#readBuffered().then((buf) => buf.toString());\n\t\t}\n\t\tjson() {\n\t\t\tif (this.#isBodyUsed()) return Promise.reject(bodyUnusable());\n\t\t\tif (this.#request) return this.#request.json();\n\t\t\tif (!this.#hasBody()) return Promise.resolve().then(() => JSON.parse(\"\"));\n\t\t\tthis.#bodyUsed = true;\n\t\t\tif (this.#bodyStream !== void 0) try {\n\t\t\t\treturn new Response(this.#bodyStream).json();\n\t\t\t} catch (error) {\n\t\t\t\treturn Promise.reject(error);\n\t\t\t}\n\t\t\treturn this.#readBuffered().then((buf) => JSON.parse(buf.toString()));\n\t\t}\n\t\tarrayBuffer() {\n\t\t\treturn this.#consumeNative(\"arrayBuffer\");\n\t\t}\n\t\tbytes() {\n\t\t\treturn this.#consumeNative(\"bytes\");\n\t\t}\n\t\tblob() {\n\t\t\treturn this.#consumeNative(\"blob\");\n\t\t}\n\t\tformData() {\n\t\t\treturn this.#consumeNative(\"formData\");\n\t\t}\n\t\t#consumeNative(method) {\n\t\t\tif (this.#isBodyUsed()) return Promise.reject(bodyUnusable());\n\t\t\ttry {\n\t\t\t\treturn this._request[method]();\n\t\t\t} catch (error) {\n\t\t\t\treturn Promise.reject(error);\n\t\t\t}\n\t\t}\n\t\tget _request() {\n\t\t\tif (!this.#request) {\n\t\t\t\tconst body = this.#isBodyUsed() ? null : this.body;\n\t\t\t\tthis.#request = new NativeRequest(this.url, {\n\t\t\t\t\tmethod: this.method,\n\t\t\t\t\theaders: this.headers,\n\t\t\t\t\tsignal: this._abortController.signal,\n\t\t\t\t\tbody,\n\t\t\t\t\tduplex: body ? \"half\" : void 0\n\t\t\t\t});\n\t\t\t\tthis.#headers._adopt(this.#request.headers);\n\t\t\t\tthis.#bodyStream = void 0;\n\t\t\t}\n\t\t\treturn this.#request;\n\t\t}\n\t}\n\tlazyInherit(Request.prototype, NativeRequest.prototype, \"_request\");\n\tObject.setPrototypeOf(Request.prototype, NativeRequest.prototype);\n\treturn Request;\n})();\nfunction patchGlobalRequest() {\n\tif (globalThis.Request._srvx) return globalThis.Request;\n\tconst NativeRequest = getNativeRequest();\n\tconst PatchedRequest = class Request extends NativeRequest {\n\t\tstatic _srvx = true;\n\t\tstatic [Symbol.hasInstance](instance) {\n\t\t\tif (this === PatchedRequest) return instance instanceof NativeRequest;\n\t\t\telse return Object.prototype.isPrototypeOf.call(this.prototype, instance);\n\t\t}\n\t\tconstructor(input, options) {\n\t\t\tif (typeof input === \"object\" && \"_request\" in input) input = input._request;\n\t\t\tsuper(input, options);\n\t\t}\n\t};\n\tglobalThis.Request = PatchedRequest;\n\treturn PatchedRequest;\n}\nfunction readBody(req, maxRequestBodySize) {\n\tif (\"rawBody\" in req && Buffer.isBuffer(req.rawBody)) {\n\t\tif (maxRequestBodySize !== void 0 && req.rawBody.length > maxRequestBodySize) return Promise.reject(createBodyTooLargeError(maxRequestBodySize));\n\t\treturn Promise.resolve(req.rawBody);\n\t}\n\treturn new Promise((resolve, reject) => {\n\t\tconst chunks = [];\n\t\tlet size = 0;\n\t\tconst cleanup = () => {\n\t\t\treq.off(\"data\", onData);\n\t\t\treq.off(\"end\", onEnd);\n\t\t\treq.off(\"error\", onError);\n\t\t\treq.off(\"close\", onClose);\n\t\t};\n\t\tconst onData = (chunk) => {\n\t\t\tif (maxRequestBodySize !== void 0) {\n\t\t\t\tsize += chunk.length;\n\t\t\t\tif (size > maxRequestBodySize) {\n\t\t\t\t\tcleanup();\n\t\t\t\t\treq.pause?.();\n\t\t\t\t\treject(createBodyTooLargeError(maxRequestBodySize));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tchunks.push(chunk);\n\t\t};\n\t\tconst onError = (err) => {\n\t\t\tcleanup();\n\t\t\treject(err);\n\t\t};\n\t\tconst onEnd = () => {\n\t\t\tcleanup();\n\t\t\tif (isClientGone(req)) {\n\t\t\t\treject(req.errored || abortError());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(chunks.length === 1 ? chunks[0] : Buffer.concat(chunks));\n\t\t};\n\t\tconst onClose = () => {\n\t\t\tcleanup();\n\t\t\treject(req.errored || abortError());\n\t\t};\n\t\treq.on(\"data\", onData).once(\"end\", onEnd).once(\"error\", onError).once(\"close\", onClose);\n\t});\n}\nfunction getNativeRequest() {\n\tlet R = globalThis[kNativeRequest] || globalThis.Request;\n\twhile (R?._srvx) R = Object.getPrototypeOf(R);\n\treturn globalThis[kNativeRequest] ??= R;\n}\nconst NodeResponse = /* @__PURE__ */ (() => {\n\tconst NativeResponse = globalThis.Response;\n\tclass NodeResponse {\n\t\t#body;\n\t\t#init;\n\t\t#headers;\n\t\t#response;\n\t\tconstructor(body, init) {\n\t\t\tthis.#body = body;\n\t\t\tthis.#init = init;\n\t\t}\n\t\tstatic [Symbol.hasInstance](val) {\n\t\t\treturn val instanceof NativeResponse;\n\t\t}\n\t\tstatic json(data, init) {\n\t\t\tconst body = JSON.stringify(data);\n\t\t\tif (body === void 0) throw new TypeError(\"Value is not JSON serializable\");\n\t\t\tlet headers = init?.headers;\n\t\t\tif (!headers) headers = { \"content-type\": \"application/json\" };\n\t\t\telse {\n\t\t\t\tconst merged = new Headers(headers);\n\t\t\t\tif (!merged.has(\"content-type\")) merged.set(\"content-type\", \"application/json\");\n\t\t\t\theaders = merged;\n\t\t\t}\n\t\t\treturn new NodeResponse(body, init ? {\n\t\t\t\t...init,\n\t\t\t\theaders\n\t\t\t} : { headers });\n\t\t}\n\t\tget status() {\n\t\t\treturn this.#response?.status || this.#init?.status || 200;\n\t\t}\n\t\tget statusText() {\n\t\t\treturn this.#response?.statusText || this.#init?.statusText || \"\";\n\t\t}\n\t\tget headers() {\n\t\t\tif (this.#response) return this.#response.headers;\n\t\t\tif (this.#headers) return this.#headers;\n\t\t\treturn this.#headers = new Headers(this.#init?.headers);\n\t\t}\n\t\tget ok() {\n\t\t\tif (this.#response) return this.#response.ok;\n\t\t\tconst status = this.status;\n\t\t\treturn status >= 200 && status < 300;\n\t\t}\n\t\tget _response() {\n\t\t\tif (this.#response) return this.#response;\n\t\t\tlet body = this.#body;\n\t\t\tif (body && typeof body.pipe === \"function\" && !(body instanceof Readable)) {\n\t\t\t\tconst stream = new PassThrough();\n\t\t\t\tbody.pipe(stream);\n\t\t\t\tconst abort = body.abort;\n\t\t\t\tif (abort) stream.once(\"close\", () => abort());\n\t\t\t\tbody = stream;\n\t\t\t}\n\t\t\tthis.#response = new NativeResponse(body, this.#headers ? {\n\t\t\t\t...this.#init,\n\t\t\t\theaders: this.#headers\n\t\t\t} : this.#init);\n\t\t\tthis.#init = void 0;\n\t\t\tthis.#headers = void 0;\n\t\t\tthis.#body = void 0;\n\t\t\treturn this.#response;\n\t\t}\n\t\t_toNodeResponse() {\n\t\t\tconst status = this.status;\n\t\t\tconst statusText = this.statusText;\n\t\t\tlet body;\n\t\t\tlet contentType;\n\t\t\tlet contentLength;\n\t\t\tif (this.#response) body = this.#response.body;\n\t\t\telse if (this.#body != null) {\n\t\t\t\tif (this.#body instanceof ReadableStream) body = this.#body;\n\t\t\t\telse if (typeof this.#body === \"string\") {\n\t\t\t\t\tbody = this.#body;\n\t\t\t\t\tcontentType = \"text/plain; charset=UTF-8\";\n\t\t\t\t\tcontentLength = Buffer.byteLength(this.#body);\n\t\t\t\t} else if (this.#body instanceof ArrayBuffer) {\n\t\t\t\t\tbody = Buffer.from(this.#body);\n\t\t\t\t\tcontentLength = this.#body.byteLength;\n\t\t\t\t} else if (this.#body instanceof Uint8Array) {\n\t\t\t\t\tbody = this.#body;\n\t\t\t\t\tcontentLength = this.#body.byteLength;\n\t\t\t\t} else if (this.#body instanceof DataView) {\n\t\t\t\t\tbody = Buffer.from(this.#body.buffer, this.#body.byteOffset, this.#body.byteLength);\n\t\t\t\t\tcontentLength = this.#body.byteLength;\n\t\t\t\t} else if (this.#body instanceof Blob) {\n\t\t\t\t\tbody = this.#body.stream();\n\t\t\t\t\tcontentType = this.#body.type;\n\t\t\t\t\tcontentLength = this.#body.size;\n\t\t\t\t} else if (typeof this.#body.pipe === \"function\") body = this.#body;\n\t\t\t\telse body = this._response.body;\n\t\t\t}\n\t\t\tconst headers = [];\n\t\t\tconst initHeaders = this.#init?.headers;\n\t\t\tconst headerEntries = this.#response?.headers || this.#headers || (initHeaders ? Array.isArray(initHeaders) ? initHeaders : initHeaders?.entries ? initHeaders.entries() : Object.entries(initHeaders) : void 0);\n\t\t\tlet hasContentTypeHeader;\n\t\t\tlet hasContentLength;\n\t\t\tif (headerEntries) for (const [key, value] of headerEntries) {\n\t\t\t\tconst lowerKey = typeof key === \"string\" ? key.toLowerCase() : String(key);\n\t\t\t\tif (Array.isArray(value)) for (const v of value) headers.push(lowerKey, v);\n\t\t\t\telse headers.push(lowerKey, value);\n\t\t\t\tif (lowerKey === \"content-type\") hasContentTypeHeader = true;\n\t\t\t\telse if (lowerKey === \"content-length\") hasContentLength = true;\n\t\t\t}\n\t\t\tif (contentType && !hasContentTypeHeader) headers.push(\"content-type\", contentType);\n\t\t\tif (contentLength != null && !hasContentLength) headers.push(\"content-length\", String(contentLength));\n\t\t\tthis.#init = void 0;\n\t\t\tthis.#headers = void 0;\n\t\t\tthis.#response = void 0;\n\t\t\tthis.#body = void 0;\n\t\t\treturn {\n\t\t\t\tstatus,\n\t\t\t\tstatusText,\n\t\t\t\theaders,\n\t\t\t\tbody\n\t\t\t};\n\t\t}\n\t}\n\tlazyInherit(NodeResponse.prototype, NativeResponse.prototype, \"_response\");\n\tObject.setPrototypeOf(NodeResponse, NativeResponse);\n\tObject.setPrototypeOf(NodeResponse.prototype, NativeResponse.prototype);\n\treturn NodeResponse;\n})();\nfunction prematureCloseError() {\n\treturn Object.assign(/* @__PURE__ */ new Error(\"Connection closed before response was finished\"), { code: \"ERR_STREAM_PREMATURE_CLOSE\" });\n}\nvar WebRequestSocket = class extends Duplex {\n\t_httpMessage;\n\tautoSelectFamilyAttemptedAddresses = [];\n\tbufferSize = 0;\n\tbytesRead = 0;\n\tbytesWritten = 0;\n\tconnecting = false;\n\tpending = false;\n\treadyState = \"open\";\n\tremoteAddress = \"\";\n\tremoteFamily = \"\";\n\tremotePort = 0;\n\t#request;\n\t#timeoutTimer;\n\t#reqReader;\n\t#headersWritten;\n\t#_writeBody;\n\t#resBodyController;\n\t#resBodyClosed;\n\t_webResBody;\n\t#tos = 0;\n\tconstructor(request) {\n\t\tsuper({ allowHalfOpen: true });\n\t\tthis.#request = request;\n\t\tthis._webResBody = new ReadableStream({ start: (controller) => {\n\t\t\tthis.#resBodyController = controller;\n\t\t\tthis.#_writeBody = controller.enqueue.bind(controller);\n\t\t\tthis.once(\"finish\", () => {\n\t\t\t\tthis.readyState = \"closed\";\n\t\t\t\tthis.#resBodyClosed = true;\n\t\t\t\tcontroller.close();\n\t\t\t});\n\t\t} });\n\t\tif (request.signal) addAbortSignal(request.signal, this);\n\t}\n\tsetTimeout(ms, cb) {\n\t\tif (typeof ms !== \"number\" || !Number.isFinite(ms) || ms < 0) return this;\n\t\tif (cb) this.on(\"timeout\", cb);\n\t\tif (this.#timeoutTimer) clearTimeout(this.#timeoutTimer);\n\t\tif (ms > 0) this.#timeoutTimer = setTimeout(() => this.emit(\"timeout\"), ms);\n\t\treturn this;\n\t}\n\tsetNoDelay() {\n\t\treturn this;\n\t}\n\tsetKeepAlive() {\n\t\treturn this;\n\t}\n\tref() {\n\t\treturn this;\n\t}\n\tunref() {\n\t\treturn this;\n\t}\n\tdestroySoon() {\n\t\tthis.destroy();\n\t}\n\tconnect() {\n\t\treturn this;\n\t}\n\tresetAndDestroy() {\n\t\tthis.destroy();\n\t\treturn this;\n\t}\n\taddress() {\n\t\treturn {\n\t\t\taddress: \"\",\n\t\t\tfamily: \"\",\n\t\t\tport: 0\n\t\t};\n\t}\n\tbodyReader() {\n\t\ttry {\n\t\t\treturn this.#request.body?.getReader();\n\t\t} catch (error) {\n\t\t\tthis.emit(\"error\", error);\n\t\t}\n\t}\n\tgetTypeOfService() {\n\t\treturn this.#tos;\n\t}\n\tsetTypeOfService(tos) {\n\t\tthis.#tos = tos;\n\t\treturn this;\n\t}\n\t_read(_size) {\n\t\tconst reader = this.#reqReader ??= this.bodyReader();\n\t\tif (!reader) {\n\t\t\tthis.push(null);\n\t\t\treturn;\n\t\t}\n\t\treader.read().then((res) => this._onRead(res)).catch((error) => {\n\t\t\tthis.emit(\"error\", error);\n\t\t});\n\t}\n\t_onRead(res) {\n\t\tif (res.done) {\n\t\t\tthis.push(null);\n\t\t\treturn;\n\t\t}\n\t\tif (res.value) {\n\t\t\tthis.bytesRead += res.value.byteLength;\n\t\t\tthis.push(res.value);\n\t\t}\n\t}\n\t_write(chunk, encoding, callback) {\n\t\tif (this.#headersWritten) this.#_writeBody(typeof chunk === \"string\" ? Buffer.from(chunk, encoding) : chunk);\n\t\telse if (chunk?.length > 0) {\n\t\t\tthis.#headersWritten = true;\n\t\t\tconst headerEnd = chunk.indexOf(\"\\r\\n\\r\\n\");\n\t\t\tif (headerEnd === -1) throw new Error(\"Invalid HTTP headers chunk!\");\n\t\t\tif (headerEnd < chunk.length - 4) {\n\t\t\t\tthis._write(chunk.slice(headerEnd + 4), encoding, () => {\n\t\t\t\t\tcallback(null);\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tcallback(null);\n\t}\n\t_final(callback) {\n\t\tcallback(null);\n\t}\n\t_destroy(err, cb) {\n\t\tif (this.#timeoutTimer) clearTimeout(this.#timeoutTimer);\n\t\tif (this.#reqReader) this.#reqReader.cancel().catch((error) => {\n\t\t\tconsole.error(error);\n\t\t});\n\t\tif (!this.#resBodyClosed) {\n\t\t\tthis.#resBodyClosed = true;\n\t\t\ttry {\n\t\t\t\tthis.#resBodyController?.error(err ?? prematureCloseError());\n\t\t\t} catch {}\n\t\t}\n\t\tthis.readyState = \"closed\";\n\t\tcb(err ?? void 0);\n\t}\n};\nvar WebIncomingMessage = class extends IncomingMessage {\n\t#socket;\n\tconstructor(req, socket) {\n\t\tsuper(socket);\n\t\tthis.#socket = socket;\n\t\tthis.method = req.method;\n\t\tconst url = req._url ??= new FastURL(req.url);\n\t\tthis.url = url.pathname + url.search;\n\t\tthis.httpVersionMajor = 1;\n\t\tthis.httpVersionMinor = 1;\n\t\tthis.httpVersion = \"1.1\";\n\t\tconst headers = {};\n\t\tconst rawHeaders = this.rawHeaders;\n\t\tfor (const [key, value] of req.headers.entries()) {\n\t\t\tconst lowerKey = key.toLowerCase();\n\t\t\tif (lowerKey === \"set-cookie\") continue;\n\t\t\theaders[lowerKey] = value;\n\t\t\trawHeaders.push(key, value);\n\t\t}\n\t\tconst setCookie = req.headers.getSetCookie?.() ?? [];\n\t\tif (setCookie.length > 0) {\n\t\t\theaders[\"set-cookie\"] = setCookie;\n\t\t\tfor (const cookie of setCookie) rawHeaders.push(\"set-cookie\", cookie);\n\t\t}\n\t\tif (req.method !== \"GET\" && req.method !== \"HEAD\" && !headers[\"content-length\"] && !headers[\"transfer-encoding\"]) headers[\"transfer-encoding\"] = \"chunked\";\n\t\tthis.headers = headers;\n\t\tconst onData = (chunk) => {\n\t\t\tif (!this.push(chunk)) socket.pause();\n\t\t};\n\t\tsocket.on(\"data\", onData);\n\t\tsocket.once(\"end\", () => {\n\t\t\tthis.complete = true;\n\t\t\tthis.push(null);\n\t\t\tsocket.off(\"data\", onData);\n\t\t});\n\t}\n\t_read(_size) {\n\t\tthis.#socket.resume();\n\t}\n\t_destroy(_err, cb) {\n\t\tcb();\n\t}\n};\nfunction callNodeHandler(handler, req) {\n\tconst isMiddleware = handler.length > 2;\n\tconst nodeCtx = req.runtime?.node;\n\tif (!nodeCtx || !nodeCtx.req || !nodeCtx.res) throw new Error(\"Node.js runtime context is not available.\");\n\tconst { req: nodeReq, res: nodeRes } = nodeCtx;\n\tlet _headers;\n\tconst webRes = new NodeResponse(void 0, {\n\t\tget status() {\n\t\t\treturn nodeRes.statusCode;\n\t\t},\n\t\tget statusText() {\n\t\t\treturn nodeRes.statusMessage;\n\t\t},\n\t\tget headers() {\n\t\t\tif (!_headers) {\n\t\t\t\tconst headerEntries = [];\n\t\t\t\tconst rawHeaders = nodeRes.getHeaders();\n\t\t\t\tfor (const [name, value] of Object.entries(rawHeaders)) if (Array.isArray(value)) for (const v of value) headerEntries.push([name, v]);\n\t\t\t\telse if (value) headerEntries.push([name, String(value)]);\n\t\t\t\t_headers = new Headers(headerEntries);\n\t\t\t}\n\t\t\treturn _headers;\n\t\t}\n\t});\n\treturn new Promise((resolve, reject) => {\n\t\tnodeRes.once(\"close\", () => resolve(webRes));\n\t\tnodeRes.once(\"finish\", () => resolve(webRes));\n\t\tnodeRes.once(\"error\", (error) => reject(error));\n\t\tlet streamPromise;\n\t\tnodeRes.once(\"pipe\", (stream) => {\n\t\t\tstreamPromise = new Promise((resolve) => {\n\t\t\t\tstream.once(\"end\", () => resolve(webRes));\n\t\t\t\tstream.once(\"error\", (error) => reject(error));\n\t\t\t});\n\t\t});\n\t\ttry {\n\t\t\tif (isMiddleware) Promise.resolve(handler(nodeReq, nodeRes, (error) => error ? reject(error) : streamPromise || resolve(webRes))).catch((error) => reject(error));\n\t\t\telse Promise.resolve(handler(nodeReq, nodeRes)).then(() => streamPromise || webRes).catch((error) => reject(error));\n\t\t} catch (error) {\n\t\t\treject(error);\n\t\t}\n\t});\n}\nlet needDrainSymbol;\nfunction getNeedDrainSymbol(res) {\n\tneedDrainSymbol ??= Object.getOwnPropertySymbols(res).find((s) => s.description === \"kNeedDrain\");\n\treturn needDrainSymbol;\n}\nconst NULL_BODY_STATUSES = /* @__PURE__ */ new Set([\n\t101,\n\t204,\n\t205,\n\t304\n]);\nconst HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([\n\t\"connection\",\n\t\"keep-alive\",\n\t\"proxy-authenticate\",\n\t\"proxy-authorization\",\n\t\"te\",\n\t\"trailer\",\n\t\"transfer-encoding\",\n\t\"upgrade\"\n]);\nvar WebServerResponse = class extends ServerResponse {\n\t#socket;\n\t#socketError;\n\t#onHeadersSent;\n\tconstructor(req, socket) {\n\t\tsuper(req);\n\t\tthis.assignSocket(socket);\n\t\tthis.useChunkedEncodingByDefault = false;\n\t\tthis.once(\"finish\", () => {\n\t\t\tsocket.end();\n\t\t});\n\t\tthis.#socket = socket;\n\t\tsocket.once(\"error\", (err) => {\n\t\t\tthis.#socketError ??= err;\n\t\t});\n\t\tsocket.on(\"drain\", () => {\n\t\t\tconst kNeedDrain = getNeedDrainSymbol(this);\n\t\t\tif (kNeedDrain && !this[kNeedDrain]) return;\n\t\t\tif (this.destroyed || this.writableFinished) return;\n\t\t\tif (kNeedDrain) this[kNeedDrain] = false;\n\t\t\tthis.emit(\"drain\");\n\t\t});\n\t\tthis.waitToFinish = this.waitToFinish.bind(this);\n\t\tthis.waitForResponseHead = this.waitForResponseHead.bind(this);\n\t\tthis.toWebResponse = this.toWebResponse.bind(this);\n\t}\n\twriteHead(statusCode, statusMessage, headers) {\n\t\tconst result = typeof statusMessage === \"string\" ? super.writeHead(statusCode, statusMessage, stripTransferEncoding(headers)) : super.writeHead(statusCode, stripTransferEncoding(headers ?? statusMessage));\n\t\tthis.#onHeadersSent?.();\n\t\treturn result;\n\t}\n\tsetHeader(name, value) {\n\t\tif (typeof name === \"string\" && name.toLowerCase() === \"transfer-encoding\") return this;\n\t\treturn super.setHeader(name, value);\n\t}\n\tappendHeader(name, value) {\n\t\tif (typeof name === \"string\" && name.toLowerCase() === \"transfer-encoding\") return this;\n\t\treturn super.appendHeader(name, value);\n\t}\n\twaitToFinish() {\n\t\tif (this.writableFinished) return Promise.resolve();\n\t\tif (this.#socketError || this.#socket.destroyed) return Promise.reject(this.#socketError ?? prematureCloseError());\n\t\tif (this.writableEnded) return Promise.resolve();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst socket = this.#socket;\n\t\t\tconst settle = (err) => {\n\t\t\t\tthis.removeListener(\"finish\", onFinish);\n\t\t\t\tthis.removeListener(\"error\", onError);\n\t\t\t\tsocket.removeListener(\"error\", onError);\n\t\t\t\tsocket.removeListener(\"close\", onClose);\n\t\t\t\tif (err) reject(err);\n\t\t\t\telse resolve();\n\t\t\t};\n\t\t\tconst onFinish = () => settle();\n\t\t\tconst onError = (err) => settle(err);\n\t\t\tconst onClose = () => {\n\t\t\t\tif (!this.writableFinished) settle(this.#socketError ?? prematureCloseError());\n\t\t\t};\n\t\t\tthis.on(\"finish\", onFinish);\n\t\t\tthis.on(\"error\", onError);\n\t\t\tsocket.on(\"error\", onError);\n\t\t\tsocket.on(\"close\", onClose);\n\t\t});\n\t}\n\twaitForResponseHead() {\n\t\tif (this.headersSent || this.writableEnded || this.writableFinished) return Promise.resolve();\n\t\tif (this.#socketError || this.#socket.destroyed) return Promise.reject(this.#socketError ?? prematureCloseError());\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst socket = this.#socket;\n\t\t\tconst settle = (err) => {\n\t\t\t\tthis.#onHeadersSent = void 0;\n\t\t\t\tthis.removeListener(\"finish\", onFinish);\n\t\t\t\tthis.removeListener(\"error\", onError);\n\t\t\t\tsocket.removeListener(\"error\", onError);\n\t\t\t\tsocket.removeListener(\"close\", onClose);\n\t\t\t\tif (err) reject(err);\n\t\t\t\telse resolve();\n\t\t\t};\n\t\t\tthis.#onHeadersSent = () => settle();\n\t\t\tconst onFinish = () => settle();\n\t\t\tconst onError = (err) => settle(err);\n\t\t\tconst onClose = () => {\n\t\t\t\tif (!this.headersSent && !this.writableFinished) settle(this.#socketError ?? prematureCloseError());\n\t\t\t};\n\t\t\tthis.on(\"finish\", onFinish);\n\t\t\tthis.on(\"error\", onError);\n\t\t\tsocket.on(\"error\", onError);\n\t\t\tsocket.on(\"close\", onClose);\n\t\t});\n\t}\n\tasync toWebResponse() {\n\t\tawait this.waitForResponseHead();\n\t\tconst headers = [];\n\t\tconst httpHeader = this._header?.split(\"\\r\\n\");\n\t\tconst connectionTokens = /* @__PURE__ */ new Set();\n\t\tfor (let i = 1; httpHeader && i < httpHeader.length; i++) {\n\t\t\tconst sepIndex = httpHeader[i].indexOf(\": \");\n\t\t\tif (sepIndex === -1) continue;\n\t\t\tconst key = httpHeader[i].slice(0, Math.max(0, sepIndex));\n\t\t\tconst value = httpHeader[i].slice(Math.max(0, sepIndex + 2));\n\t\t\tif (!key) continue;\n\t\t\tconst lowerKey = key.toLowerCase();\n\t\t\tif (lowerKey === \"connection\") for (const token of value.split(\",\")) {\n\t\t\t\tconst t = token.trim().toLowerCase();\n\t\t\t\tif (t) connectionTokens.add(t);\n\t\t\t}\n\t\t\tif (HOP_BY_HOP_HEADERS.has(lowerKey)) continue;\n\t\t\theaders.push([key, value]);\n\t\t}\n\t\tif (connectionTokens.size > 0) {\n\t\t\tfor (let i = headers.length - 1; i >= 0; i--) if (connectionTokens.has(headers[i][0].toLowerCase())) headers.splice(i, 1);\n\t\t}\n\t\tconst nullBody = NULL_BODY_STATUSES.has(this.statusCode);\n\t\treturn new Response(nullBody ? null : this.#socket._webResBody, {\n\t\t\tstatus: this.statusCode,\n\t\t\tstatusText: this.statusMessage,\n\t\t\theaders\n\t\t});\n\t}\n};\nfunction stripTransferEncoding(headers) {\n\tif (!headers || typeof headers !== \"object\") return headers;\n\tif (Array.isArray(headers)) {\n\t\tif (headers.length > 0 && Array.isArray(headers[0])) return headers.filter(([key]) => String(key).toLowerCase() !== \"transfer-encoding\");\n\t\tconst out = [];\n\t\tfor (let i = 0; i < headers.length; i += 2) {\n\t\t\tif (String(headers[i]).toLowerCase() === \"transfer-encoding\") continue;\n\t\t\tout.push(headers[i], headers[i + 1]);\n\t\t}\n\t\treturn out;\n\t}\n\tlet hasTransferEncoding = false;\n\tfor (const key in headers) if (key.toLowerCase() === \"transfer-encoding\") {\n\t\thasTransferEncoding = true;\n\t\tbreak;\n\t}\n\tif (!hasTransferEncoding) return headers;\n\tconst out = {};\n\tfor (const key in headers) {\n\t\tif (key.toLowerCase() === \"transfer-encoding\") continue;\n\t\tout[key] = headers[key];\n\t}\n\treturn out;\n}\nasync function fetchNodeHandler(handler, req) {\n\tconst nodeRuntime = req.runtime?.node;\n\tif (nodeRuntime && nodeRuntime.req && nodeRuntime.res) return await callNodeHandler(handler, req);\n\tconst socket = new WebRequestSocket(req);\n\tconst nodeReq = new WebIncomingMessage(req, socket);\n\tconst nodeRes = new WebServerResponse(nodeReq, socket);\n\ttry {\n\t\tif (handler.length > 2) await new Promise((resolve, reject) => {\n\t\t\tnodeRes.once(\"finish\", () => resolve());\n\t\t\tnodeRes.once(\"close\", () => resolve());\n\t\t\tnodeRes.once(\"error\", (error) => reject(error));\n\t\t\tPromise.resolve(handler(nodeReq, nodeRes, (error) => {\n\t\t\t\tif (error) return reject(error);\n\t\t\t\tif (!nodeRes.writableEnded) nodeRes.end();\n\t\t\t\tresolve();\n\t\t\t})).catch((error) => reject(error));\n\t\t});\n\t\telse await handler(nodeReq, nodeRes);\n\t\treturn await nodeRes.toWebResponse();\n\t} catch (error) {\n\t\tif (!(req.signal?.aborted || error?.name === \"AbortError\" || error?.code === \"ERR_STREAM_PREMATURE_CLOSE\")) console.error(error, { cause: {\n\t\t\treq,\n\t\t\thandler\n\t\t} });\n\t\treturn new Response(null, {\n\t\t\tstatus: 500,\n\t\t\tstatusText: \"Internal Server Error\"\n\t\t});\n\t}\n}\nfunction toNodeHandler(handler, options) {\n\tif (handler.__nodeHandler) return handler.__nodeHandler;\n\tfunction convertedNodeHandler(nodeReq, nodeRes) {\n\t\tconst res = handler(new NodeRequest({\n\t\t\treq: nodeReq,\n\t\t\tres: nodeRes,\n\t\t\tmaxRequestBodySize: options?.maxRequestBodySize,\n\t\t\ttrustProxy: options?.trustProxy\n\t\t}));\n\t\treturn typeof res?.then === \"function\" ? res.then((resolvedRes) => send(nodeRes, resolvedRes)) : send(nodeRes, res);\n\t}\n\tconvertedNodeHandler.__fetchHandler = handler;\n\tassignFnName(convertedNodeHandler, handler, \" (converted to Node handler)\");\n\treturn convertedNodeHandler;\n}\nfunction send(nodeRes, webRes) {\n\treturn sendNodeResponse(nodeRes, webRes).catch((error) => handleSendError(nodeRes, error));\n}\nfunction toFetchHandler(handler) {\n\tif (handler.__fetchHandler) return handler.__fetchHandler;\n\tfunction convertedNodeHandler(req) {\n\t\treturn fetchNodeHandler(handler, req);\n\t}\n\tconvertedNodeHandler.__nodeHandler = handler;\n\tassignFnName(convertedNodeHandler, handler, \" (converted to Web handler)\");\n\treturn convertedNodeHandler;\n}\nfunction assignFnName(target, source, suffix) {\n\tif (source.name) try {\n\t\tObject.defineProperty(target, \"name\", { value: `${source.name}${suffix}` });\n\t} catch {}\n}\nfunction serve(options) {\n\treturn new NodeServer(options);\n}\nvar NodeServer = class {\n\truntime = \"node\";\n\toptions;\n\tnode;\n\tserveOptions;\n\tfetch;\n\twaitUntil;\n\t#isSecure;\n\t#listeningPromise;\n\t#listenError;\n\t#listenErrorObserved;\n\t#wait;\n\tconstructor(options) {\n\t\tthis.options = {\n\t\t\t...options,\n\t\t\tmiddleware: [...options.middleware || []]\n\t\t};\n\t\tfor (const plugin of options.plugins || []) plugin(this);\n\t\terrorPlugin(this);\n\t\tconst fetchHandler = this.fetch = wrapFetch(this);\n\t\tconst handler = (nodeReq, nodeRes) => {\n\t\t\tconst reqUrl = nodeReq.url;\n\t\t\tif (reqUrl && reqUrl[0] !== \"/\" && reqUrl !== \"*\" && !isValidAbsoluteForm(reqUrl)) {\n\t\t\t\tnodeRes.statusCode = 400;\n\t\t\t\tnodeRes.end();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst request = new NodeRequest({\n\t\t\t\treq: nodeReq,\n\t\t\t\tres: nodeRes,\n\t\t\t\tmaxRequestBodySize: this.options.maxRequestBodySize,\n\t\t\t\ttrustProxy: this.options.trustProxy\n\t\t\t});\n\t\t\trequest.waitUntil = this.#wait?.waitUntil;\n\t\t\tlet res;\n\t\t\ttry {\n\t\t\t\tres = fetchHandler(request);\n\t\t\t} catch (error) {\n\t\t\t\treturn sendErrorResponse(nodeRes, error, this.options.silent);\n\t\t\t}\n\t\t\treturn typeof res?.then === \"function\" ? res.then((resolvedRes) => sendNodeResponseDetached(nodeRes, resolvedRes, this.options.silent), (error) => sendErrorResponse(nodeRes, error, this.options.silent)) : sendNodeResponseDetached(nodeRes, res, this.options.silent);\n\t\t};\n\t\tthis.node = {\n\t\t\thandler,\n\t\t\tserver: void 0\n\t\t};\n\t\tconst loader = globalThis.__srvxLoader__;\n\t\tif (loader) {\n\t\t\tloader({ server: this });\n\t\t\treturn;\n\t\t}\n\t\tgracefulShutdownPlugin(this);\n\t\tthis.#wait = createWaitUntil();\n\t\tthis.waitUntil = this.#wait.waitUntil;\n\t\tconst tls = resolveTLSOptions(this.options);\n\t\tconst { port, hostname: host } = resolvePortAndHost(this.options);\n\t\tthis.serveOptions = {\n\t\t\tport,\n\t\t\thost,\n\t\t\texclusive: !this.options.reusePort,\n\t\t\treusePort: this.options.reusePort,\n\t\t\t...tls,\n\t\t\t...this.options.node\n\t\t};\n\t\tlet server;\n\t\tthis.#isSecure = !!this.serveOptions.cert && this.options.protocol !== \"http\";\n\t\tif (this.options.node?.http2 ?? this.#isSecure) {\n\t\t\tif (this.#isSecure) server = nodeHTTP2.createSecureServer({\n\t\t\t\tallowHTTP1: true,\n\t\t\t\t...this.serveOptions\n\t\t\t}, handler);\n\t\t\telse throw new Error(\"node.http2 option requires tls certificate!\");\n\t\t} else if (this.#isSecure) server = nodeHTTPS.createServer(this.serveOptions, handler);\n\t\telse server = nodeHTTP.createServer(this.serveOptions, handler);\n\t\tthis.node.server = server;\n\t\tif (!options.manual) this.serve().catch((error) => this.#reportUnobservedListenError(error));\n\t}\n\t#reportUnobservedListenError(error) {\n\t\tif (this.#listenErrorObserved) return;\n\t\tif (!this.options.silent) console.error(\"[srvx] Failed to start server:\", error);\n\t\tconst process = globalThis.process;\n\t\tif (process && !process.exitCode) process.exitCode = 1;\n\t}\n\tserve() {\n\t\tif (this.#listeningPromise) return this.#listeningPromise.then(() => this);\n\t\tconst server = this.node?.server;\n\t\tif (!server) return Promise.reject(/* @__PURE__ */ new Error(\"Server not initialized\"));\n\t\tthis.#listenError = void 0;\n\t\tthis.#listeningPromise = new Promise((resolve, reject) => {\n\t\t\tconst onError = (error) => {\n\t\t\t\tserver.off(\"listening\", onListening);\n\t\t\t\tthis.#listenError = error;\n\t\t\t\tthis.#listeningPromise = void 0;\n\t\t\t\treject(error);\n\t\t\t};\n\t\t\tconst onListening = () => {\n\t\t\t\tserver.off(\"error\", onError);\n\t\t\t\tprintListening(this.options, this.url);\n\t\t\t\tresolve();\n\t\t\t};\n\t\t\tserver.once(\"error\", onError);\n\t\t\tserver.once(\"listening\", onListening);\n\t\t\tserver.listen(this.serveOptions);\n\t\t});\n\t\treturn this.#listeningPromise.then(() => this);\n\t}\n\tget url() {\n\t\tconst addr = this.node?.server?.address();\n\t\tif (!addr) return;\n\t\treturn typeof addr === \"string\" ? addr : fmtURL(addr.address, addr.port, this.#isSecure);\n\t}\n\tready() {\n\t\tthis.#listenErrorObserved = true;\n\t\tif (this.#listenError) return Promise.reject(this.#listenError);\n\t\treturn Promise.resolve(this.#listeningPromise).then(() => this);\n\t}\n\tasync close(closeAll) {\n\t\tawait Promise.all([this.#wait?.wait(), new Promise((resolve, reject) => {\n\t\t\tconst server = this.node?.server;\n\t\t\tif (server && closeAll && \"closeAllConnections\" in server) server.closeAllConnections();\n\t\t\tif (!server || !server.listening) return resolve();\n\t\t\tserver.close((error) => error ? reject(error) : resolve());\n\t\t})]);\n\t}\n};\nexport { NodeResponse as FastResponse, FastURL, NodeRequest, NodeResponse, fetchNodeHandler, patchGlobalRequest, sendNodeResponse, serve, toFetchHandler, toNodeHandler };\n","/**\n * Stack trace frame classifier — categorizes stack frames by origin.\n *\n * Provides `classifyFrame` (single frame) and `classifyStack` (full stack\n * string) as the shared primitives used by the error page, terminal\n * formatter, and overlay.\n *\n * Dev-only: this module is only imported by other dev-tools modules.\n */\n\n// ─── Types ──────────────────────────────────────────────────────────────────\n\nexport type FrameType = 'app' | 'framework' | 'internal';\n\nexport interface ClassifiedFrame {\n raw: string;\n type: FrameType;\n file?: string;\n line?: number;\n col?: number;\n}\n\n// ─── Frame Parsing ──────────────────────────────────────────────────────────\n\n/** Parse file/line/col from a stack frame line. */\nfunction parseFrame(frameLine: string): { file?: string; line?: number; col?: number } {\n const parenMatch = /\\(([^)]+):(\\d+):(\\d+)\\)/.exec(frameLine);\n if (parenMatch) {\n return { file: parenMatch[1], line: Number(parenMatch[2]), col: Number(parenMatch[3]) };\n }\n const bareMatch = /at (\\/[^:]+):(\\d+):(\\d+)/.exec(frameLine);\n if (bareMatch) {\n return { file: bareMatch[1], line: Number(bareMatch[2]), col: Number(bareMatch[3]) };\n }\n return {};\n}\n\n// ─── Classification ─────────────────────────────────────────────────────────\n\n/**\n * Classify a single stack frame line by origin.\n *\n * - 'app': user application code (in project root, not node_modules)\n * - 'framework': timber-app internal code\n * - 'internal': node_modules, Node.js internals\n */\nexport function classifyFrame(frameLine: string, projectRoot: string): FrameType {\n const trimmed = frameLine.trim();\n\n if (trimmed.includes('packages/timber-app/')) return 'framework';\n if (trimmed.includes('node_modules/')) return 'internal';\n if (trimmed.startsWith('at node:') || trimmed.includes('(node:')) return 'internal';\n if (trimmed.includes(projectRoot)) return 'app';\n\n return 'internal';\n}\n\n/**\n * Classify all frames in a full stack trace string.\n *\n * Parses the stack, skips the first line (error message), filters to\n * lines starting with \"at \", and returns classified frames with optional\n * file/line/col metadata.\n */\nexport function classifyStack(stack: string, projectRoot: string): ClassifiedFrame[] {\n return stack\n .split('\\n')\n .slice(1) // skip first line (error message)\n .filter((line) => line.trim().startsWith('at '))\n .map((raw) => {\n const type = classifyFrame(raw, projectRoot);\n const { file, line, col } = parseFrame(raw);\n return { raw, type, file, line, col };\n });\n}\n","/**\n * Terminal error formatting — boxed, color-coded error output for dev mode.\n *\n * Produces a visually scannable error block with:\n * - Unicode box-drawing border around the error\n * - Phase badge and error message\n * - First app frame highlighted as the primary action item\n * - OSC 8 clickable file:line links (VSCode terminal, iTerm2, etc.)\n * - Internal/framework frames collapsed with a count\n * - Component stack (for React render errors)\n *\n * Dev-only: this module is only imported by dev-error-overlay.ts.\n *\n * Design doc: 21-dev-server.md §\"Error Overlay\"\n */\n\nimport { pathToFileURL } from 'node:url';\nimport type { InspectColor } from 'node:util';\nimport { styleText } from 'node:util';\nimport {\n extractComponentStack,\n parseFirstAppFrame,\n PHASE_LABELS,\n type ErrorPhase,\n} from './overlay.ts';\nimport { classifyStack } from './stack-classifier.ts';\n\n// ─── Styling ────────────────────────────────────────────────────────────────\n\ntype Format = InspectColor | readonly InspectColor[];\nconst noValidate = { validateStream: false } as const;\nconst style = (fmt: Format, text: string) => styleText(fmt, text, noValidate);\n\n// ─── OSC 8 Hyperlinks ──────────────────────────────────────────────────────\n\n/**\n * Wrap text in an OSC 8 hyperlink escape sequence.\n *\n * Terminals that support OSC 8 (VSCode, iTerm2, Windows Terminal, etc.)\n * render this as a clickable link. Others ignore the escape sequences\n * and show the text normally.\n *\n * Format: \\x1b]8;;URL\\x07TEXT\\x1b]8;;\\x07\n */\nfunction hyperlink(text: string, url: string): string {\n return `\\x1b]8;;${url}\\x07${text}\\x1b]8;;\\x07`;\n}\n\n/**\n * Format a file:line:col reference as a clickable terminal link.\n *\n * Uses file:// URLs so terminals open the file in the configured editor.\n * The link text is styled with cyan + underline for visibility.\n */\nfunction fileLink(filePath: string, line?: number, col?: number): string {\n const display = line ? `${filePath}:${line}${col ? `:${col}` : ''}` : filePath;\n // Use pathToFileURL for proper encoding of spaces, #, ?, and Windows\n // drive letters (TIM-792). Append :line:col after the URL.\n const base = pathToFileURL(filePath).href;\n const url = line ? `${base}:${line}${col ? `:${col}` : ''}` : base;\n return style(['cyan', 'underline'], hyperlink(display, url));\n}\n\n// ─── Box Drawing ────────────────────────────────────────────────────────────\n\nconst BOX = {\n topLeft: '╭',\n topRight: '╮',\n bottomLeft: '╰',\n bottomRight: '╯',\n horizontal: '─',\n vertical: '│',\n};\n\n/**\n * Wrap lines of text in a Unicode box with a colored left border.\n *\n * @param lines - Content lines (no ANSI length calculation — keeps it simple)\n * @param width - Box width (characters). Lines longer than this are not truncated.\n */\nfunction box(lines: string[], borderFormat: Format, width = 80): string {\n const bar = BOX.horizontal.repeat(width - 2);\n const output: string[] = [];\n\n output.push(style(borderFormat, `${BOX.topLeft}${bar}${BOX.topRight}`));\n for (const line of lines) {\n output.push(`${style(borderFormat, BOX.vertical)} ${line}`);\n }\n output.push(style(borderFormat, `${BOX.bottomLeft}${bar}${BOX.bottomRight}`));\n\n return output.join('\\n');\n}\n\n// Frame classification and parsing provided by stack-classifier.ts\n\n// ─── Public API ─────────────────────────────────────────────────────────────\n\n/**\n * Format an error for terminal output with a boxed layout.\n *\n * The output is designed to be scannable at a glance:\n * 1. Red box with phase badge and error message\n * 2. First app frame as a clickable link (the primary action item)\n * 3. App frames listed normally\n * 4. Internal/framework frames collapsed with count\n * 5. Component stack (if present)\n */\nexport function formatTerminalError(error: Error, phase: ErrorPhase, projectRoot: string): string {\n const sections: string[] = [];\n const componentStack = extractComponentStack(error);\n const loc = parseFirstAppFrame(error.stack ?? '', projectRoot);\n const frames = error.stack ? classifyStack(error.stack, projectRoot) : [];\n const appFrames = frames.filter((f) => f.type === 'app');\n const internalCount = frames.filter((f) => f.type !== 'app').length;\n\n // ── Box: Phase + Message ──────────────────────────────────────────\n const boxLines: string[] = [];\n boxLines.push(style(['red', 'bold'], `${PHASE_LABELS[phase]} Error`));\n boxLines.push('');\n\n // Error message — may be multi-line\n for (const msgLine of error.message.split('\\n')) {\n boxLines.push(style('red', msgLine));\n }\n\n // Primary file location (clickable)\n if (loc) {\n boxLines.push('');\n const relPath = loc.file.startsWith(projectRoot)\n ? loc.file.slice(projectRoot.length + 1)\n : loc.file;\n boxLines.push(\n `${style('bold', '→')} ${fileLink(loc.file, loc.line, loc.column)} ${style('dim', `(${relPath})`)}`\n );\n }\n\n sections.push(box(boxLines, 'red'));\n\n // ── Component Stack ───────────────────────────────────────────────\n if (componentStack) {\n sections.push('');\n sections.push(` ${style('bold', 'Component Stack:')}`);\n for (const csLine of componentStack.trim().split('\\n')) {\n sections.push(` ${style('dim', csLine.trim())}`);\n }\n }\n\n // ── App Frames ────────────────────────────────────────────────────\n if (appFrames.length > 0) {\n sections.push('');\n sections.push(` ${style('bold', 'Application Frames:')}`);\n for (let i = 0; i < appFrames.length; i++) {\n const f = appFrames[i]!;\n if (f.file && f.line) {\n const prefix = i === 0 ? style('bold', '▸') : ' ';\n sections.push(\n ` ${prefix} ${fileLink(f.file, f.line, f.col)} ${style('dim', extractFnName(f.raw))}`\n );\n } else {\n sections.push(` ${f.raw}`);\n }\n }\n }\n\n // ── Internal Frames (collapsed) ───────────────────────────────────\n if (internalCount > 0) {\n sections.push(\n ` ${style('dim', `… ${internalCount} internal frame${internalCount !== 1 ? 's' : ''} hidden`)}`\n );\n }\n\n sections.push('');\n return sections.join('\\n');\n}\n\n// ─── Helpers ────────────────────────────────────────────────────────────────\n\n/** Extract the function name from a stack frame line like \" at fnName (/path:1:2)\". */\nfunction extractFnName(frameLine: string): string {\n const match = /at\\s+(\\S+)\\s+\\(/.exec(frameLine.trim());\n return match ? match[1]! : '';\n}\n","/**\n * Dev error overlay — formats and sends errors to Vite's browser overlay and stderr.\n *\n * Integrates with Vite's built-in error overlay (`server.hot.send`) rather\n * than implementing a custom overlay.\n *\n * Stacks are shown as they arrive: Vite's module runner already reports\n * source positions for the code it runs, and a second mapping pass moves\n * them (TIM-1555).\n *\n * Design doc: 21-dev-server.md §\"Error Overlay\", §\"RSC Source-Mapping\"\n */\n\nimport type { ViteDevServer } from 'vite';\nimport { classifyFrame } from './stack-classifier.ts';\n\n// ─── Types ──────────────────────────────────────────────────────────────────\n\n/** The phase of the pipeline where the error occurred. */\nexport type ErrorPhase =\n | 'module-transform'\n | 'proxy'\n | 'middleware'\n | 'access'\n | 'render'\n | 'handler';\n\n/** Labels for terminal output. */\nexport const PHASE_LABELS: Record<ErrorPhase, string> = {\n 'module-transform': 'Module Transform',\n 'proxy': 'Proxy',\n 'middleware': 'Middleware',\n 'access': 'Access Check',\n 'render': 'RSC Render',\n 'handler': 'Route Handler',\n};\n\n// ─── Frame Classification (re-exported from stack-classifier) ───────────────\n\nexport {\n classifyFrame,\n classifyStack,\n type FrameType,\n type ClassifiedFrame,\n} from './stack-classifier.ts';\n\n// ─── Component Stack Extraction ─────────────────────────────────────────────\n\n/**\n * Extract the React component stack from an error, if present.\n * React attaches this as `componentStack` during renderToReadableStream errors.\n */\nexport function extractComponentStack(error: unknown): string | null {\n if (\n error &&\n typeof error === 'object' &&\n 'componentStack' in error &&\n typeof (error as Record<string, unknown>).componentStack === 'string'\n ) {\n return (error as Record<string, unknown>).componentStack as string;\n }\n return null;\n}\n\n// ─── First App Frame Parsing ────────────────────────────────────────────────\n\ninterface SourceLocation {\n file: string;\n line: number;\n column: number;\n}\n\n/**\n * Parse the first application frame from a stack trace.\n * Returns file/line/column for the overlay's `loc` field.\n */\nexport function parseFirstAppFrame(stack: string, projectRoot: string): SourceLocation | null {\n const lines = stack.split('\\n');\n // Match patterns like:\n // at functionName (/absolute/path:line:column)\n // at /absolute/path:line:column\n const parenRegex = /\\(([^)]+):(\\d+):(\\d+)\\)/;\n const bareRegex = /at (\\/[^:]+):(\\d+):(\\d+)/;\n\n for (const line of lines) {\n if (classifyFrame(line, projectRoot) !== 'app') continue;\n\n const match = parenRegex.exec(line) ?? bareRegex.exec(line);\n if (!match) continue;\n\n const [, file, lineNum, col] = match;\n if (file && lineNum && col) {\n return { file, line: parseInt(lineNum, 10), column: parseInt(col, 10) };\n }\n }\n\n return null;\n}\n\n// ─── Error Phase Classification ─────────────────────────────────────────────\n\n/**\n * Classify the error phase by inspecting the error's stack trace.\n * Falls back to 'render' if no specific phase can be determined.\n */\nexport function classifyErrorPhase(error: Error, projectRoot: string): ErrorPhase {\n const stack = error.stack ?? '';\n\n // Check for React component stack (render error)\n if (extractComponentStack(error)) return 'render';\n\n // Check for specific file patterns in app frames\n const appRoot = projectRoot.replace(/\\/$/, '');\n if (stack.includes(`${appRoot}/app/`) || stack.includes('/app/')) {\n if (stack.includes('/middleware.ts') || stack.includes('/middleware.js')) return 'middleware';\n if (stack.includes('/access.ts') || stack.includes('/access.js')) return 'access';\n if (stack.includes('/route.ts') || stack.includes('/route.js')) return 'handler';\n }\n\n return 'render';\n}\n\n// ─── Terminal Formatting ────────────────────────────────────────────────────\n\n// formatTerminalError is implemented in the dedicated terminal formatter module\n// (terminal.ts) to keep this file under 500 lines.\n// Import for use in sendErrorToOverlay, and re-export for external consumers.\nimport { formatTerminalError as _formatTerminalError } from './terminal.ts';\nexport const formatTerminalError = _formatTerminalError;\n\n// ─── Overlay Integration ────────────────────────────────────────────────────\n\n/**\n * Send an error to Vite's browser overlay and log it to stderr.\n *\n * Reads `error` and never writes it: the pipeline may render the same object\n * on the fallback error page after reporting it here.\n *\n * The dev server remains running — errors are handled, not fatal.\n */\nexport function sendErrorToOverlay(\n server: ViteDevServer,\n error: Error,\n phase: ErrorPhase,\n projectRoot: string\n): void {\n // Log to stderr with frame dimming\n const formatted = formatTerminalError(error, phase, projectRoot);\n process.stderr.write(`${formatted}\\n`);\n\n // Build overlay payload\n const loc = parseFirstAppFrame(error.stack ?? '', projectRoot);\n const componentStack = extractComponentStack(error);\n\n let message = error.message;\n if (componentStack) {\n message = `${error.message}\\n\\nComponent Stack:\\n${componentStack.trim()}`;\n }\n\n // Send to browser via Vite's error overlay protocol\n try {\n server.hot.send({\n type: 'error',\n err: {\n message,\n stack: error.stack ?? '',\n id: loc?.file,\n plugin: `timber (${PHASE_LABELS[phase]})`,\n loc: loc ? { file: loc.file, line: loc.line, column: loc.column } : undefined,\n },\n });\n } catch (e) {\n console.debug('[timber] overlay error send failed:', e instanceof Error ? e.message : e);\n }\n}\n","/**\n * Shared HTML escaping utility.\n *\n * Used by both dev-only paths (error pages, 404 page) and production\n * paths (deny-renderer, RSC helpers). Lives in server/utils/ because\n * it's not dev-only.\n */\n\n/**\n * Escape a string for safe embedding in HTML content or attributes.\n *\n * Replaces `&`, `<`, `>`, and `\"` with their HTML entity equivalents.\n */\nexport function escapeHtml(str: string): string {\n return str\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n","/**\n * Shared scaffold for dev-mode HTML pages (dev error page, dev 404 page).\n *\n * Both pages are self-contained HTML documents served when the normal\n * render pipeline can't produce a page. They share:\n * - The document scaffold (head, container, footer)\n * - Base CSS (layout, light/dark variables, common components)\n * - The HMR auto-reload script that watches Vite's WebSocket and reloads\n * when the developer fixes the error / adds the missing route\n *\n * Dev-only: this module is only imported by dev-mode code paths. It is\n * never included in production builds.\n *\n * Design doc: 21-dev-server.md §\"Error Overlay\", §\"Dev 404 Page\"\n */\n\nimport { escapeHtml } from '../server/utils/escape-html.ts';\n\n// ─── HMR Options ────────────────────────────────────────────────────────────\n\n/**\n * HMR connection options for the dev page auto-reload WebSocket.\n * Derived from Vite's resolved server config so the page can connect\n * to the correct HMR endpoint (TIM-789).\n */\nexport interface DevErrorHmrOptions {\n protocol?: string;\n host?: string;\n port?: number;\n path?: string;\n token?: string;\n}\n\n/**\n * Hooks the dev server hands the RSC environment, which cannot read the\n * Vite server itself (separate module graph). The RSC entry exports\n * `setDevHooks()`; the dev server calls it after importing the entry.\n *\n * Declared here, not in the RSC entry, so the dev-server plugin can name\n * the type without pulling the RSC entry into its type graph.\n */\nexport interface DevHooks {\n /** Forwards a pipeline error to the browser error overlay. */\n onPipelineError?: (error: Error, phase: string) => void;\n /**\n * The resolved HMR endpoint for the auto-reload WebSocket on the dev 404\n * page and the fallback error page (TIM-1067).\n */\n hmrOptions?: DevErrorHmrOptions;\n}\n\n/**\n * Extract HMR connection options from a Vite resolved config.\n * Used by the dev server to pass HMR config to the dev page generators\n * so the auto-reload WebSocket connects to the correct endpoint.\n */\nexport function extractHmrOptions(config: {\n server?: {\n hmr?:\n | { protocol?: string; host?: string; port?: number; clientPort?: number; path?: string }\n | boolean;\n };\n webSocketToken?: string;\n}): DevErrorHmrOptions | undefined {\n const hmr = config.server?.hmr;\n if (hmr === false) return undefined;\n const hmrOpts = typeof hmr === 'object' ? hmr : {};\n const opts: DevErrorHmrOptions = {\n protocol: hmrOpts.protocol,\n host: hmrOpts.host,\n port: hmrOpts.clientPort || hmrOpts.port,\n path: hmrOpts.path,\n token: config.webSocketToken,\n };\n // If no HMR fields were explicitly configured, return undefined so the\n // reload script derives everything from the browser's location, which\n // correctly includes the current port (TIM-805).\n if (!opts.protocol && !opts.host && !opts.port && !opts.path && !opts.token) {\n return undefined;\n }\n return opts;\n}\n\n// ─── Auto-Reload Script ─────────────────────────────────────────────────────\n\n/**\n * Build the inline auto-reload script for dev pages.\n *\n * The page is static HTML, not a Vite-managed module, so the normal HMR\n * update flow can't reach it. Instead we connect to Vite's HMR WebSocket\n * directly and reload on any update event.\n *\n * URL construction mirrors Vite's own client.mjs: explicitly configured\n * values win, and the browser's location fills any gaps at runtime. This\n * matters because Vite 8 requires a `?token=` on browser WS upgrades in\n * every config — a config with only a token still needs the host and port\n * from `location` (TIM-1067).\n */\nexport function buildReloadScript(hmrOptions?: DevErrorHmrOptions): string {\n // `<` is escaped as a unicode escape so config text can never close the\n // <script> block (same defense as escJsonForScript in error-page.ts, TIM-788).\n const opts = JSON.stringify(hmrOptions ?? {}).replace(/</g, '\\\\u003c');\n return ` (function() {\n try {\n var o = ${opts};\n var protocol = o.protocol || (location.protocol === 'https:' ? 'wss' : 'ws');\n var host = o.host || location.hostname;\n var port = o.port || location.port;\n var url = protocol + '://' + host + (port ? ':' + port : '') + (o.path || '')\n + (o.token ? '?token=' + encodeURIComponent(o.token) : '');\n var ws = new WebSocket(url, 'vite-hmr');\n ws.addEventListener('message', function(e) {\n try {\n var data = JSON.parse(e.data);\n if (data.type === 'full-reload' || data.type === 'update') {\n location.reload();\n }\n } catch (ex) {}\n });\n } catch (ex) {}\n })();`;\n}\n\n// ─── Page Shell ─────────────────────────────────────────────────────────────\n\nexport interface DevPageShellOptions {\n /** Page title — escaped by the shell. */\n title: string;\n /** Page-specific CSS appended after the shared base (badge colors, etc.). */\n extraCss?: string;\n /** Inner HTML of the container — must already be escaped by the caller. */\n bodyHtml: string;\n /** Hint text shown next to the timber logo in the footer. */\n footerHint: string;\n /** Additional inline script placed before the auto-reload script. */\n extraScript?: string;\n /** HMR connection options for the auto-reload WebSocket. */\n hmrOptions?: DevErrorHmrOptions;\n}\n\n/**\n * Render a self-contained dev page: scaffold + shared CSS + footer +\n * HMR auto-reload script.\n */\nexport function renderDevPageShell(opts: DevPageShellOptions): string {\n return `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <title>${escapeHtml(opts.title)}</title>\n <style>${SHARED_CSS}${opts.extraCss ?? ''}</style>\n</head>\n<body>\n <div class=\"container\">\n ${opts.bodyHtml}\n\n <footer class=\"footer\">\n <span class=\"timber-logo\">🪵 timber.js</span>\n <span class=\"footer-hint\">${opts.footerHint}</span>\n </footer>\n </div>\n\n <script>\n${opts.extraScript ?? ''}\n // Auto-reload when Vite HMR signals an update (file fixed, route added).\n${buildReloadScript(opts.hmrOptions)}\n </script>\n</body>\n</html>`;\n}\n\n// ─── Shared CSS ─────────────────────────────────────────────────────────────\n\n/**\n * Base CSS shared by all dev pages. Pages override the --badge-* variables\n * (and add their own component styles) via `extraCss`.\n */\nconst SHARED_CSS = `\n :root {\n --bg: #fff;\n --fg: #1a1a1a;\n --fg-dim: #6b7280;\n --border: #e5e7eb;\n --source-bg: #fafafa;\n --link: #2563eb;\n --code-bg: #f3f4f6;\n --btn-bg: #f3f4f6;\n --btn-fg: #374151;\n --btn-border: #d1d5db;\n --code-font: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;\n }\n\n @media (prefers-color-scheme: dark) {\n :root {\n --bg: #0a0a0a;\n --fg: #f5f5f5;\n --fg-dim: #9ca3af;\n --border: #27272a;\n --source-bg: #18181b;\n --link: #60a5fa;\n --code-bg: #27272a;\n --btn-bg: #27272a;\n --btn-fg: #e5e7eb;\n --btn-border: #3f3f46;\n }\n }\n\n * { margin: 0; padding: 0; box-sizing: border-box; }\n\n body {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n background: var(--bg);\n color: var(--fg);\n line-height: 1.6;\n padding: 2rem;\n }\n\n .container { max-width: 56rem; margin: 0 auto; }\n .header { margin-bottom: 1.5rem; }\n\n .badge {\n display: inline-block;\n font-size: 0.75rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n padding: 0.25rem 0.625rem;\n border-radius: 0.375rem;\n background: var(--badge-bg);\n color: var(--badge-fg);\n border: 1px solid var(--badge-border);\n margin-bottom: 0.75rem;\n }\n\n .message {\n font-size: 1.375rem;\n font-weight: 600;\n line-height: 1.3;\n word-break: break-word;\n }\n\n .hint {\n margin-top: 0.5rem;\n color: var(--fg-dim);\n font-size: 0.875rem;\n }\n\n .section {\n margin-bottom: 1rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n overflow: hidden;\n }\n\n .section-header {\n font-size: 0.75rem;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n padding: 0.5rem 0.75rem;\n background: var(--source-bg);\n border-bottom: 1px solid var(--border);\n color: var(--fg-dim);\n }\n\n .footer {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n padding-top: 1rem;\n border-top: 1px solid var(--border);\n font-size: 0.75rem;\n color: var(--fg-dim);\n }\n\n .timber-logo { font-weight: 600; white-space: nowrap; }\n`;\n","/**\n * Dev error page — self-contained HTML error page for dev server 500s.\n *\n * Generates a styled, self-contained HTML page when the RSC pipeline fails\n * and the Vite error overlay can't fire (e.g., first page load before HMR\n * WebSocket connects, RSC entry module crash, early pipeline errors).\n *\n * This is NOT a replacement for Vite's error overlay — it's the fallback\n * for when the overlay's transport (WebSocket) isn't available yet.\n *\n * Dev-only: this module is only imported by dev-server.ts (apply: 'serve')\n * and via dynamic import from fallback-error.ts in dev mode. It is never\n * included in production builds.\n *\n * Design doc: 21-dev-server.md §\"Error Overlay\"\n */\n\nimport { readFileSync } from 'node:fs';\nimport { extractComponentStack, parseFirstAppFrame, type ErrorPhase } from './overlay.ts';\nimport { classifyStack } from './stack-classifier.ts';\nimport { escapeHtml } from '../server/utils/escape-html.ts';\nimport { renderDevPageShell, type DevErrorHmrOptions } from './dev-page-shell.ts';\n\n// ─── Phase Labels ───────────────────────────────────────────────────────────\n\nconst PHASE_LABELS: Record<ErrorPhase, string> = {\n 'module-transform': 'Module Transform',\n 'proxy': 'Proxy',\n 'middleware': 'Middleware',\n 'access': 'Access Check',\n 'render': 'RSC Render',\n 'handler': 'Route Handler',\n};\n\nconst PHASE_HINTS: Record<ErrorPhase, string> = {\n 'module-transform':\n 'This error occurred while Vite was transforming a module. Check for syntax errors or missing imports.',\n 'proxy': 'This error occurred in proxy.ts. Check your proxy configuration.',\n 'middleware':\n 'This error occurred in a middleware.ts file. Check the middleware function for unhandled exceptions.',\n 'access': 'This error occurred in an access.ts file. Check your access control logic.',\n 'render':\n 'This error occurred while rendering a server component. Check the component for runtime errors.',\n 'handler': 'This error occurred in a route handler (route.ts). Check the handler function.',\n};\n\n// ─── Source Context ─────────────────────────────────────────────────────────\n\n/**\n * Try to read a few lines of source code around the error location.\n * Returns null if the file can't be read (e.g., virtual modules).\n *\n * Uses a top-level `node:fs` import — this module is dev-server-only and\n * Node-only. A bare `require()` here would throw in the ESM build and the\n * code frame would silently never render (TIM-1067, B48).\n */\nfunction readSourceContext(\n filePath: string,\n line: number,\n contextLines = 3\n): { lines: Array<{ num: number; text: string; highlight: boolean }>; startLine: number } | null {\n try {\n const content = readFileSync(filePath, 'utf-8');\n const allLines = content.split('\\n');\n\n const start = Math.max(0, line - 1 - contextLines);\n const end = Math.min(allLines.length, line + contextLines);\n\n return {\n startLine: start + 1,\n lines: allLines.slice(start, end).map((text: string, i: number) => ({\n num: start + 1 + i,\n text,\n highlight: start + 1 + i === line,\n })),\n };\n } catch (e) {\n console.debug('[timber] source context extraction failed:', e instanceof Error ? e.message : e);\n return null;\n }\n}\n\n// HTML escaping provided by server/utils/escape-html.ts\nconst esc = escapeHtml;\n\n/**\n * Escape a JSON string for safe embedding in an HTML `<script>` block.\n *\n * `JSON.stringify` does not escape `</script>`, so error text containing\n * that sequence breaks out of the script block — an XSS vector.\n * We replace all `<` with the equivalent unicode escape, which is valid in\n * JSON strings and prevents the HTML parser from seeing a closing\n * `</script>` tag.\n *\n * Security: TIM-788\n */\nfunction escJsonForScript(json: string): string {\n return json.replace(/</g, '\\\\u003c');\n}\n\n// ─── HTML Generation ────────────────────────────────────────────────────────\n\n/**\n * Generate a self-contained HTML error page for dev server 500 responses.\n *\n * The page includes:\n * - Error message and phase label\n * - Source code context around the first app frame (if readable)\n * - Component stack (for React render errors)\n * - Classified stack trace (app frames highlighted, internals collapsed)\n * - Copy button for the full error\n * - Dark/light mode via prefers-color-scheme\n * - Auto-reconnect script that watches for Vite HMR and reloads\n */\nexport function generateDevErrorPage(\n error: Error,\n phase: ErrorPhase,\n projectRoot: string,\n hmrOptions?: DevErrorHmrOptions\n): string {\n const message = error.message || 'Unknown error';\n const phaseLabel = PHASE_LABELS[phase];\n const phaseHint = PHASE_HINTS[phase];\n const componentStack = extractComponentStack(error);\n const loc = parseFirstAppFrame(error.stack ?? '', projectRoot);\n const frames = error.stack ? classifyStack(error.stack, projectRoot) : [];\n const appFrames = frames.filter((f) => f.type === 'app');\n const internalFrameCount = frames.filter((f) => f.type !== 'app').length;\n\n // Try to read source code context\n let sourceContext: ReturnType<typeof readSourceContext> = null;\n if (loc) {\n sourceContext = readSourceContext(loc.file, loc.line);\n }\n\n // Relative path for display\n const relPath = loc?.file.startsWith(projectRoot)\n ? loc.file.slice(projectRoot.length + 1)\n : loc?.file;\n\n const bodyHtml = `<header class=\"header\">\n <div class=\"badge\">${esc(phaseLabel)} Error</div>\n <h1 class=\"message\">${esc(message)}</h1>\n ${phaseHint ? `<p class=\"hint\">${esc(phaseHint)}</p>` : ''}\n </header>\n\n ${relPath ? `<div class=\"location\">${esc(relPath)}${loc ? `:${loc.line}:${loc.column}` : ''}</div>` : ''}\n\n ${\n sourceContext\n ? `<div class=\"source-context\">\n <div class=\"section-header\">Source</div>\n <pre class=\"source-code\"><code>${sourceContext.lines\n .map(\n (l) =>\n `<span class=\"source-line${l.highlight ? ' source-line-highlight' : ''}\"` +\n `><span class=\"line-num\">${l.num}</span>${esc(l.text)}</span>`\n )\n .join('\\n')}</code></pre>\n </div>`\n : ''\n }\n\n ${\n componentStack\n ? `<div class=\"section\">\n <div class=\"section-header\">Component Stack</div>\n <pre class=\"component-stack\">${esc(componentStack.trim())}</pre>\n </div>`\n : ''\n }\n\n ${\n appFrames.length > 0\n ? `<div class=\"section\">\n <div class=\"section-header\">Application Frames</div>\n <pre class=\"stack\">${appFrames.map((f) => esc(f.raw)).join('\\n')}</pre>\n </div>`\n : ''\n }\n\n ${\n internalFrameCount > 0\n ? `<details class=\"section internal-frames\">\n <summary class=\"section-header clickable\">${internalFrameCount} internal frame${internalFrameCount !== 1 ? 's' : ''}</summary>\n <pre class=\"stack dimmed\">${frames\n .filter((f) => f.type !== 'app')\n .map((f) => esc(f.raw))\n .join('\\n')}</pre>\n </details>`\n : ''\n }\n\n <div class=\"actions\">\n <button class=\"btn\" onclick=\"copyError()\">Copy Error</button>\n </div>`;\n\n const copyScript = ` function copyError() {\n var text = ${escJsonForScript(\n JSON.stringify(\n `${phaseLabel} Error: ${message}\\n\\n` +\n (relPath ? `File: ${relPath}${loc ? `:${loc.line}:${loc.column}` : ''}\\n\\n` : '') +\n (componentStack ? `Component Stack:\\n${componentStack.trim()}\\n\\n` : '') +\n `Stack Trace:\\n${error.stack ?? ''}`\n )\n )};\n navigator.clipboard.writeText(text).then(function() {\n var btn = document.querySelector('.btn');\n if (btn) { btn.textContent = 'Copied!'; setTimeout(function() { btn.textContent = 'Copy Error'; }, 1500); }\n });\n }\n`;\n\n return renderDevPageShell({\n title: `Error — ${phaseLabel} | timber.js`,\n extraCss: ERROR_CSS,\n bodyHtml,\n footerHint: 'Fix the error and save — the page will reload automatically via HMR.',\n extraScript: copyScript,\n hmrOptions,\n });\n}\n\n// ─── Page-Specific CSS ──────────────────────────────────────────────────────\n\nconst ERROR_CSS = `\n :root {\n --badge-bg: #fef2f2;\n --badge-fg: #991b1b;\n --badge-border: #fecaca;\n --highlight-bg: #fef2f2;\n --highlight-border: #ef4444;\n --line-num: #9ca3af;\n }\n\n @media (prefers-color-scheme: dark) {\n :root {\n --badge-bg: #450a0a;\n --badge-fg: #fca5a5;\n --badge-border: #7f1d1d;\n --highlight-bg: #450a0a;\n --highlight-border: #dc2626;\n --line-num: #6b7280;\n }\n }\n\n .location {\n font-family: var(--code-font);\n font-size: 0.8125rem;\n color: var(--link);\n margin-bottom: 1rem;\n padding: 0.5rem 0.75rem;\n background: var(--source-bg);\n border-radius: 0.375rem;\n border: 1px solid var(--border);\n }\n\n .source-context {\n margin-bottom: 1rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n overflow: hidden;\n }\n\n .source-code {\n overflow-x: auto;\n font-family: var(--code-font);\n font-size: 0.8125rem;\n line-height: 1.7;\n padding: 0;\n margin: 0;\n }\n\n .source-code code {\n display: block;\n }\n\n .source-line {\n display: block;\n padding: 0 0.75rem;\n border-left: 3px solid transparent;\n }\n\n .source-line-highlight {\n background: var(--highlight-bg);\n border-left-color: var(--highlight-border);\n }\n\n .line-num {\n display: inline-block;\n width: 3rem;\n text-align: right;\n margin-right: 1rem;\n color: var(--line-num);\n user-select: none;\n }\n\n .clickable { cursor: pointer; }\n .clickable:hover { background: var(--btn-bg); }\n\n .component-stack, .stack {\n font-family: var(--code-font);\n font-size: 0.8125rem;\n line-height: 1.7;\n padding: 0.75rem;\n overflow-x: auto;\n white-space: pre;\n margin: 0;\n }\n\n .dimmed { color: var(--fg-dim); }\n\n .actions {\n margin: 1.5rem 0;\n }\n\n .btn {\n font-family: inherit;\n font-size: 0.8125rem;\n font-weight: 500;\n padding: 0.5rem 1rem;\n border-radius: 0.375rem;\n border: 1px solid var(--btn-border);\n background: var(--btn-bg);\n color: var(--btn-fg);\n cursor: pointer;\n transition: background 0.15s;\n }\n\n .btn:hover { opacity: 0.85; }\n`;\n","/**\n * Config validation — validates timber.config.ts at startup.\n *\n * Runs in the plugin's configResolved hook (once, at startup/build).\n * Each check produces a clear error message with the invalid value,\n * what's expected, and how to fix it.\n *\n * Design doc: 18-build-system.md\n */\n\nimport { createRequire } from 'node:module';\nimport type { TimberUserConfig } from './config-types.ts';\nimport { DEFAULT_RENDER_TIMEOUT_MS, RENDER_TIMEOUT_CEILING_MS } from './server/render-timeout.ts';\n\n// ─── Types ──────────────────────────────────────────────────────────────────\n\nexport interface ConfigError {\n field: string;\n message: string;\n value?: unknown;\n suggestion?: string;\n /**\n * Refuse to start rather than log. Most config errors only warn — Vite may\n * still work partially — but a fatal one would leave a security check\n * running on a value the developer did not mean (`allowedOrigins`).\n */\n fatal?: true;\n}\n\n// ─── Known config keys ──────────────────────────────────────────────────────\n\n// `satisfies Record<keyof TimberUserConfig, true>` makes this drift-proof:\n// adding a key to TimberUserConfig without listing it here is a compile\n// error, so validateConfig can never reject a documented option (TIM-1066).\nconst KNOWN_CONFIG_KEYS = {\n output: true,\n debug: true,\n clientJavascript: true,\n adapter: true,\n allowedOrigins: true,\n csrf: true,\n limits: true,\n forms: true,\n pageExtensions: true,\n slowRequestMs: true,\n renderTimeoutMs: true,\n devBrowserLogs: true,\n dev: true,\n serverTiming: true,\n appDir: true,\n mdx: true,\n actionEncryption: true,\n reactCompiler: true,\n sitemap: true,\n buildDir: true,\n cache: true,\n clientSegmentCache: true,\n topLoader: true,\n budget: true,\n} satisfies Record<keyof TimberUserConfig, true>;\n\nconst knownKeys = new Set<string>(Object.keys(KNOWN_CONFIG_KEYS));\n\n// ─── Validation ─────────────────────────────────────────────────────────────\n\n/**\n * Validate a TimberUserConfig object.\n *\n * Returns an array of errors. Empty array means the config is valid.\n * Does not throw — the caller decides how to surface errors.\n */\nexport function validateConfig(config: TimberUserConfig): ConfigError[] {\n const errors: ConfigError[] = [];\n\n // output\n if (config.output !== undefined && config.output !== 'server' && config.output !== 'static') {\n errors.push({\n field: 'output',\n message: `Invalid output mode: \"${String(config.output)}\". Must be \"server\" or \"static\".`,\n value: config.output,\n suggestion: 'Use output: \"server\" (default) or output: \"static\" for static site generation.',\n });\n }\n\n // pageExtensions\n if (config.pageExtensions !== undefined) {\n if (!Array.isArray(config.pageExtensions)) {\n errors.push({\n field: 'pageExtensions',\n message: 'pageExtensions must be an array of strings.',\n value: config.pageExtensions,\n suggestion: 'Example: pageExtensions: [\"tsx\", \"ts\", \"jsx\", \"js\", \"mdx\"]',\n });\n } else {\n for (const ext of config.pageExtensions) {\n if (typeof ext !== 'string') {\n errors.push({\n field: 'pageExtensions',\n message: `pageExtensions contains a non-string value: ${JSON.stringify(ext)}`,\n value: ext,\n });\n break;\n }\n if (ext.startsWith('.')) {\n errors.push({\n field: 'pageExtensions',\n message: `pageExtensions should not include the leading dot: \"${ext}\"`,\n value: ext,\n suggestion: `Use \"${ext.slice(1)}\" instead of \"${ext}\".`,\n });\n break;\n }\n }\n }\n }\n\n // allowedOrigins\n if (config.allowedOrigins !== undefined) {\n if (!Array.isArray(config.allowedOrigins)) {\n errors.push({\n field: 'allowedOrigins',\n message: 'allowedOrigins must be an array of origin strings.',\n value: config.allowedOrigins,\n fatal: true,\n suggestion: 'Example: allowedOrigins: [\"https://app.example.com\"]',\n });\n } else {\n for (const entry of config.allowedOrigins) {\n const error = allowedOriginError(entry);\n if (error) errors.push(error);\n }\n }\n }\n\n // slowRequestMs\n if (config.slowRequestMs !== undefined) {\n if (typeof config.slowRequestMs !== 'number' || config.slowRequestMs < 0) {\n errors.push({\n field: 'slowRequestMs',\n message: `slowRequestMs must be a non-negative number (got ${JSON.stringify(config.slowRequestMs)}).`,\n value: config.slowRequestMs,\n suggestion: 'Use slowRequestMs: 3000 (default) or slowRequestMs: 0 to disable.',\n });\n }\n }\n\n // renderTimeoutMs\n if (config.renderTimeoutMs !== undefined) {\n if (typeof config.renderTimeoutMs !== 'number' || config.renderTimeoutMs < 0) {\n errors.push({\n field: 'renderTimeoutMs',\n message: `renderTimeoutMs must be a non-negative number (got ${JSON.stringify(config.renderTimeoutMs)}).`,\n value: config.renderTimeoutMs,\n suggestion: `Use renderTimeoutMs: ${DEFAULT_RENDER_TIMEOUT_MS} (default). Setting 0 uses a ${RENDER_TIMEOUT_CEILING_MS / 1000}s safety ceiling.`,\n });\n }\n }\n\n // serverTiming\n if (config.serverTiming !== undefined) {\n if (\n config.serverTiming !== 'detailed' &&\n config.serverTiming !== 'total' &&\n config.serverTiming !== false\n ) {\n errors.push({\n field: 'serverTiming',\n message: `Invalid serverTiming value: ${JSON.stringify(config.serverTiming)}.`,\n value: config.serverTiming,\n suggestion: 'Use \"detailed\", \"total\", or false.',\n });\n }\n }\n\n // devBrowserLogs\n if (config.devBrowserLogs !== undefined) {\n const valid = ['error', 'warn', 'info', 'none'];\n if (!valid.includes(config.devBrowserLogs)) {\n errors.push({\n field: 'devBrowserLogs',\n message: `Invalid devBrowserLogs value: ${JSON.stringify(config.devBrowserLogs)}.`,\n value: config.devBrowserLogs,\n suggestion: `Use one of: ${valid.map((v) => `\"${v}\"`).join(', ')}.`,\n });\n }\n }\n\n // sitemap\n if (config.sitemap != null && typeof config.sitemap === 'object') {\n if (config.sitemap.enabled && !config.sitemap.baseUrl) {\n errors.push({\n field: 'sitemap.baseUrl',\n message: 'sitemap.baseUrl is required when sitemap is enabled.',\n suggestion: 'Add sitemap: { enabled: true, baseUrl: \"https://example.com\" }.',\n });\n }\n if (\n config.sitemap.defaultPriority !== undefined &&\n (config.sitemap.defaultPriority < 0 || config.sitemap.defaultPriority > 1)\n ) {\n errors.push({\n field: 'sitemap.defaultPriority',\n message: `sitemap.defaultPriority must be between 0.0 and 1.0 (got ${config.sitemap.defaultPriority}).`,\n value: config.sitemap.defaultPriority,\n });\n }\n }\n\n // budget\n if (config.budget != null && typeof config.budget === 'object') {\n if (\n config.budget.firstLoadJs !== undefined &&\n (typeof config.budget.firstLoadJs !== 'number' || config.budget.firstLoadJs <= 0)\n ) {\n errors.push({\n field: 'budget.firstLoadJs',\n message: `budget.firstLoadJs must be a positive number in bytes (got ${JSON.stringify(config.budget.firstLoadJs)}).`,\n value: config.budget.firstLoadJs,\n suggestion: 'Example: budget: { firstLoadJs: 150_000 } for a ~150 kB limit.',\n });\n }\n }\n\n // cache\n if (config.cache != null && typeof config.cache === 'object') {\n if (\n config.cache.strictKeyDiscipline !== undefined &&\n typeof config.cache.strictKeyDiscipline !== 'boolean'\n ) {\n errors.push({\n field: 'cache.strictKeyDiscipline',\n message: `cache.strictKeyDiscipline must be a boolean (got ${JSON.stringify(config.cache.strictKeyDiscipline)}).`,\n value: config.cache.strictKeyDiscipline,\n suggestion:\n 'Use cache: { strictKeyDiscipline: true } to promote key-discipline warnings to errors.',\n });\n }\n }\n\n const MOVED_TO_CACHE_FILE = new Set(['cacheHandler', 'cdnPurge']);\n\n for (const key of Object.keys(config)) {\n if (!knownKeys.has(key)) {\n errors.push({\n field: key,\n message: `Unknown config option: \"${key}\".`,\n suggestion: MOVED_TO_CACHE_FILE.has(key)\n ? `\"${key}\" has moved to timber.cache.ts. Export cacheHandler as default, cdnPurge as a named export.`\n : `Check for typos. Known options: ${[...knownKeys].sort().join(', ')}.`,\n });\n }\n }\n\n return errors;\n}\n\n/**\n * Why one `allowedOrigins` entry can never match, or null when it can.\n *\n * The CSRF check compares entries to the request's `Origin` header by\n * exact string, and browsers send only the canonical form — scheme, host,\n * and non-default port, lowercased, no path. So an entry that is not its\n * own `new URL(x).origin` (`https://example.com/`, `https://Example.com`,\n * `example.com`) silently matches nothing. `\"null\"` is refused outright:\n * it is the `Origin` of every opaque context at once.\n */\nfunction allowedOriginError(entry: unknown): ConfigError | null {\n const field = 'allowedOrigins';\n const fatal = true;\n if (typeof entry !== 'string') {\n return {\n field,\n message: `allowedOrigins contains a non-string value: ${JSON.stringify(entry)}.`,\n value: entry,\n fatal,\n };\n }\n if (entry === 'null') {\n return {\n field,\n message:\n 'allowedOrigins cannot contain \"null\". Browsers send Origin: null from every opaque ' +\n \"context — sandboxed iframes (an attacker's <iframe sandbox> included), POSTs \" +\n 'redirected across origins, and file: pages — so allowing it allows all of them.',\n value: entry,\n suggestion:\n 'To accept a cross-site POST on one endpoint, handle it in a route.ts that exports ' +\n '`const csrf = false` instead.',\n fatal,\n };\n }\n // `new URL('https://*.example.com').origin` round-trips, so the canonical\n // check alone would accept a wildcard that matches no real Origin.\n if (entry.includes('*')) {\n return {\n field,\n message: `allowedOrigins entry ${JSON.stringify(entry)} uses a wildcard. Matching is exact; wildcards are not supported.`,\n value: entry,\n suggestion:\n 'List each origin, e.g. [\"https://app.example.com\", \"https://admin.example.com\"].',\n fatal,\n };\n }\n const canonical = canonicalOrigin(entry) ?? canonicalOrigin(`https://${entry}`);\n if (canonical === entry) return null;\n return {\n field,\n message: `allowedOrigins entry ${JSON.stringify(entry)} is not a canonical origin, so it can never match a request's Origin header.`,\n value: entry,\n suggestion: canonical\n ? `Did you mean \"${canonical}\"? An origin is scheme://host[:port] — lowercase, no path or trailing slash.`\n : 'An origin is scheme://host[:port], e.g. \"https://app.example.com\".',\n fatal,\n };\n}\n\n/** `new URL(x).origin` for an http(s) URL, or null. Opaque origins are not origins here. */\nfunction canonicalOrigin(value: string): string | null {\n try {\n const url = new URL(value);\n return url.protocol === 'http:' || url.protocol === 'https:' ? url.origin : null;\n } catch {\n return null;\n }\n}\n\n// ─── Formatting ─────────────────────────────────────────────────────────────\n\nconst RED = '\\x1b[31m';\nconst BOLD = '\\x1b[1m';\nconst DIM = '\\x1b[2m';\nconst RESET = '\\x1b[0m';\n\n/**\n * Format config errors for terminal output. Pass `color: false` for text\n * that goes into a thrown `Error` — escapes there reach CI logs and the\n * Vite overlay as raw bytes.\n */\nexport function formatConfigErrors(\n errors: ConfigError[],\n { color = true }: { color?: boolean } = {}\n): string {\n if (errors.length === 0) return '';\n const [red, bold, dim, reset] = color ? [RED, BOLD, DIM, RESET] : ['', '', '', ''];\n\n const lines: string[] = [];\n lines.push(\n `${red}${bold}[timber]${reset} ${red}${errors.length} config error${errors.length !== 1 ? 's' : ''} in timber.config.ts:${reset}`\n );\n\n for (const err of errors) {\n lines.push('');\n lines.push(` ${red}✗${reset} ${bold}${err.field}${reset}: ${err.message}`);\n if (err.suggestion) {\n lines.push(` ${dim}${err.suggestion}${reset}`);\n }\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Surface config errors at startup: non-fatal ones are written to stderr\n * (Vite may still work partially, and the message guides the fix); fatal\n * ones then stop startup with a thrown error. Non-fatal errors are written\n * first so a fatal one does not hide them.\n */\nexport function reportConfigErrors(\n errors: ConfigError[],\n write: (text: string) => void = (text) => process.stderr.write(text)\n): void {\n const warnings = errors.filter((e) => !e.fatal);\n if (warnings.length > 0) write(`${formatConfigErrors(warnings)}\\n\\n`);\n const fatal = errors.filter((e) => e.fatal);\n if (fatal.length > 0) throw new Error(formatConfigErrors(fatal, { color: false }));\n}\n\n// ─── Virtual Module Name Mapping ────────────────────────────────────────────\n\nconst VIRTUAL_MODULE_NAMES: Record<string, string> = {\n 'virtual:timber-rsc-entry': 'RSC entry (server component handler)',\n 'virtual:timber-ssr-entry': 'SSR entry (HTML renderer)',\n 'virtual:timber-browser-entry': 'Browser entry (client hydration)',\n 'virtual:timber-config': 'Runtime config (timber.config.ts)',\n 'virtual:timber-route-manifest': 'Route manifest (app/ file tree)',\n 'virtual:timber-instrumentation': 'Instrumentation (instrumentation.ts)',\n 'virtual:timber-cache-handler': 'Cache handler (timber.cache.ts)',\n 'virtual:timber-build-manifest': 'Build manifest (asset mapping)',\n};\n\n/**\n * Add timber-specific context to an error message that references virtual modules.\n *\n * If the error message contains a `virtual:timber-*` ID, appends a\n * human-readable explanation. Does not replace the original message.\n */\nexport function addVirtualModuleContext(errorMessage: string): string {\n for (const [id, name] of Object.entries(VIRTUAL_MODULE_NAMES)) {\n if (errorMessage.includes(id)) {\n return `${errorMessage}\\n\\n [timber] This error references \"${id}\" — timber's ${name}.\\n This is an internal module. The issue is likely in your app code or timber configuration.`;\n }\n }\n return errorMessage;\n}\n\n// ─── Peer Dependency Check ──────────────────────────────────────────────────\n\ninterface PeerDepResult {\n name: string;\n status: 'ok' | 'missing';\n}\n\n/**\n * Required (non-optional) peer dependencies that must be installed.\n */\nconst REQUIRED_PEERS = ['react', 'react-dom', '@vitejs/plugin-react', '@vitejs/plugin-rsc'];\n\n/**\n * Check that required peer dependencies are installed.\n *\n * Uses require.resolve with a try/catch — no fs scanning.\n * Returns only the missing packages.\n */\nexport function checkPeerDependencies(projectRoot: string): PeerDepResult[] {\n const results: PeerDepResult[] = [];\n\n // Use createRequire from the project root to resolve as the user would.\n // `createRequire` MUST be a top-level ESM import — inline `require('node:module')`\n // throws \"Dynamic require not supported\" in ESM and the catch below would\n // mark every peer as missing. Same class of bug as TIM-796.\n const userRequire = createRequire(`${projectRoot}/package.json`);\n\n for (const name of REQUIRED_PEERS) {\n try {\n userRequire.resolve(name);\n results.push({ name, status: 'ok' });\n } catch {\n results.push({ name, status: 'missing' });\n }\n }\n\n return results;\n}\n\n/**\n * Format missing peer dependencies as an actionable warning.\n */\nexport function formatMissingPeers(results: PeerDepResult[]): string {\n const missing = results.filter((r) => r.status === 'missing');\n if (missing.length === 0) return '';\n\n const names = missing.map((r) => r.name);\n const lines: string[] = [];\n lines.push(`${RED}${BOLD}[timber]${RESET} ${RED}Missing required dependencies:${RESET}`);\n lines.push('');\n for (const name of names) {\n lines.push(` ${RED}✗${RESET} ${name}`);\n }\n lines.push('');\n lines.push(` ${DIM}Install with:${RESET}`);\n lines.push(` ${BOLD}pnpm add ${names.join(' ')}${RESET}`);\n\n return lines.join('\\n');\n}\n","/**\n * graph-endpoint — `GET /__timber/graph` on the dev server.\n *\n * The fast path of design/47: when a dev server runs, the env module\n * graphs are already resident and classification is a lookup. Serves\n * the `timber graph` CLI (delegation lands with the fast-path ticket)\n * and the VS Code extension, which additionally needs push updates on\n * HMR — something a CLI cannot provide.\n *\n * Dev-only by construction: registered from the timber-dev-server\n * plugin, which is `apply: 'serve'`; production builds contain none of\n * this. Same JSON contract as the CLI, produced by the same\n * classification module (analyze/live-graph.ts → classify/chains/\n * poison-scan) — never a second implementation.\n *\n * Endpoint hygiene (§10): requests are validated against DNS rebinding\n * consistent with Vite's own dev-endpoint protections — the Host\n * header must be a localhost form or an allowed host (Vite's\n * `server.allowedHosts` semantics, including leading-dot suffix\n * entries), and a present Origin header must pass the same check. A\n * CLI probe sends no Origin and passes; a browser on an attacker's\n * page either fails the Host check (rebinding: Host is the attacker's\n * domain) or the Origin check (direct cross-origin fetch).\n *\n * Push channel: `timber:graph-update` custom HMR events, one per\n * project-source watcher event. The channel just emits — debounce is\n * the consumer's concern (design/47 §\"Dev-server endpoint\").\n *\n * Design docs: 47-module-environment-tooling.md §10, 21-dev-server.md.\n */\n\nimport type { ViteDevServer } from 'vite';\nimport { normalizePath } from 'vite';\nimport type { IncomingMessage, ServerResponse } from 'node:http';\nimport { realpath, stat } from 'node:fs/promises';\nimport { isIP } from 'node:net';\nimport { isAbsolute, join, relative, resolve } from 'node:path';\nimport type { PluginContext } from '../plugin-context.ts';\nimport { buildSourceExtensions, isScannableSourceFile } from '../analyze/scan.ts';\nimport { GRAPH_JSON_VERSION } from '../analyze/graph-cache.ts';\n\nexport const GRAPH_ENDPOINT_PATH = '/__timber/graph';\n\n/** HMR custom event name for graph-affecting file changes. */\nexport const GRAPH_UPDATE_EVENT = 'timber:graph-update';\n\n/**\n * Host-header allowlist check, ported branch-for-branch from Vite's\n * host-validation middleware (`isHostAllowedWithoutCache`) so this\n * endpoint's reachability matches the rest of the dev server:\n *\n * - `allowedHosts: true` allows everything\n * - a MISSING Host header is allowed (Vite parity — HTTP/1.0 probes)\n * - any IP-literal host is allowed (`vite --host` LAN access sends\n * `Host: 192.168.x.x:port`; rejecting it would 403 this endpoint\n * while every other dev route works)\n * - `localhost` and `*.localhost` are always allowed\n * - allowedHosts entries: exact match, or `.suffix` subdomain entries\n */\nexport function isAllowedGraphHost(\n hostHeader: string | undefined,\n allowedHosts: true | string[] | undefined\n): boolean {\n if (allowedHosts === true) return true;\n if (hostHeader === undefined) return true;\n // Strip the port: `localhost:3000`, `[::1]:3000`, bare `[::1]`.\n let host = hostHeader;\n const bracket = host.match(/^\\[([^\\]]+)\\](?::\\d+)?$/);\n if (bracket) {\n // Bracketed form is only valid for IPv6 literals.\n return isIP(bracket[1]) === 6;\n }\n const colon = host.lastIndexOf(':');\n if (colon !== -1) host = host.slice(0, colon);\n host = host.toLowerCase();\n if (isIP(host) !== 0) return true;\n if (host === 'localhost' || host.endsWith('.localhost')) return true;\n for (const entry of allowedHosts ?? []) {\n const allowed = entry.toLowerCase();\n if (allowed.startsWith('.')) {\n if (host === allowed.slice(1) || host.endsWith(allowed)) return true;\n } else if (host === allowed) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Non-http(s) origins admitted without a host check: Vite's own\n * `file:` / `*-extension:` set (its host-validation regex), plus\n * `vscode-webview:` — VS Code webviews fetch with that Origin, and the\n * extension is this endpoint's primary consumer. Vite itself never\n * origin-checks plain HTTP GETs (only WebSocket upgrades), so this\n * layer is strictly additional; the additions keep it from rejecting\n * consumers Vite would serve.\n *\n * NOT admitted: `Origin: null`. Browsers serialize file:// pages'\n * opaque origin as the literal string `null` — but so do sandboxed\n * iframes and data: documents, exactly the untrusted embedders the\n * check exists to stop, and the header offers nothing to tell them\n * apart. file:// pages therefore cannot use this endpoint from a\n * browser; the `file:` scheme entry covers non-browser clients that\n * send a real scheme-form Origin (Vite admits the same set).\n */\nconst TRUSTED_ORIGIN_SCHEMES = /^(?:file|vscode-webview|.+-extension):/i;\n\n/** Origin check: absent is fine (CLI probe); present must pass the host allowlist. */\nexport function isAllowedGraphOrigin(\n originHeader: string | undefined,\n allowedHosts: true | string[] | undefined\n): boolean {\n if (originHeader === undefined) return true;\n if (TRUSTED_ORIGIN_SCHEMES.test(originHeader)) return true;\n let originUrl: URL;\n try {\n originUrl = new URL(originHeader);\n } catch {\n return false;\n }\n // An http(s) origin has a real host — hold it to the host allowlist,\n // NOT to the missing-Host leniency above (an Origin header is never\n // \"missing\" once present; an empty host must fail).\n if (originUrl.host === '') return false;\n // IP-literal leniency applies to the request's HOST header (LAN dev\n // access), never to Origin: a hostile page at http://203.0.113.10\n // sends that IP as its Origin, and admitting it (plus reflected\n // CORS) would let it read the whole module graph. Only loopback IP\n // origins pass; other IPs need an allowedHosts entry. (A developer\n // browsing the app over LAN fetches same-origin, which sends no\n // Origin header on GET — unaffected.)\n const bareHost = originUrl.hostname.replace(/^\\[|\\]$/g, '');\n if (isIP(bareHost) !== 0) {\n if (bareHost === '127.0.0.1' || bareHost === '::1') return true;\n if (allowedHosts === true) return true;\n return (allowedHosts ?? []).some((entry) => entry.toLowerCase() === bareHost);\n }\n return isAllowedGraphHost(originUrl.host, allowedHosts);\n}\n\nfunction sendJson(res: ServerResponse, status: number, body: unknown): void {\n res.statusCode = status;\n res.setHeader('content-type', 'application/json; charset=utf-8');\n res.end(JSON.stringify(body));\n}\n\n/**\n * Echo an ADMITTED origin back as CORS headers. A webview fetch from\n * `vscode-webview://…` passes the origin check but the browser rejects\n * the response body without `Access-Control-Allow-Origin` — the exact\n * transport design/47 specifies for the extension. Only the validated\n * origin is echoed (never `*`), with `Vary: Origin` for any cache in\n * between; unadmitted origins were already 403'd and get nothing.\n */\nfunction reflectCors(res: ServerResponse, origin: string | undefined): void {\n if (!origin) return;\n res.setHeader('Access-Control-Allow-Origin', origin);\n res.setHeader('Vary', 'Origin');\n}\n\n/**\n * Create the Connect middleware handling GET /__timber/graph.\n *\n * Query surface: `?file=<path>` (absolute or project-root-relative) or\n * `?all=1`. Anything else is a 400 — fail loudly, like the CLI.\n */\nexport function createGraphEndpointMiddleware(server: ViteDevServer, ctx: PluginContext) {\n const sourceExtensions = buildSourceExtensions(ctx.config.pageExtensions);\n return async (req: IncomingMessage, res: ServerResponse, next: () => void): Promise<void> => {\n const rawUrl = req.url;\n // Reserve the whole /__timber/ namespace: unknown paths under it\n // must 404 here, not fall through and render the app's 404 page.\n if (!rawUrl || !rawUrl.startsWith('/__timber/')) {\n next();\n return;\n }\n const url = new URL(rawUrl, 'http://placeholder.invalid');\n if (url.pathname !== GRAPH_ENDPOINT_PATH) {\n sendJson(res, 404, { error: `unknown /__timber/ endpoint: ${url.pathname}` });\n return;\n }\n\n if (req.method !== 'GET') {\n res.setHeader('Allow', 'GET');\n sendJson(res, 405, { error: 'GET only' });\n return;\n }\n\n // Host validation is skipped under server.https, as Vite skips it\n // (TLS cert matching already defeats DNS rebinding). The ORIGIN\n // check is not: it guards cross-site reads, which TLS does nothing\n // about — and since admitted origins get reflected CORS below,\n // skipping it under https would let any page read the endpoint.\n const origin = req.headers.origin as string | undefined;\n const allowedHosts = server.config.server.allowedHosts;\n if (!server.config.server.https && !isAllowedGraphHost(req.headers.host, allowedHosts)) {\n sendJson(res, 403, { error: 'host not allowed' });\n return;\n }\n if (!isAllowedGraphOrigin(origin, allowedHosts)) {\n sendJson(res, 403, { error: 'origin not allowed' });\n return;\n }\n // Past validation: reflect the admitted origin so webview/browser\n // consumers can actually READ the response.\n reflectCors(res, origin);\n\n try {\n // Lazy import: the analyze pipeline (oxc parse, chains) loads on\n // first query, not on every dev-server boot.\n const { classifyLiveFile, classifyLiveProject } = await import('../analyze/live-graph.ts');\n // Root must share the graphs' path space: by default Vite\n // resolves through symlinks and nodes carry realpaths, but under\n // resolve.preserveSymlinks the graphs keep the SYMLINK paths and\n // realpathing would break every lookup instead of fixing it —\n // honor the resolved setting (same rule as the crawl).\n const preserveSymlinks = server.config.resolve.preserveSymlinks;\n // Slash-normalized like every other frontend's paths — on\n // Windows a native-separator root beside slash-normalized module\n // paths would break consumers stripping the root prefix.\n const root = normalizePath(preserveSymlinks ? ctx.root : await realpath(ctx.root));\n // appDir must live in the same path space as root and the graph\n // nodes: on a symlinked project ctx.appDir still carries Vite's\n // unresolved prefix — and the appDir itself may be a symlink\n // (src/app -> elsewhere), so realpath the whole thing rather\n // than assuming the relative suffix is symlink-free. Under\n // preserveSymlinks the graphs keep logical paths and ctx.appDir\n // is already in that space.\n const appDir = normalizePath(\n preserveSymlinks\n ? ctx.appDir\n : await realpath(ctx.appDir).catch(() => join(root, relative(ctx.root, ctx.appDir)))\n );\n const liveCtx = {\n rsc: server.environments.rsc.moduleGraph,\n ssr: server.environments.ssr.moduleGraph,\n client: server.environments.client.moduleGraph,\n root,\n appDir,\n pageExtensions: ctx.config.pageExtensions,\n };\n\n const allParam = url.searchParams.get('all');\n if (allParam !== null && allParam !== '1') {\n // Fail loudly: `?all=0`/`?all=false` silently returning the\n // full project would hand API clients the wrong response shape.\n sendJson(res, 400, { error: `unsupported all value: ${allParam} (use ?all=1)` });\n return;\n }\n if (allParam === '1') {\n const report = await classifyLiveProject(liveCtx);\n // `cached: false` always — live answers are never cached, and\n // consumers switching between sources should not lose the\n // field. `stats` stays a static-scan extra (crawl bookkeeping\n // with no live equivalent) — documented in design/47.\n sendJson(res, 200, {\n version: GRAPH_JSON_VERSION,\n source: 'dev-server',\n cached: false,\n ...report,\n });\n return;\n }\n\n const fileParam = url.searchParams.get('file');\n if (!fileParam) {\n sendJson(res, 400, { error: 'missing ?file=<path> (or ?all=1)' });\n return;\n }\n // resolve() in BOTH branches: it collapses `..` segments, and\n // under preserveSymlinks the un-realpathed value is what gets\n // containment-checked — a raw absolute `/root/../outside/x.ts`\n // would pass the prefix check while stat/readFile escape the\n // project.\n // Slash-normalized so every comparison below shares the root's\n // path space (resolve/realpath emit backslashes on Windows).\n const absolute = normalizePath(\n isAbsolute(fileParam) ? resolve(fileParam) : resolve(root, fileParam)\n );\n // Target follows the root's path-space rule. realpath doubles as\n // the existence check in both branches — and the PHYSICAL path is\n // containment-checked even under preserveSymlinks: a symlink\n // inside the project pointing outside it would otherwise pass the\n // lexical prefix check while readFile followed it out of the\n // project. (Symlinks resolving within the project still work.)\n let target: string;\n try {\n const physical = normalizePath(await realpath(absolute));\n const rootPhysical = preserveSymlinks ? normalizePath(await realpath(root)) : root;\n if (\n physical !== rootPhysical &&\n !physical.startsWith(rootPhysical + '/') &&\n !physical.startsWith(rootPhysical + '\\\\')\n ) {\n sendJson(res, 404, { error: `not a project file under ${root}` });\n return;\n }\n if (preserveSymlinks) {\n // Segment-safe symlink check: the disk scan neither follows\n // file symlinks nor descends directory symlinks, so a path\n // reached through EITHER (link.ts, or link/a.ts via\n // link -> src) would 200 here while the ?all sweep omits it.\n // Symlinks ABOVE the root are fine (reaching the project via\n // one is the preserveSymlinks use case) — require only that\n // the path RELATIVE to the root is symlink-free, i.e. the\n // physical path equals the physical root plus that suffix.\n const suffix = absolute.slice(root.length);\n const expected = rootPhysical + suffix;\n if (physical !== expected) {\n sendJson(res, 404, { error: `not a project source file: ${absolute}` });\n return;\n }\n }\n target = normalizePath(preserveSymlinks ? absolute : physical);\n } catch {\n sendJson(res, 404, { error: `file not found: ${absolute}` });\n return;\n }\n if (target !== root && !target.startsWith(root + '/') && !target.startsWith(root + '\\\\')) {\n sendJson(res, 404, { error: `not a project file under ${root}` });\n return;\n }\n // Same admission rules as the CLI's scan (design/47: project\n // source files only) via the shared helper — without it, any\n // real path under the root (package.json, dist/generated.js,\n // types.d.ts, a nested node_modules file, a DIRECTORY named\n // foo.ts) would get a synthetic classification the static scan\n // would refuse, and the frontends would disagree.\n const targetStat = await stat(target).catch(() => null);\n if (\n !targetStat?.isFile() ||\n !isScannableSourceFile(normalizePath(target), normalizePath(root), sourceExtensions)\n ) {\n sendJson(res, 404, { error: `not a project source file: ${target}` });\n return;\n }\n const errors: import('../analyze/live-graph.ts').LiveGraphError[] = [];\n const module = await classifyLiveFile(target, liveCtx, undefined, errors);\n // Explicit field list, mirroring the CLI's single-file output —\n // a spread would leak `file` (redundant with target.resolved) and\n // silently drift the two frontends' key sets. `stats` is a\n // static-scan extra and deliberately absent here.\n sendJson(res, 200, {\n version: GRAPH_JSON_VERSION,\n source: 'dev-server',\n cached: false,\n target: { input: fileParam, resolved: target },\n kind: module.kind,\n pending: module.pending,\n subtreeUnknown: module.subtreeUnknown,\n envs: module.envs,\n boundary: module.boundary,\n chains: module.chains,\n poisonings: module.poisonings,\n errors,\n });\n } catch (error) {\n sendJson(res, 500, {\n error: error instanceof Error ? error.message : String(error),\n });\n }\n };\n}\n\n/** What one hotUpdate invocation tells the emitter. */\nexport interface GraphHotUpdate {\n file: string;\n /** Vite's own hotUpdate vocabulary. */\n type: 'create' | 'update' | 'delete';\n /** Environment the hook ran for (rsc/ssr/client). */\n environment: string;\n}\n\n/** The push channel's two notification points for one edit. */\nexport interface GraphUpdateChannel {\n /** Feed from the plugin's hotUpdate hook (post graph invalidation). */\n onHotUpdate(update: GraphHotUpdate): void;\n /**\n * Feed from the plugin's transform hook (module id, may carry a\n * query suffix). Emits phase \"transformed\" for files with a pending\n * invalidation, once their import edges are actually rebuilt.\n */\n onTransform(id: string, environment: string): void;\n}\n\n/**\n * Accessor the channel uses to decide when a re-transforming module's\n * graph data is current: Vite stores the node's `transformResult` only\n * at the END of the transform request — after `vite:import-analysis`\n * has rebuilt the importer edges — so a non-null result is the\n * edges-are-current signal.\n */\nexport type IsNodeTransformed = (file: string, environment: string) => boolean;\n\n/**\n * Build the push channel: `timber:graph-update` custom HMR events per\n * project-source change. Consumers (the VS Code extension) re-query\n * and debounce on their side; the channel just emits. Non-source noise\n * (build output, dotdirs) is filtered by the same extension set the\n * scanners use.\n *\n * Two phases per edit, because one is not enough (codex review, PR\n * #1057): the `invalidated` event fires from the plugin's `hotUpdate`\n * hook — after Vite clears the module's transform result, but its\n * importer EDGES are only rebuilt when the module is next transformed.\n * The `transformed` event fires for exactly the files with a pending\n * invalidation, and only once the node's `transformResult` is set\n * again — the plugin transform hook itself runs BEFORE Vite's trailing\n * `vite:import-analysis` (which rebuilds the edges), so the hook only\n * marks the file \"settling\" and a short bounded timer confirms\n * completion via `isTransformed` before emitting. (A module nothing\n * re-requests never re-transforms — its `transformed` event waits for\n * the next render, which is also when the graph has new information.)\n */\nexport function makeGraphUpdateChannel(\n ctx: Pick<PluginContext, 'root' | 'config'>,\n send: (payload: { type: 'custom'; event: string; data: unknown }) => void,\n isTransformed?: IsNodeTransformed,\n // Maps a watcher/hook path into the module graphs' path space (the\n // dev-server passes a preserveSymlinks-aware realpath). Watcher\n // events can carry the symlink path while transform ids carry the\n // physical one — unkeyed by a common canonical form, the pending\n // entry would never match its own transform.\n canonicalize: (file: string) => string = (file) => file\n): GraphUpdateChannel {\n /** Files invalidated but not yet re-transformed, per environment. */\n const pending = new Set<string>();\n const key = (file: string, environment: string) => `${environment}\\0${file}`;\n // The root goes through the same canonicalization as the files it\n // contains — containment checks must compare in one path space.\n const root = normalizePath(canonicalize(ctx.root));\n const extensions = buildSourceExtensions(ctx.config.pageExtensions);\n\n const emitTransformed = (file: string, environment: string, structural?: boolean) => {\n send({\n type: 'custom',\n event: GRAPH_UPDATE_EVENT,\n data: structural\n ? { file, event: 'update', environment, phase: 'transformed', structural: true }\n : { file, event: 'update', environment, phase: 'transformed' },\n });\n };\n\n /**\n * Confirm the transform request finished (transformResult set again)\n * before emitting phase `transformed`. If confirmation never arrives\n * within the bounded schedule below, the pending key is RE-ARMED\n * rather than emitted — a `transformed` event over a still-stale\n * graph would be a false all-clear with no corrective event.\n */\n /**\n * Delays between confirmation re-checks: dense while a normal\n * transform request finishes, then exponential backoff for slow\n * import-analysis passes (large graphs, cold dep optimizer) — a\n * completed slow transform is CACHED, so no later transform hook may\n * ever fire for it and the tail checks are the only chance to emit.\n * Total window ≈ 16 s, then give up (bounded — the async-safety\n * rules ban open-ended polling) and re-arm the pending key.\n */\n const CONFIRM_DELAYS_MS = [\n ...Array.from({ length: 25 }, () => 20),\n 500,\n 1_000,\n 2_000,\n 4_000,\n 8_000,\n ];\n\n const confirmAndEmit = (file: string, environment: string, attempt = 0, structural = false) => {\n if (!isTransformed || isTransformed(file, environment)) {\n emitTransformed(file, environment, structural);\n return;\n }\n if (attempt >= CONFIRM_DELAYS_MS.length) {\n // Structural (virtual-id) updates have no pending-key cycle to\n // re-arm; project files wait for their next transform.\n if (!structural) pending.add(key(file, environment));\n return;\n }\n setTimeout(\n () => confirmAndEmit(file, environment, attempt + 1, structural),\n CONFIRM_DELAYS_MS[attempt]\n );\n };\n\n return {\n onHotUpdate(update) {\n // The scanner's FULL admission rules, not just the extension —\n // otherwise the channel pushes updates for files the endpoint\n // itself 404s (node_modules, dist, .d.ts, dot-dirs) and editor\n // consumers refresh into dead ends. Deletes canonicalize too:\n // the dev-server's canonicalizer falls back to resolving the\n // parent directory when the file itself is gone.\n const file = normalizePath(canonicalize(update.file));\n if (!isScannableSourceFile(file, root, extensions)) return;\n if (update.type === 'delete') {\n // Deleted files never re-transform; no second phase to track.\n pending.delete(key(file, update.environment));\n } else {\n pending.add(key(file, update.environment));\n }\n send({\n type: 'custom',\n event: GRAPH_UPDATE_EVENT,\n data: {\n file,\n event: update.type,\n environment: update.environment,\n phase: 'invalidated',\n },\n });\n },\n onTransform(id, environment) {\n const file = normalizePath(id.split('?')[0]);\n // Structural change: the route manifest re-transforms when routes\n // are added/removed (its dynamic-import edges are what connect\n // new route files to the graph). The new FILE itself may not\n // transform until visited, so per-file tracking cannot see this —\n // emit a structural notification, through the same confirmation\n // gate (the manifest's own edges are also rebuilt only by the\n // trailing import-analysis; the accessor resolves virtual ids).\n if (file.includes('virtual:timber-route-manifest')) {\n confirmAndEmit(file, environment, 25, true);\n return;\n }\n const pendingKey = key(file, environment);\n if (!pending.has(pendingKey)) return;\n pending.delete(pendingKey);\n confirmAndEmit(file, environment);\n },\n };\n}\n","// Response compression for self-hosted deployments (dev server, Nitro preview).\n//\n// Uses CompressionStream (Web Platform API) for gzip. Brotli is intentionally\n// left to CDNs and reverse proxies — at streaming-friendly quality levels its\n// ratio advantage is marginal, and node:zlib's brotli transform buffers output\n// internally, breaking streaming. Cloudflare Workers auto-compress at the edge —\n// this module is only used on Node.js/Bun.\n//\n// See design/25-production-deployments.md.\n//\n// This module is also emitted standalone as `_compress.mjs` by\n// `adapters/compress-module.ts`, which strips types but does not bundle. Its\n// imports must therefore be interpolated there — a new import that is not\n// fails the build with an explanatory error rather than resolving to nothing\n// on the deployed server.\n\nimport { RSC_CONTENT_TYPE } from '../shared/rsc-media-type.ts';\n\n// ─── Constants ────────────────────────────────────────────────────────────\n\n/**\n * MIME types that benefit from compression.\n * text/* is handled via prefix matching; these are the specific\n * application/* and image/* types that are compressible.\n */\nexport const COMPRESSIBLE_TYPES = new Set([\n 'text/html',\n 'text/css',\n 'text/plain',\n 'text/xml',\n 'text/javascript',\n RSC_CONTENT_TYPE,\n 'application/json',\n 'application/javascript',\n 'application/xml',\n 'application/xhtml+xml',\n 'application/rss+xml',\n 'application/atom+xml',\n 'image/svg+xml',\n]);\n\n/**\n * Status codes that should never be compressed (no body or special semantics).\n */\nconst NO_COMPRESS_STATUSES = new Set([204, 304]);\n\n// ─── Encoding Negotiation ─────────────────────────────────────────────────\n\n/**\n * Parse Accept-Encoding and return the best supported encoding.\n * Returns 'gzip' if the client accepts it, null otherwise.\n *\n * Brotli (br) is intentionally not handled at the application level.\n * At the streaming-friendly quality levels (0–4), brotli's compression\n * ratio advantage over gzip is marginal, and node:zlib's brotli transform\n * buffers output internally — turning smooth streaming responses into\n * large infrequent bursts. Brotli's real wins come from offline/static\n * compression at higher quality levels (5–11), which CDNs and reverse\n * proxies (Cloudflare, nginx, Caddy) apply on cached responses.\n *\n * See design/25-production-deployments.md.\n */\nexport function negotiateEncoding(acceptEncoding: string): 'gzip' | null {\n if (!acceptEncoding) return null;\n\n // Parse tokens with quality values from the Accept-Encoding header.\n // Per RFC 9110 §12.5.3, q=0 means \"not acceptable\" — the client explicitly\n // rejects that encoding. Tokens without a q-value default to q=1.\n // e.g. \"gzip;q=1.0, br;q=0\" → gzip is acceptable, br is rejected.\n const parts = acceptEncoding.split(',');\n for (const part of parts) {\n const [token, ...params] = part.split(';');\n const name = token.trim().toLowerCase();\n if (name !== 'gzip') continue;\n\n // Check for q=0 (explicitly disabled)\n let qValue = 1; // default quality is 1\n for (const param of params) {\n const trimmed = param.trim().toLowerCase();\n if (trimmed.startsWith('q=')) {\n qValue = parseFloat(trimmed.slice(2));\n if (Number.isNaN(qValue)) qValue = 1;\n break;\n }\n }\n\n if (qValue > 0) return 'gzip';\n }\n\n return null;\n}\n\n// ─── Compressibility Check ────────────────────────────────────────────────\n\n/**\n * Determine if a response should be compressed.\n *\n * Returns false for:\n * - Responses without a body (204, 304, null body)\n * - Already-encoded responses (Content-Encoding set)\n * - Non-compressible content types (images, binary)\n * - SSE streams (text/event-stream — must not be buffered)\n */\nexport function shouldCompress(response: Response): boolean {\n // No body to compress\n if (!response.body) return false;\n if (NO_COMPRESS_STATUSES.has(response.status)) return false;\n\n // Already compressed\n if (response.headers.has('Content-Encoding')) return false;\n\n // Check content type\n const contentType = response.headers.get('Content-Type');\n if (!contentType) return false;\n\n // Extract the MIME type (strip charset and other parameters)\n const mimeType = contentType.split(';')[0].trim().toLowerCase();\n\n // SSE must not be compressed — it relies on chunk-by-chunk delivery\n if (mimeType === 'text/event-stream') return false;\n\n return COMPRESSIBLE_TYPES.has(mimeType);\n}\n\n// ─── Compression ──────────────────────────────────────────────────────────\n\n/**\n * Compress a Web Response if the client supports it and the content is compressible.\n *\n * Returns the original response unchanged if compression is not applicable.\n * Returns a new Response with the compressed body, Content-Encoding, and Vary headers.\n *\n * The body is piped through a compression stream — no buffering of the full response.\n * This preserves streaming behavior for HTML shell + deferred Suspense chunks.\n */\nexport function compressResponse(request: Request, response: Response): Response {\n // Check if response is compressible\n if (!shouldCompress(response)) return response;\n\n // Negotiate encoding with the client\n const acceptEncoding = request.headers.get('Accept-Encoding') ?? '';\n const encoding = negotiateEncoding(acceptEncoding);\n if (!encoding) return response;\n\n // Compress the body stream with gzip via the Web Platform CompressionStream API.\n const compressedBody = compressWithGzip(response.body!);\n\n // Build new headers: copy originals, add compression headers, remove Content-Length\n // (compressed size is unknown until streaming completes).\n const headers = new Headers(response.headers);\n headers.set('Content-Encoding', encoding);\n headers.delete('Content-Length');\n\n // Append to Vary header (preserve existing Vary values)\n const existingVary = headers.get('Vary');\n if (existingVary) {\n if (!existingVary.toLowerCase().includes('accept-encoding')) {\n headers.set('Vary', `${existingVary}, Accept-Encoding`);\n }\n } else {\n headers.set('Vary', 'Accept-Encoding');\n }\n\n return new Response(compressedBody, {\n status: response.status,\n statusText: response.statusText,\n headers,\n });\n}\n\n// ─── Gzip (node:zlib with Z_SYNC_FLUSH) ──────────────────────────────────\n//\n// Uses node:zlib's createGzip with Z_SYNC_FLUSH so each chunk is flushed\n// to the output immediately. The Web Platform CompressionStream API buffers\n// internally and does NOT flush per-chunk — this kills streaming because\n// the browser doesn't receive the HTML shell until the gzip stream closes\n// (i.e. after all Suspense boundaries resolve).\n//\n// Z_SYNC_FLUSH adds ~2–5% size overhead vs Z_NO_FLUSH but preserves\n// correct streaming behavior: the shell renders instantly, Suspense\n// fallbacks are visible immediately, and streamed content appears\n// progressively.\n\nimport { createGzip, constants } from 'node:zlib';\nimport { Readable, pipeline } from 'node:stream';\n\n/**\n * Compress a ReadableStream with gzip, flushing each chunk immediately.\n *\n * Uses node:zlib's createGzip with Z_SYNC_FLUSH to ensure each HTML chunk\n * (shell, Suspense resolution, RSC payload) is delivered to the browser\n * as soon as it's available — preserving streaming semantics.\n */\nfunction compressWithGzip(body: ReadableStream<Uint8Array>): ReadableStream<Uint8Array> {\n const gzip = createGzip({ flush: constants.Z_SYNC_FLUSH });\n const nodeInput = Readable.fromWeb(body as import('stream/web').ReadableStream);\n\n // pipeline() instead of bare pipe(): pipe() does not forward source errors,\n // so an erroring body (streaming route handler, dropped upstream fetch)\n // would emit an unhandled 'error' event and crash the process. pipeline()\n // destroys gzip on source error — the returned web stream rejects — and\n // tears down nodeInput when the consumer cancels the web stream, which\n // cancels the source body via fromWeb. The error reaches the consumer\n // through the web stream; the callback only marks it handled at the Node\n // layer.\n pipeline(nodeInput, gzip, () => {});\n\n return Readable.toWeb(gzip) as ReadableStream<Uint8Array>;\n}\n","/**\n * timber-dev-server — Vite sub-plugin for dev server request handling.\n *\n * Registers a configureServer middleware that intercepts requests and\n * routes them through the timber pipeline:\n * proxy.ts → canonicalize → route match → middleware → access → render → flush\n *\n * The RSC entry module is loaded via Vite's ssrLoadModule, which uses\n * Vite's dev module graph instead of built bundles. The full pipeline\n * (including proxy.ts) runs on every request.\n *\n * Design docs: 18-build-system.md §\"Dev Server\", 02-rendering-pipeline.md\n */\n\nimport type { Plugin, ViteDevServer, DevEnvironment } from 'vite';\nimport type { IncomingMessage, ServerResponse } from 'node:http';\nimport type { TLSSocket } from 'node:tls';\nimport { existsSync, realpathSync, statSync } from 'node:fs';\nimport { basename, dirname, join } from 'node:path';\nimport { sendNodeResponse } from 'srvx/node';\nimport type { PluginContext } from '../plugin-context.ts';\nimport {\n sendErrorToOverlay,\n classifyErrorPhase,\n parseFirstAppFrame,\n type ErrorPhase,\n} from '../dev-tools/overlay.ts';\nimport { generateDevErrorPage } from '../dev-tools/error-page.ts';\nimport {\n extractHmrOptions,\n type DevErrorHmrOptions,\n type DevHooks,\n} from '../dev-tools/dev-page-shell.ts';\nimport { addVirtualModuleContext } from '../config-validation.ts';\nimport { registerDevDiscovery } from './dev-discovery.ts';\nimport {\n createGraphEndpointMiddleware,\n makeGraphUpdateChannel,\n type GraphUpdateChannel,\n} from './graph-endpoint.ts';\nimport { compressResponse } from '../server/compress.ts';\nimport { isMetadataRouteServePath } from '../server/metadata-routes.ts';\nimport { canonicalize } from '../server/canonicalize.ts';\nimport { matchUrlParts } from '../server/tree-match.ts';\nimport type { RouteTree } from '../routing/types.ts';\n\n// ─── Constants ────────────────────────────────────────────────────────────\n\nconst RSC_ENTRY_ID = 'virtual:timber-rsc-entry';\n\n/**\n * Exit code used to signal the CLI supervisor that the dev server needs\n * a full process restart (e.g. timber.config.ts changed). The supervisor\n * in cli.ts respawns the worker on this code. 75 = EX_TEMPFAIL (sysexits).\n * See TIM-1444.\n */\nexport const RESTART_EXIT_CODE = 75;\n\n/**\n * Config file names that trigger a full dev server restart when changed.\n * See 21-dev-server.md §HMR Wiring — config is loaded once at startup.\n */\nconst CONFIG_FILE_NAMES = ['timber.config.ts', 'timber.config.js', 'timber.config.mjs'];\n\n/**\n * URL prefixes that are Vite-internal and should never be intercepted.\n * These are passed through to Vite's built-in middleware.\n */\nconst VITE_INTERNAL_PREFIXES = [\n '/@', // /@vite/client, /@fs/, /@id/\n '/__vite', // /__vite_hmr, /__vite_ping\n '/node_modules/',\n];\n\n/**\n * File extensions that indicate static asset requests.\n * These are passed through to Vite's static file serving.\n */\nconst ASSET_EXTENSIONS =\n /\\.(?:js|ts|tsx|jsx|css|map|json|svg|png|jpg|jpeg|gif|webp|avif|ico|woff|woff2|ttf|eot|mp4|webm|ogg|mp3|wav)(?:\\?.*)?$/;\n\n// ─── Plugin ───────────────────────────────────────────────────────────────\n\n/**\n * Create the timber-dev-server Vite plugin.\n *\n * Hook: configureServer (returns post-hook to register after Vite's middleware)\n */\nexport function timberDevServer(ctx: PluginContext): Plugin {\n // Set in configureServer, consumed by hotUpdate/transform — the\n // graph push channel emits through the server's HMR transport.\n let graphChannel: GraphUpdateChannel | null = null;\n\n return {\n name: 'timber-dev-server',\n\n // Only active in dev mode (command === 'serve'), not during build.\n // See 21-dev-server.md §Plugin Registration.\n apply: 'serve',\n\n /**\n * Push channel for the graph endpoint, phase 1: `invalidated`, one\n * per (file, environment). Emitted from hotUpdate — which runs\n * AFTER Vite invalidates the environment module graphs — never\n * from a raw watcher listener, which would race consumers into\n * querying pre-invalidation memberships (design/47 §\"Dev-server\n * endpoint\").\n */\n hotUpdate({ file, type }) {\n graphChannel?.onHotUpdate({ file, type, environment: this.environment.name });\n },\n\n /**\n * Push channel phase 2: `transformed`, when a pending-invalidated\n * module's import edges are actually rebuilt. A Set lookup for\n * everything without a pending invalidation — free on the hot\n * path. Returning nothing leaves the code untouched.\n */\n transform(_code, id) {\n graphChannel?.onTransform(id, this.environment.name);\n },\n\n /**\n * Register the dev server middleware and config file watcher.\n *\n * Registers as a pre-hook (no return value) so our middleware runs\n * before Vite's built-in SPA fallback / historyApiFallback. This\n * ensures we see the original URL (e.g. /blog) rather than a\n * rewritten /index.html. Vite-internal and asset requests are\n * filtered out explicitly and passed through to Vite.\n */\n async configureServer(server: ViteDevServer) {\n // Watch config files for changes. When running under the CLI\n // supervisor (__TIMBER_DEV_WORKER), exit the process so the\n // supervisor respawns with a fresh require cache. When running\n // via `vite dev` directly (no supervisor), fall back to Vite's\n // in-process server.restart() — it serves stale config, but at\n // least the server stays alive. See TIM-1444.\n const configPaths = CONFIG_FILE_NAMES.map((name) => join(ctx.root, name));\n server.watcher.add(configPaths);\n const configPathSet = new Set(configPaths);\n const hasSupervisor = Boolean(process.env.__TIMBER_DEV_WORKER);\n const onConfigChange = (filePath: string) => {\n if (!configPathSet.has(filePath)) return;\n if (hasSupervisor) {\n console.log(`\\n[timber] ${basename(filePath)} changed — restarting dev server...\\n`);\n process.exit(RESTART_EXIT_CODE);\n } else {\n console.log(\n `\\n[timber] ${basename(filePath)} changed — restarting dev server...` +\n `\\n[timber] Run \\`timber dev\\` instead of \\`vite dev\\` for guaranteed fresh config on restart.\\n`\n );\n server.restart();\n }\n };\n server.watcher.on('change', onConfigChange);\n server.watcher.on('add', onConfigChange);\n server.watcher.on('unlink', onConfigChange);\n\n // Listen for client-side errors forwarded from the browser.\n // The browser entry sends 'timber:client-error' events via HMR\n // for uncaught errors and unhandled rejections. We echo them back\n // as Vite's '{ type: \"error\" }' payload to trigger the overlay.\n listenForClientErrors(server, ctx.root);\n\n // GET /__timber/graph — module-environment classification from the\n // live env graphs, plus the timber:graph-update HMR push channel.\n // Registered before the timber middleware so /__timber/* requests\n // never reach the app pipeline. Dev-only by construction (this\n // plugin is apply: 'serve'). See design/47 §\"Dev-server endpoint\".\n server.middlewares.use(createGraphEndpointMiddleware(server, ctx));\n graphChannel = makeGraphUpdateChannel(\n ctx,\n (payload) => server.hot.send(payload),\n // \"Edges rebuilt\" signal: Vite sets a node's transformResult at\n // the END of the transform request, after vite:import-analysis\n // has updated the importer edges. Virtual ids (the route\n // manifest's structural updates) have no file index — resolve\n // them by id.\n (file, environment) => {\n const graph = server.environments[environment]?.moduleGraph;\n if (!graph) return false;\n const nodes = graph.getModulesByFile(file);\n if (nodes) {\n for (const node of nodes) {\n if (node.transformResult != null) return true;\n }\n return false;\n }\n return graph.getModuleById(file)?.transformResult != null;\n },\n // Canonicalize watcher/hook paths into the module graphs' path\n // space: under the default preserveSymlinks:false the graphs\n // carry realpaths while watcher events can carry symlink paths\n // — unkeyed by one canonical form, a pending entry would never\n // match its own transform. Deleted files realpath their parent\n // directory instead; virtual ids pass through untouched.\n (file) => {\n // Optional-chained: mock servers in unit tests carry a bare\n // config object without resolve options.\n if (server.config?.resolve?.preserveSymlinks || file.includes('virtual:')) return file;\n try {\n return realpathSync(file);\n } catch {\n try {\n return join(realpathSync(dirname(file)), basename(file));\n } catch {\n return file;\n }\n }\n }\n );\n\n // Pre-hook — registers middleware before Vite's internals\n server.middlewares.use(createTimberMiddleware(server, ctx));\n\n // Write this server's .timber/dev/<pid>-<port>-<token>.json record once\n // the server is listening so the graph CLI / VS Code extension can\n // discover it. See design/47-module-environment-tooling.md §5.\n registerDevDiscovery(server.httpServer, ctx.root, server.config);\n\n // Close the holding server and await the port release so Vite's\n // port probe and bind see a free port. configureServer is awaited\n // by Vite during createServer(), before startServer() runs\n // isPortAvailable() and httpServer.listen().\n // closeAllConnections() (in HoldingServer.close) kills keep-alive\n // sockets from the meta-refresh page so close() resolves promptly.\n // See design/21-dev-server.md §\"Startup Holding Server\", TIM-1419.\n if (ctx.holdingServer) {\n await ctx.holdingServer.close().catch(() => {});\n ctx.holdingServer = null;\n }\n\n // Log startup timing summary. configureServer runs on all plugins\n // before the server listens, so this captures the full cold start.\n ctx.timer.end('dev-server-setup');\n const summary = ctx.timer.formatSummary();\n if (summary) {\n console.log(summary);\n }\n },\n };\n}\n\n// ─── Middleware ────────────────────────────────────────────────────────────\n\n/**\n * Create the Connect middleware that routes requests through the timber pipeline.\n *\n * For route requests (HTML pages, API endpoints), the middleware:\n * 1. Loads the RSC entry via ssrLoadModule\n * 2. Converts the Node request to a Web Request\n * 3. Passes it through the RSC handler (which runs the full pipeline)\n * 4. Converts the Web Response back to a Node response\n *\n * For non-route requests (assets, Vite internals, HMR), the middleware\n * calls next() to let Vite handle them.\n */\nfunction createTimberMiddleware(server: ViteDevServer, ctx: PluginContext) {\n const projectRoot = ctx.root;\n // Extract HMR connection options once so the error page can construct\n // a correct WebSocket URL (TIM-789).\n const hmrOptions = extractHmrOptions(server.config);\n\n // Debug channel registry: buffers RSC debug rows per request and replays\n return async (req: IncomingMessage, res: ServerResponse, next: () => void): Promise<void> => {\n const url = req.url;\n if (!url) {\n next();\n return;\n }\n\n // Pass through Vite-internal requests\n if (isViteInternal(url)) {\n next();\n return;\n }\n\n // Files that exist in public/ are always served by Vite's static\n // middleware, regardless of extension. Without this, extensions like\n // .ico, .txt, .xml, .html either get caught by the metadata route\n // check or aren't in ASSET_EXTENSIONS, so they fall through to the\n // app router where a dynamic segment like [artistSlug] 404s them.\n if (isPublicFile(server, url)) {\n next();\n return;\n }\n\n // Pass through static asset requests — but not metadata routes like\n // /favicon.ico that match asset extensions but are handled by timber,\n // and not registered routes like app/feed.json/route.ts whose URL ends\n // in an asset extension. Production serves these through the RSC\n // handler, so letting them fall through to Vite would 404 in dev only\n // (TIM-1038).\n if (\n isAssetRequest(url) &&\n !isMetadataRouteServePath(url) &&\n !isRouteOwnedAsset(ctx.routeTree, server, url)\n ) {\n next();\n return;\n }\n\n // Step 1: Load the RSC entry module from the RSC environment.\n // The RSC entry runs in the 'rsc' Vite environment (separate module\n // graph with react-server conditions). In dev mode, this uses the\n // environment's module runner for HMR-aware loading.\n let handler: (req: Request) => Promise<Response>;\n try {\n const rscEnv = server.environments.rsc as DevEnvironment & {\n runner?: { import: (id: string) => Promise<any> };\n };\n // Duck-type check instead of isRunnableDevEnvironment() — the vite\n // import-based check fails across pnpm link boundaries where the\n // linked package resolves a different vite module instance.\n if (!rscEnv?.runner?.import) {\n throw new Error('[timber] RSC environment is not runnable');\n }\n const rscModule = await rscEnv.runner.import(RSC_ENTRY_ID);\n handler = rscModule.default as (req: Request) => Promise<Response>;\n\n // Wire pipeline errors into the browser error overlay, and plumb the\n // resolved HMR options into the RSC environment. The RSC entry can't\n // read the Vite server config (separate module graph), but its dev 404\n // page and fallback error page need the HMR endpoint (including Vite\n // 8's required WS token) for auto-reload (TIM-1067).\n const setDevHooks = rscModule.setDevHooks as ((hooks: DevHooks) => void) | undefined;\n setDevHooks?.({\n onPipelineError: (error) => {\n sendErrorToOverlay(server, error, classifyErrorPhase(error, projectRoot), projectRoot);\n },\n hmrOptions,\n });\n } catch (error) {\n // Module transform error — syntax error, missing import, etc.\n // Vite may already show its own overlay for these, but we still\n // log to stderr with frame dimming for the terminal.\n if (error instanceof Error) {\n // Add context for virtual:timber-* module errors\n addTimberContext(error);\n sendErrorToOverlay(server, error, 'module-transform', projectRoot);\n }\n respond500(res, error, 'module-transform', projectRoot, hmrOptions);\n return;\n }\n\n if (typeof handler !== 'function') {\n console.error('[timber] RSC entry module does not export a default function');\n next();\n return;\n }\n\n // Step 2: Run the pipeline.\n try {\n // Convert Node IncomingMessage → Web Request\n const webRequest = toWebRequest(req);\n\n // Check for a platform-specific request wrapper (e.g., Cloudflare\n // dev bindings). The cloudflareDevBindings() plugin stores a wrapper\n // function on the server instance using a well-known Symbol. The\n // wrapper runs the handler inside an ALS context so platform APIs\n // like getCloudflareBindings() work during dev.\n // See design/35-cloudflare-primitives.md §\"Dev Experience\".\n const wrapper = (server as any)[Symbol.for('timber:dev-request-wrapper')] as\n | (<T>(fn: () => T) => T)\n | undefined;\n\n // Run the full pipeline (wrapped if a platform dev plugin is active)\n const webResponse = wrapper\n ? await wrapper(() => handler(webRequest))\n : await handler(webRequest);\n\n // Compress the response if the client supports it.\n // In dev mode, compression is always enabled for parity with production.\n // See design/25-production-deployments.md.\n const finalResponse = compressResponse(webRequest, webResponse);\n\n // Flush headers eagerly so streaming responses (SSE, long-polling)\n // reach the client before the first body chunk. Node.js buffers\n // headers until write()/end() otherwise, which stalls EventSource\n // clients that wait for the response to open. srvx's writeHead\n // skips if headersSent is already true, so pre-flushing is safe.\n res.writeHead(finalResponse.status, [...finalResponse.headers].flat());\n res.flushHeaders();\n\n // Stream the body with backpressure and disconnect handling.\n // srvx skips its own writeHead since headers are already sent.\n await sendNodeResponse(res, finalResponse);\n } catch (error) {\n // An error the pipeline did not turn into a response, or one sending\n // the response threw — classify the phase, send to overlay, respond\n // 500. The pipeline answers render errors itself (an SsrStreamError\n // never gets here), so this sees the error as thrown. The dev server\n // remains running for recovery on file fix + HMR.\n if (error instanceof Error) {\n const phase = classifyErrorPhase(error, projectRoot);\n sendErrorToOverlay(server, error, phase, projectRoot);\n respond500(res, error, phase, projectRoot, hmrOptions);\n } else {\n process.stderr.write(`\\x1b[31m[timber] Dev server error:\\x1b[0m ${String(error)}\\n`);\n respond500(res, error, 'render', projectRoot, hmrOptions);\n }\n }\n };\n}\n\n/**\n * Send a 500 response without crashing the dev server.\n *\n * In dev mode, renders a styled HTML error page with source context,\n * classified stack trace, and auto-reload on HMR. Falls back to\n * text/plain if the HTML generator fails (must never crash).\n */\nfunction respond500(\n res: ServerResponse,\n error: unknown,\n phase: ErrorPhase,\n projectRoot: string,\n hmrOptions?: DevErrorHmrOptions\n): void {\n if (res.headersSent) return;\n\n // Try to render the rich HTML error page\n if (error instanceof Error) {\n try {\n const html = generateDevErrorPage(error, phase, projectRoot, hmrOptions);\n res.statusCode = 500;\n res.setHeader('content-type', 'text/html; charset=utf-8');\n res.end(html);\n return;\n } catch (e) {\n console.debug(\n '[timber] dev error page generation failed, falling back to text/plain:',\n e instanceof Error ? e.message : e\n );\n }\n }\n\n // Fallback: plain text (same as before)\n res.statusCode = 500;\n res.setHeader('content-type', 'text/plain');\n res.end(\n `[timber] Internal server error\\n\\n${error instanceof Error ? (error.stack ?? error.message) : String(error)}`\n );\n}\n\n/**\n * Add timber-specific context to an error's message if it references\n * internal virtual modules (virtual:timber-*). Mutates the error in place.\n */\nfunction addTimberContext(error: Error): void {\n const enriched = addVirtualModuleContext(error.message);\n if (enriched !== error.message) {\n error.message = enriched;\n }\n}\n\n// ─── Request/Response Conversion ──────────────────────────────────────────\n\n/**\n * Convert a Node IncomingMessage to a Web Request.\n *\n * Constructs the full URL from the Host header and request URL,\n * and forwards the method, headers, and body.\n *\n * The scheme comes from the socket's TLS state — with `server.https` the\n * browser sends `Origin: https://host`, and a hardcoded `http://` would\n * fail CSRF origin comparison on every POST. X-Forwarded-Proto is NOT\n * consulted: dev connections are direct, so the header would be\n * attacker-controlled. (TIM-1067, B32)\n *\n * Exported for tests.\n */\nexport function toWebRequest(nodeReq: IncomingMessage): Request {\n const protocol = (nodeReq.socket as TLSSocket | undefined)?.encrypted ? 'https' : 'http';\n // Under HTTP/2 there is no Host header — the authority lives in the\n // `:authority` pseudo-header.\n const host =\n nodeReq.headers.host ?? (nodeReq.headers[':authority'] as string | undefined) ?? 'localhost';\n const url = `${protocol}://${host}${nodeReq.url}`;\n\n const headers = new Headers();\n for (const [key, value] of Object.entries(nodeReq.headers)) {\n if (value === undefined) continue;\n // HTTP/2 pseudo-headers (:method, :path, :authority, :scheme) are not\n // valid Headers names — Headers.set() throws on them. They're already\n // reflected in the request URL/method above.\n if (key.startsWith(':')) continue;\n if (Array.isArray(value)) {\n for (const v of value) {\n headers.append(key, v);\n }\n } else {\n headers.set(key, value);\n }\n }\n // HTTP/2 requests carry the authority in `:authority`, not Host — but\n // downstream consumers (CSRF origin validation) read the Host header.\n if (!headers.has('host')) {\n headers.set('host', host);\n }\n\n const method = nodeReq.method ?? 'GET';\n const hasBody = method !== 'GET' && method !== 'HEAD';\n\n return new Request(url, {\n method,\n headers,\n body: hasBody ? nodeReadableToWebStream(nodeReq) : undefined,\n // @ts-expect-error — duplex is required for streaming request bodies\n duplex: hasBody ? 'half' : undefined,\n });\n}\n\n/**\n * Convert a Node Readable stream to a Web ReadableStream.\n */\nfunction nodeReadableToWebStream(nodeStream: IncomingMessage): ReadableStream<Uint8Array> {\n return new ReadableStream({\n start(controller) {\n nodeStream.on('data', (chunk: Buffer) => {\n controller.enqueue(new Uint8Array(chunk));\n });\n nodeStream.on('end', () => {\n controller.close();\n });\n nodeStream.on('error', (err) => {\n controller.error(err);\n });\n },\n });\n}\n\n// ─── URL Classification ──────────────────────────────────────────────────\n\n/**\n * Check if a URL is a Vite-internal request that should be passed through.\n */\nfunction isViteInternal(url: string): boolean {\n return VITE_INTERNAL_PREFIXES.some((prefix) => url.startsWith(prefix));\n}\n\n/**\n * Check if a URL looks like a static asset request.\n */\nfunction isAssetRequest(url: string): boolean {\n return ASSET_EXTENSIONS.test(url);\n}\n\n/**\n * Check if a URL maps to a real file in the project's public/ directory.\n * Vite serves public/ files as static assets — if a file exists there it\n * must be passed through to Vite regardless of extension.\n */\nfunction isPublicFile(server: ViteDevServer, url: string): boolean {\n const { publicDir } = server.config;\n if (!publicDir) return false;\n const pathname = url.split('?')[0];\n const relativePath = pathname.startsWith('/') ? pathname.slice(1) : pathname;\n if (!relativePath) return false;\n const fullPath = join(publicDir, relativePath);\n try {\n return statSync(fullPath).isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * Check whether an asset-extension URL belongs to a scanned route rather\n * than a static file.\n *\n * Route handlers may live at paths ending in asset-like extensions\n * (app/feed.json/route.ts → /feed.json), which the asset bypass would\n * otherwise hand to Vite — 404ing in dev while working in production.\n * Uses the same canonicalization and tree walker as the runtime matcher\n * so dev classification agrees with what the pipeline would match.\n *\n * A file that actually exists on disk wins over the route match: the\n * production server serves public/ statics before the RSC handler (see\n * adapters/nitro.ts), and Vite serves root-relative source files (e.g.\n * /app/global.css) in dev. Without this, a broad catch-all route like\n * app/[...slug] would shadow every static asset. Joining the canonical\n * pathname is traversal-safe — canonicalize() resolves `..` segments and\n * rejects root escapes and encoded separators.\n *\n * Reads ctx.routeTree per request — the routing plugin rescans it on\n * file add/unlink/change, so newly created routes are picked up live.\n */\nfunction isRouteOwnedAsset(\n routeTree: RouteTree | null,\n server: ViteDevServer,\n url: string\n): boolean {\n if (!routeTree) return false;\n const rawPathname = url.split('?')[0];\n const result = canonicalize(rawPathname);\n // Malformed URLs can't match a route — let Vite handle them as before.\n if (!result.ok) return false;\n const parts = result.pathname === '/' ? [] : result.pathname.slice(1).split('/');\n if (matchUrlParts(routeTree.root, parts) === null) return false;\n\n // Real static files win over the route match (dev/prod parity: the\n // production server tries public/ before the RSC handler).\n const relativePath = result.pathname.slice(1);\n const { publicDir, root } = server.config;\n if (publicDir && existsSync(join(publicDir, relativePath))) return false;\n if (existsSync(join(root, relativePath))) return false;\n\n return true;\n}\n\n// ─── Client Error Listener ─────────────────────────────────────────────\n\ninterface ClientErrorPayload {\n message: string;\n stack: string;\n componentStack: string | null;\n}\n\n/**\n * Listen for client-side errors forwarded from the browser via HMR.\n *\n * The browser entry catches uncaught errors and unhandled rejections,\n * then sends them as 'timber:client-error' custom events. We parse\n * the first app frame for the overlay's loc field and forward the\n * error to Vite's overlay protocol.\n */\nfunction listenForClientErrors(server: ViteDevServer, projectRoot: string): void {\n server.hot.on('timber:client-error', (data: ClientErrorPayload) => {\n const loc = parseFirstAppFrame(data.stack, projectRoot);\n\n let message = data.message;\n if (data.componentStack) {\n message = `${data.message}\\n\\nComponent Stack:\\n${data.componentStack.trim()}`;\n }\n\n // Log to stderr\n const RED = '\\x1b[31m';\n const BOLD = '\\x1b[1m';\n const RESET = '\\x1b[0m';\n process.stderr.write(\n `${RED}${BOLD}[timber] Client Error${RESET}\\n${RED}${data.message}${RESET}\\n\\n`\n );\n\n // Forward to Vite's overlay\n try {\n server.hot.send({\n type: 'error',\n err: {\n message,\n stack: data.stack,\n id: loc?.file,\n plugin: 'timber (Client)',\n loc: loc ? { file: loc.file, line: loc.line, column: loc.column } : undefined,\n },\n });\n } catch (e) {\n console.debug('[timber] overlay send failed:', e instanceof Error ? e.message : e);\n }\n });\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAS,iBAAiB,SAAS,QAAQ;CAC1C,IAAI;EACH,OAAO,kBAAkB,SAAS,QAAQ,KAAK,KAAK,QAAQ,QAAQ;CACrE,SAAS,OAAO;EACf,OAAO,QAAQ,OAAO,KAAK;CAC5B;AACD;AAyBA,SAAS,kBAAkB,SAAS,QAAQ,UAAU;CACrD,IAAI,CAAC,QAAQ;EACZ,QAAQ,aAAa;EACrB,OAAO,gBAAgB,SAAS,QAAQ;CACzC;CACA,IAAI,OAAO,iBAAiB;EAC3B,MAAM,MAAM,OAAO,gBAAgB;EACnC,IAAI,IAAI,MAAM;GACb,IAAI,IAAI,gBAAgB,gBAAgB;IACvC,UAAU,SAAS,IAAI,QAAQ,IAAI,YAAY,IAAI,OAAO;IAC1D,OAAO,WAAW,IAAI,MAAM,OAAO;GACpC,OAAO,IAAI,OAAO,IAAI,MAAM,SAAS,YAAY,OAAO,SAAS,IAAI,MAAM,SAAS,IAAI,QAAQ,IAAI,YAAY,IAAI,OAAO;GAC3H,UAAU,SAAS,IAAI,QAAQ,IAAI,YAAY,IAAI,OAAO;GAC1D,QAAQ,MAAM,IAAI,IAAI;EACvB,OAAO,UAAU,SAAS,IAAI,QAAQ,IAAI,YAAY,IAAI,OAAO;EACjE,OAAO,gBAAgB,SAAS,QAAQ;CACzC;CACA,MAAM,aAAa,CAAC;CACpB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,SAAS,WAAW,KAAK,KAAK,KAAK;CACrE,UAAU,SAAS,OAAO,QAAQ,OAAO,YAAY,UAAU;CAC/D,OAAO,OAAO,OAAO,WAAW,OAAO,MAAM,OAAO,IAAI,gBAAgB,S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