@timber-js/app 0.2.0-alpha.221 → 0.2.0-alpha.223
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/agent-skill.md +21 -5
- package/dist/_chunks/{actions-BDqn4Oxj.js → actions-7dTXYJfu.js} +53 -24
- package/dist/_chunks/actions-7dTXYJfu.js.map +1 -0
- package/dist/_chunks/{als-registry-BZqHCtq-.js → als-registry-DpygwCp0.js} +2 -3
- package/dist/_chunks/{als-registry-BZqHCtq-.js.map → als-registry-DpygwCp0.js.map} +1 -1
- package/dist/_chunks/{als-slots-BEEIPKYm.js → als-slots-kbQrHTzm.js} +2 -3
- package/dist/_chunks/{als-slots-BEEIPKYm.js.map → als-slots-kbQrHTzm.js.map} +1 -1
- package/dist/_chunks/{base-path-DaQrzbez.js → base-path-DDIx0FXe.js} +2 -3
- package/dist/_chunks/{base-path-DaQrzbez.js.map → base-path-DDIx0FXe.js.map} +1 -1
- package/dist/_chunks/{build-manifest-DWppEdLB.js → build-manifest-Y4jl7nwU.js} +2 -3
- package/dist/_chunks/{build-manifest-DWppEdLB.js.map → build-manifest-Y4jl7nwU.js.map} +1 -1
- package/dist/_chunks/{build-output-helper-RV_BRcF1.js → build-output-helper-B7wWGTfR.js} +14 -10
- package/dist/_chunks/build-output-helper-B7wWGTfR.js.map +1 -0
- package/dist/_chunks/{cache-api-GE4AOe2H.js → cache-api-TDZ4hlDc.js} +237 -37
- package/dist/_chunks/cache-api-TDZ4hlDc.js.map +1 -0
- package/dist/_chunks/{canonicalize-BAWkWiKK.js → canonicalize-CqK135BN.js} +29 -4
- package/dist/_chunks/{canonicalize-BAWkWiKK.js.map → canonicalize-CqK135BN.js.map} +1 -1
- package/dist/_chunks/chains-CwOr3Myj.js +1 -0
- package/dist/_chunks/{chains-e_Buf9vg.js → chains-Dgm3PrMe.js} +3 -4
- package/dist/_chunks/{chains-e_Buf9vg.js.map → chains-Dgm3PrMe.js.map} +1 -1
- package/dist/_chunks/{classify-2Yp3xJY1.js → classify--_kINHQV.js} +4 -5
- package/dist/_chunks/{classify-2Yp3xJY1.js.map → classify--_kINHQV.js.map} +1 -1
- package/dist/_chunks/{cli-check-DDwCkeDY.js → cli-check-Dv3f8d2j.js} +5 -6
- package/dist/_chunks/{cli-check-DDwCkeDY.js.map → cli-check-Dv3f8d2j.js.map} +1 -1
- package/dist/_chunks/{cli-context-_mPttGGY.js → cli-context-CbZp32SK.js} +3 -4
- package/dist/_chunks/{cli-context-_mPttGGY.js.map → cli-context-CbZp32SK.js.map} +1 -1
- package/dist/_chunks/cli-context-n5hmkdla.js +1 -0
- package/dist/_chunks/cli-dev-status-prPMLU8G.js +138 -0
- package/dist/_chunks/cli-dev-status-prPMLU8G.js.map +1 -0
- package/dist/_chunks/cli-init-BoXOYYil.js +196 -0
- package/dist/_chunks/cli-init-BoXOYYil.js.map +1 -0
- package/dist/_chunks/{cli-schema-sync-BdIebmk3.js → cli-schema-sync-DIPurq7X.js} +4 -5
- package/dist/_chunks/{cli-schema-sync-BdIebmk3.js.map → cli-schema-sync-DIPurq7X.js.map} +1 -1
- package/dist/_chunks/{cli-schema-sync-CLNfXQDK.js → cli-schema-sync-uq72EZmD.js} +1 -1
- package/dist/_chunks/{client-dep-entries-BOkpKjj1.js → client-dep-entries-CP7AkMCM.js} +4 -5
- package/dist/_chunks/{client-dep-entries-BOkpKjj1.js.map → client-dep-entries-CP7AkMCM.js.map} +1 -1
- package/dist/_chunks/{cloudflare-Byxl8FWP.js → cloudflare-B75X6u4O.js} +10 -13
- package/dist/_chunks/{cloudflare-Byxl8FWP.js.map → cloudflare-B75X6u4O.js.map} +1 -1
- package/dist/_chunks/{codec-registry-oOUxugz3.js → codec-registry-CPc6bjVl.js} +2 -3
- package/dist/_chunks/{codec-registry-oOUxugz3.js.map → codec-registry-CPc6bjVl.js.map} +1 -1
- package/dist/_chunks/{codegen-Bps1sLKJ.js → codegen-B9oWkWGf.js} +5 -8
- package/dist/_chunks/{codegen-Bps1sLKJ.js.map → codegen-B9oWkWGf.js.map} +1 -1
- package/dist/_chunks/{convention-lint-ByKJ6aqD.js → convention-lint-hZwz5wd4.js} +8 -11
- package/dist/_chunks/{convention-lint-ByKJ6aqD.js.map → convention-lint-hZwz5wd4.js.map} +1 -1
- package/dist/_chunks/dev-discovery-YnabkCKD.js +238 -0
- package/dist/_chunks/dev-discovery-YnabkCKD.js.map +1 -0
- package/dist/_chunks/{dev-server-DIy-SY-J.js → dev-server-C61GWpGg.js} +409 -51
- package/dist/_chunks/dev-server-C61GWpGg.js.map +1 -0
- package/dist/_chunks/dev-server-CBvvM7Lr.js +1 -0
- package/dist/_chunks/{dev-store-BOa304m_.js → dev-store-BvdqtHvK.js} +82 -38
- package/dist/_chunks/dev-store-BvdqtHvK.js.map +1 -0
- package/dist/_chunks/{dist-DtrJyBbw.js → dist-C1Rjlo6s.js} +3 -5
- package/dist/_chunks/{dist-DtrJyBbw.js.map → dist-C1Rjlo6s.js.map} +1 -1
- package/dist/_chunks/{error-boundary-Bc8QPZuq.js → error-boundary-DRQXGWCp.js} +20 -27
- package/dist/_chunks/{error-boundary-Bc8QPZuq.js.map → error-boundary-DRQXGWCp.js.map} +1 -1
- package/dist/_chunks/{fast-hash-C-tVYrLb.js → fast-hash-DddxkU5Y.js} +2 -3
- package/dist/_chunks/{fast-hash-C-tVYrLb.js.map → fast-hash-DddxkU5Y.js.map} +1 -1
- package/dist/_chunks/{flight-source-node-HptmGMT8.js → flight-source-node-0Tp6evlz.js} +6 -8
- package/dist/_chunks/flight-source-node-0Tp6evlz.js.map +1 -0
- package/dist/_chunks/{format-BKclgVbk.js → format-DuPOoXUP.js} +2 -3
- package/dist/_chunks/{format-BKclgVbk.js.map → format-DuPOoXUP.js.map} +1 -1
- package/dist/_chunks/{fs-identity-BRKuL215.js → fs-identity-BmQ_Agg-.js} +3 -5
- package/dist/_chunks/{fs-identity-BRKuL215.js.map → fs-identity-BmQ_Agg-.js.map} +1 -1
- package/dist/_chunks/global-context-DbxNWeBP.js +47 -0
- package/dist/_chunks/global-context-DbxNWeBP.js.map +1 -0
- package/dist/_chunks/{graph-cache-CYiUS2aS.js → graph-cache-B1LAg4t7.js} +5 -89
- package/dist/_chunks/graph-cache-B1LAg4t7.js.map +1 -0
- package/dist/_chunks/{href-validation-BIrxavIy.js → href-validation-CEZy1V-k.js} +4 -7
- package/dist/_chunks/{href-validation-BIrxavIy.js.map → href-validation-CEZy1V-k.js.map} +1 -1
- package/dist/_chunks/{json-lossy-check-C8zBY2uZ.js → json-lossy-check-DVkLUlfC.js} +3 -4
- package/dist/_chunks/{json-lossy-check-C8zBY2uZ.js.map → json-lossy-check-DVkLUlfC.js.map} +1 -1
- package/dist/_chunks/{live-graph-tSWrv8eH.js → live-graph-BcVjQ1Te.js} +6 -7
- package/dist/_chunks/{live-graph-tSWrv8eH.js.map → live-graph-BcVjQ1Te.js.map} +1 -1
- package/dist/_chunks/{logger-CbLdcy-W.js → logger-CWk44DLp.js} +97 -47
- package/dist/_chunks/logger-CWk44DLp.js.map +1 -0
- package/dist/_chunks/{metadata-routes-B3XJNyIH.js → metadata-routes-BL26HCDd.js} +2 -3
- package/dist/_chunks/{metadata-routes-B3XJNyIH.js.map → metadata-routes-BL26HCDd.js.map} +1 -1
- package/dist/_chunks/{navigation-root-BQfo1-kG.js → navigation-root-M3B2ZrdO.js} +6 -10
- package/dist/_chunks/{navigation-root-BQfo1-kG.js.map → navigation-root-M3B2ZrdO.js.map} +1 -1
- package/dist/_chunks/{node-response-rkQqcFGq.js → node-response-B9aviPDa.js} +43 -9
- package/dist/_chunks/node-response-B9aviPDa.js.map +1 -0
- package/dist/_chunks/{param-value-C8TNYchQ.js → param-value-DqlGfF57.js} +2 -3
- package/dist/_chunks/{param-value-C8TNYchQ.js.map → param-value-DqlGfF57.js.map} +1 -1
- package/dist/_chunks/{plugin-context-uDHFqHHJ.js → plugin-context-BfSRKJfz.js} +1 -1
- package/dist/_chunks/{plugin-context-DxMMvjUt.js → plugin-context-FCkaNLUB.js} +4 -6
- package/dist/_chunks/plugin-context-FCkaNLUB.js.map +1 -0
- package/dist/_chunks/{poison-rules-DoEhbqaY.js → poison-rules-Bmz-lCPi.js} +2 -3
- package/dist/_chunks/{poison-rules-DoEhbqaY.js.map → poison-rules-Bmz-lCPi.js.map} +1 -1
- package/dist/_chunks/{poison-scan-C4FgMxFl.js → poison-scan-DJYxZc_7.js} +4 -5
- package/dist/_chunks/{poison-scan-C4FgMxFl.js.map → poison-scan-DJYxZc_7.js.map} +1 -1
- package/dist/_chunks/{purge-store-WZaxu-3m.js → purge-store-8BqLAYZ1.js} +2 -3
- package/dist/_chunks/{purge-store-WZaxu-3m.js.map → purge-store-8BqLAYZ1.js.map} +1 -1
- package/dist/_chunks/{render-timeout-joFhz4KH.js → render-timeout-MrrqD1wd.js} +20 -4
- package/dist/_chunks/{render-timeout-joFhz4KH.js.map → render-timeout-MrrqD1wd.js.map} +1 -1
- package/dist/_chunks/{resolve-schema-CBR6Lm4i.js → resolve-schema-B-aCuTu3.js} +3 -4
- package/dist/_chunks/{resolve-schema-CBR6Lm4i.js.map → resolve-schema-B-aCuTu3.js.map} +1 -1
- package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js → rsc-cache-key-D0cb0Gmc.js} +2 -3
- package/dist/_chunks/{rsc-cache-key-ClUiXQnK.js.map → rsc-cache-key-D0cb0Gmc.js.map} +1 -1
- package/dist/_chunks/{rsc-media-type-DDc7duTD.js → rsc-media-type-m8jz9u6_.js} +2 -3
- package/dist/_chunks/{rsc-media-type-DDc7duTD.js.map → rsc-media-type-m8jz9u6_.js.map} +1 -1
- package/dist/_chunks/{rsc-payload-path-dffcs4jp.js → rsc-payload-path-EphpDB-J.js} +2 -3
- package/dist/_chunks/{rsc-payload-path-dffcs4jp.js.map → rsc-payload-path-EphpDB-J.js.map} +1 -1
- package/dist/_chunks/{scan-BoP17W3w.js → scan-CyizcBiX.js} +2 -3
- package/dist/_chunks/{scan-BoP17W3w.js.map → scan-CyizcBiX.js.map} +1 -1
- package/dist/_chunks/{scanner-Cb3fSjAC.js → scanner-CJC-ScJU.js} +15 -23
- package/dist/_chunks/{scanner-Cb3fSjAC.js.map → scanner-CJC-ScJU.js.map} +1 -1
- package/dist/_chunks/{schema-bridge-C83xa9lT.js → schema-bridge-DyRs3cqy.js} +61 -25
- package/dist/_chunks/schema-bridge-DyRs3cqy.js.map +1 -0
- package/dist/_chunks/{segment-classify-C539Pa2O.js → segment-classify-Ho8jXWeC.js} +3 -5
- package/dist/_chunks/{segment-classify-C539Pa2O.js.map → segment-classify-Ho8jXWeC.js.map} +1 -1
- package/dist/_chunks/{segment-context-xtPUGfdq.js → segment-context-CYiGTi3K.js} +6 -12
- package/dist/_chunks/segment-context-CYiGTi3K.js.map +1 -0
- package/dist/_chunks/{segment-keys-D5hu1hz4.js → segment-keys-Y60KNc8C.js} +2 -3
- package/dist/_chunks/{segment-keys-D5hu1hz4.js.map → segment-keys-Y60KNc8C.js.map} +1 -1
- package/dist/_chunks/{singleflight-BeVMMKi0.js → singleflight-BChPMjwH.js} +2 -3
- package/dist/_chunks/{singleflight-BeVMMKi0.js.map → singleflight-BChPMjwH.js.map} +1 -1
- package/dist/_chunks/{sizeof-QPE5nd3u.js → sizeof-DG4W40lv.js} +3 -4
- package/dist/_chunks/{sizeof-QPE5nd3u.js.map → sizeof-DG4W40lv.js.map} +1 -1
- package/dist/_chunks/{ssr-data-nA3I70_n.js → ssr-data-9hPtcNOr.js} +3 -4
- package/dist/_chunks/{ssr-data-nA3I70_n.js.map → ssr-data-9hPtcNOr.js.map} +1 -1
- package/dist/_chunks/{state-BhNGPsdi.js → state-B-EBjeER.js} +2 -3
- package/dist/_chunks/{state-BhNGPsdi.js.map → state-B-EBjeER.js.map} +1 -1
- package/dist/_chunks/{status-page-marker-BRX9Ib-d.js → status-page-marker-XIQXlTOb.js} +8 -13
- package/dist/_chunks/{status-page-marker-BRX9Ib-d.js.map → status-page-marker-XIQXlTOb.js.map} +1 -1
- package/dist/_chunks/{tree-match-6yihorhk.js → tree-match-Bqdr9szG.js} +2 -3
- package/dist/_chunks/{tree-match-6yihorhk.js.map → tree-match-Bqdr9szG.js.map} +1 -1
- package/dist/_chunks/{use-query-states-I3JMng6J.js → use-query-states-pkDV-jSg.js} +4 -7
- package/dist/_chunks/{use-query-states-I3JMng6J.js.map → use-query-states-pkDV-jSg.js.map} +1 -1
- package/dist/_chunks/{walkers-qu8TpiLh.js → walkers-DIE203ir.js} +6 -8
- package/dist/_chunks/{walkers-qu8TpiLh.js.map → walkers-DIE203ir.js.map} +1 -1
- package/dist/_chunks/{write-file-atomic-D1qWqHb4.js → write-file-atomic-DW8m_Atv.js} +2 -3
- package/dist/_chunks/{write-file-atomic-D1qWqHb4.js.map → write-file-atomic-DW8m_Atv.js.map} +1 -1
- package/dist/adapters/build-output-helper.d.ts +10 -1
- package/dist/adapters/build-output-helper.d.ts.map +1 -1
- package/dist/adapters/cloudflare-dev.js +2 -3
- package/dist/adapters/cloudflare-kv-cache.js +3 -4
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +1 -1
- package/dist/adapters/nitro-presets.d.ts +6 -0
- package/dist/adapters/nitro-presets.d.ts.map +1 -1
- package/dist/adapters/nitro-preview.d.ts.map +1 -1
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +94 -57
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/analyze/crawl-entry.js +7 -9
- package/dist/analyze/crawl-entry.js.map +1 -1
- package/dist/analyze/graph-command.d.ts.map +1 -1
- package/dist/analyze/graph-command.js +19 -105
- package/dist/analyze/graph-command.js.map +1 -1
- package/dist/cache/guarded-read.d.ts +29 -0
- package/dist/cache/guarded-read.d.ts.map +1 -0
- package/dist/cache/index.js +3 -3
- package/dist/cache/key-discipline.d.ts +61 -0
- package/dist/cache/key-discipline.d.ts.map +1 -0
- package/dist/cache/stores/cloudflare-kv.js +1 -2
- package/dist/cache/stores/memory.js +2 -3
- package/dist/cache/stores/redis.js +1 -2
- package/dist/cache/stores/vercel.js +1 -2
- package/dist/cache/timber-cache.d.ts +5 -1
- package/dist/cache/timber-cache.d.ts.map +1 -1
- package/dist/cdn/cloudflare-purge.js +1 -2
- package/dist/cdn/fastly-purge.js +1 -2
- package/dist/cdn/index.js +2 -3
- package/dist/cdn/workers-cache-purge.js +3 -5
- package/dist/cdn/workers-cache-purge.js.map +1 -1
- package/dist/cli-dev-status.d.ts +75 -0
- package/dist/cli-dev-status.d.ts.map +1 -0
- package/dist/cli-init.d.ts +72 -0
- package/dist/cli-init.d.ts.map +1 -0
- package/dist/cli.d.ts +4 -12
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +27 -54
- package/dist/cli.js.map +1 -1
- package/dist/client/error-boundary.d.ts.map +1 -1
- package/dist/client/error-boundary.js +1 -1
- package/dist/client/global-context.d.ts +21 -1
- package/dist/client/global-context.d.ts.map +1 -1
- package/dist/client/index.js +23 -44
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.js +13 -18
- package/dist/client/internal.js.map +1 -1
- package/dist/client/navigation-context.d.ts.map +1 -1
- package/dist/client/params-context.d.ts.map +1 -1
- package/dist/client/slot-context.d.ts +2 -2
- package/dist/client/slot-context.d.ts.map +1 -1
- package/dist/client/use-cookie.d.ts +18 -5
- package/dist/client/use-cookie.d.ts.map +1 -1
- package/dist/codec.js +2 -3
- package/dist/config-types.d.ts +22 -5
- package/dist/config-types.d.ts.map +1 -1
- package/dist/config-validation.d.ts.map +1 -1
- package/dist/cookies/define-cookie.d.ts.map +1 -1
- package/dist/cookies/index.js +40 -67
- package/dist/cookies/index.js.map +1 -1
- package/dist/cookies/json-cookie.d.ts +4 -4
- package/dist/index.js +266 -229
- package/dist/index.js.map +1 -1
- package/dist/params/index.js +3 -4
- package/dist/plugin-context.d.ts +7 -0
- package/dist/plugin-context.d.ts.map +1 -1
- package/dist/plugins/dev-discovery.d.ts +69 -5
- package/dist/plugins/dev-discovery.d.ts.map +1 -1
- package/dist/plugins/dev-hostname.d.ts +152 -0
- package/dist/plugins/dev-hostname.d.ts.map +1 -0
- package/dist/plugins/dev-server.d.ts +6 -2
- package/dist/plugins/dev-server.d.ts.map +1 -1
- package/dist/plugins/dev-store-clear.d.ts +83 -0
- package/dist/plugins/dev-store-clear.d.ts.map +1 -0
- package/dist/plugins/graph-endpoint.d.ts +4 -2
- package/dist/plugins/graph-endpoint.d.ts.map +1 -1
- package/dist/plugins/prebuilt.d.ts.map +1 -1
- package/dist/routing/index.js +4 -4
- package/dist/rsc-runtime/rsc.d.ts +2 -1
- package/dist/rsc-runtime/rsc.d.ts.map +1 -1
- package/dist/rsc-runtime/server-references.d.ts +8 -0
- package/dist/rsc-runtime/server-references.d.ts.map +1 -0
- package/dist/schema-bridge.d.ts +28 -19
- package/dist/schema-bridge.d.ts.map +1 -1
- package/dist/search-params/define.d.ts +1 -1
- package/dist/search-params/define.d.ts.map +1 -1
- package/dist/search-params/index.js +11 -14
- package/dist/search-params/index.js.map +1 -1
- package/dist/search-params/wrappers.d.ts +3 -3
- package/dist/server/access-gate.d.ts +12 -0
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/canonicalize.d.ts +21 -0
- package/dist/server/canonicalize.d.ts.map +1 -1
- package/dist/server/cookie-context.d.ts +8 -1
- package/dist/server/cookie-context.d.ts.map +1 -1
- package/dist/server/flight-source-node.d.ts.map +1 -1
- package/dist/server/flight-source.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +8 -13
- package/dist/server/index.js.map +1 -1
- package/dist/server/interception-gates.d.ts +49 -0
- package/dist/server/interception-gates.d.ts.map +1 -0
- package/dist/server/internal.js +1080 -959
- package/dist/server/internal.js.map +1 -1
- package/dist/server/logger.d.ts +26 -0
- package/dist/server/logger.d.ts.map +1 -1
- package/dist/server/param-coercion.d.ts +8 -0
- package/dist/server/param-coercion.d.ts.map +1 -1
- package/dist/server/pipeline-interception.d.ts +34 -4
- package/dist/server/pipeline-interception.d.ts.map +1 -1
- package/dist/server/pipeline-metadata-route.d.ts +24 -0
- package/dist/server/pipeline-metadata-route.d.ts.map +1 -0
- package/dist/server/pipeline-metadata.d.ts +3 -2
- package/dist/server/pipeline-metadata.d.ts.map +1 -1
- package/dist/server/pipeline-phases.d.ts +9 -3
- package/dist/server/pipeline-phases.d.ts.map +1 -1
- package/dist/server/pipeline.d.ts +18 -0
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/prebuilt/dev-store.d.ts +68 -22
- package/dist/server/prebuilt/dev-store.d.ts.map +1 -1
- package/dist/server/prebuilt/overlay.d.ts +17 -3
- package/dist/server/prebuilt/overlay.d.ts.map +1 -1
- package/dist/server/prebuilt-runtime.d.ts.map +1 -1
- package/dist/server/primitives.d.ts +13 -0
- package/dist/server/primitives.d.ts.map +1 -1
- package/dist/server/render-utils.d.ts +21 -0
- package/dist/server/render-utils.d.ts.map +1 -1
- package/dist/server/request-context.d.ts +14 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/route-handler.d.ts +7 -0
- package/dist/server/route-handler.d.ts.map +1 -1
- package/dist/server/route-matcher.d.ts +14 -3
- package/dist/server/route-matcher.d.ts.map +1 -1
- package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/signal-identity.d.ts +6 -0
- package/dist/server/signal-identity.d.ts.map +1 -1
- package/dist/server/traced-access.d.ts +18 -0
- package/dist/server/traced-access.d.ts.map +1 -0
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/server/types.d.ts +5 -4
- package/dist/server/types.d.ts.map +1 -1
- package/dist/shims/font-google.js +1 -2
- package/dist/shims/font-local.js +1 -2
- package/dist/shims/headers.d.ts +11 -4
- package/dist/shims/headers.d.ts.map +1 -1
- package/docs/api/30-api-server.mdx +3 -1
- package/docs/api/32-api-cache.mdx +1 -1
- package/docs/api/33-api-search-params.mdx +3 -1
- package/docs/api/34-api-config.mdx +22 -0
- package/docs/api/36-cli.mdx +72 -6
- package/docs/learn/01-quick-start.mdx +1 -1
- package/docs/learn/06-typed-params.mdx +4 -4
- package/docs/learn/10-caching.mdx +26 -5
- package/llms.txt +1 -1
- package/package.json +12 -12
- package/src/adapters/build-output-helper.ts +26 -4
- package/src/adapters/cloudflare.ts +1 -0
- package/src/adapters/nitro-presets.ts +15 -0
- package/src/adapters/nitro-preview.ts +66 -34
- package/src/adapters/nitro.ts +14 -6
- package/src/analyze/graph-command.ts +25 -133
- package/src/cache/guarded-read.ts +44 -0
- package/src/cache/key-discipline.ts +218 -0
- package/src/cache/timber-cache.ts +46 -7
- package/src/cli-dev-status.ts +196 -0
- package/src/cli-init.ts +278 -0
- package/src/cli.ts +33 -79
- package/src/client/error-boundary.tsx +19 -2
- package/src/client/global-context.ts +42 -14
- package/src/client/navigation-context.ts +4 -11
- package/src/client/params-context.ts +5 -17
- package/src/client/segment-update-context.ts +1 -1
- package/src/client/slot-content-cache-context.ts +1 -1
- package/src/client/slot-context.ts +6 -17
- package/src/client/use-cookie.ts +33 -21
- package/src/config-types.ts +22 -5
- package/src/config-validation.ts +17 -0
- package/src/cookies/define-cookie.ts +10 -46
- package/src/cookies/json-cookie.ts +4 -4
- package/src/plugin-context.ts +7 -0
- package/src/plugins/dev-discovery.ts +216 -6
- package/src/plugins/dev-hostname.ts +322 -0
- package/src/plugins/dev-server.ts +130 -37
- package/src/plugins/dev-store-clear.ts +145 -0
- package/src/plugins/graph-endpoint.ts +15 -3
- package/src/plugins/prebuilt.ts +9 -0
- package/src/rsc-runtime/rsc.ts +7 -3
- package/src/rsc-runtime/server-references.ts +73 -0
- package/src/rsc-runtime/vendor-types.d.ts +17 -0
- package/src/schema-bridge.ts +93 -38
- package/src/search-params/define.ts +5 -6
- package/src/search-params/wrappers.ts +3 -3
- package/src/server/access-gate.tsx +32 -20
- package/src/server/action-handler.ts +58 -36
- package/src/server/canonicalize.ts +27 -0
- package/src/server/cookie-context.ts +11 -3
- package/src/server/flight-source-node.ts +5 -2
- package/src/server/flight-source.ts +4 -3
- package/src/server/index.ts +6 -1
- package/src/server/interception-gates.ts +94 -0
- package/src/server/logger.ts +32 -0
- package/src/server/param-coercion.ts +22 -0
- package/src/server/pipeline-interception.ts +64 -4
- package/src/server/pipeline-metadata-route.ts +242 -0
- package/src/server/pipeline-metadata.ts +7 -5
- package/src/server/pipeline-phases.ts +71 -131
- package/src/server/pipeline.ts +20 -2
- package/src/server/prebuilt/dev-store.ts +113 -34
- package/src/server/prebuilt/overlay.ts +32 -4
- package/src/server/prebuilt-runtime.ts +63 -45
- package/src/server/primitives.ts +14 -0
- package/src/server/render-utils.ts +25 -0
- package/src/server/request-context.ts +27 -3
- package/src/server/route-element-builder.ts +15 -2
- package/src/server/route-handler.ts +3 -2
- package/src/server/route-matcher.ts +48 -33
- package/src/server/rsc-entry/api-handler.ts +2 -33
- package/src/server/rsc-entry/index.ts +8 -3
- package/src/server/rsc-entry/rsc-stream.ts +7 -1
- package/src/server/signal-identity.ts +30 -12
- package/src/server/traced-access.ts +50 -0
- package/src/server/tracing.ts +18 -1
- package/src/server/types.ts +5 -4
- package/src/shims/headers.ts +12 -4
- package/dist/_chunks/actions-BDqn4Oxj.js.map +0 -1
- package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +0 -1
- package/dist/_chunks/cache-api-GE4AOe2H.js.map +0 -1
- package/dist/_chunks/chains-CDK1AWZQ.js +0 -1
- package/dist/_chunks/cli-context-BJQB6rtF.js +0 -1
- package/dist/_chunks/dev-server-BiWNMBVU.js +0 -1
- package/dist/_chunks/dev-server-DIy-SY-J.js.map +0 -1
- package/dist/_chunks/dev-store-BOa304m_.js.map +0 -1
- package/dist/_chunks/flight-source-node-HptmGMT8.js.map +0 -1
- package/dist/_chunks/graph-cache-CYiUS2aS.js.map +0 -1
- package/dist/_chunks/logger-CbLdcy-W.js.map +0 -1
- package/dist/_chunks/node-response-rkQqcFGq.js.map +0 -1
- package/dist/_chunks/plugin-context-DxMMvjUt.js.map +0 -1
- package/dist/_chunks/schema-bridge-C83xa9lT.js.map +0 -1
- package/dist/_chunks/segment-context-xtPUGfdq.js.map +0 -1
- package/dist/server/prebuilt/key-discipline.d.ts +0 -52
- package/dist/server/prebuilt/key-discipline.d.ts.map +0 -1
- package/src/server/prebuilt/key-discipline.ts +0 -122
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walkers-qu8TpiLh.js","names":[],"sources":["../../src/routing/schema-validation.ts","../../src/routing/walkers.ts"],"sourcesContent":["/**\n * Schema key/value validation against the filesystem route tree.\n *\n * Runs at codegen time (build + dev) to catch mismatches between\n * app/schema.ts keys and the actual dynamic segments on disk.\n *\n * Design doc: design/41-global-params.md\n */\n\nimport { readFileCached } from './file-cache.ts';\nimport type { RouteTree, SegmentNode } from './types.ts';\nimport { findSchemaFile, parseExistingSchemaKeys } from '../cli-schema-sync.ts';\nimport { classifyUrlSegment } from './segment-classify.ts';\n\nexport interface SchemaWarning {\n type: 'stale-key' | 'missing-key' | 'bracket-mismatch';\n key: string;\n message: string;\n filesystemKey?: string;\n}\n\n/**\n * Collect all unique bracket-keyed dynamic segment names from a route tree.\n * Returns entries like '[artistSlug]', '[...slug]', '[[...topic]]'.\n */\nexport function collectDynamicSegmentsFromTree(tree: RouteTree): Set<string> {\n const segments = new Set<string>();\n walkTree(tree.root, segments);\n return segments;\n}\n\nfunction walkTree(node: SegmentNode, segments: Set<string>): void {\n if (node.paramName && node.segmentName) {\n const classified = classifyUrlSegment(node.segmentName);\n if (classified.kind !== 'static') {\n // Use bare bracket form for schema keys — affixed segments like\n // `img-[id].png` register as `[id]`, matching runtime codec lookup.\n if (classified.kind === 'dynamic' && (classified.prefix || classified.suffix)) {\n segments.add(`[${classified.name}]`);\n } else {\n segments.add(node.segmentName);\n }\n }\n }\n for (const child of node.children) {\n walkTree(child, segments);\n }\n for (const slot of Object.values(node.slots)) {\n walkTree(slot, segments);\n }\n}\n\n/**\n * Extract the param name from a bracket key.\n * '[id]' → 'id', '[...slug]' → 'slug', '[[...topic]]' → 'topic'\n */\nfunction extractParamName(bracketKey: string): string | null {\n const seg = classifyUrlSegment(bracketKey);\n if (seg.kind === 'static') return null;\n return seg.name;\n}\n\n/**\n * Validate schema keys against the filesystem route tree.\n *\n * Returns warnings for:\n * - Stale keys: schema keys that don't match any filesystem segment\n * - Bracket form mismatches: same param name, different bracket form\n * - Missing keys: filesystem segments not registered in schema (informational)\n */\nexport function validateSchemaAgainstRoutes(tree: RouteTree, appDir: string): SchemaWarning[] {\n const schemaPath = findSchemaFile(appDir);\n if (!schemaPath) return [];\n\n const content = readFileCached(schemaPath);\n const schemaKeys = parseExistingSchemaKeys(content);\n\n if (schemaKeys.length === 0) return [];\n\n const filesystemSegments = collectDynamicSegmentsFromTree(tree);\n\n return validateKeys(schemaKeys, filesystemSegments);\n}\n\n/**\n * Core validation: compare schema keys against filesystem segments.\n * Exported separately for testing without filesystem dependencies.\n */\nexport function validateKeys(\n schemaKeys: string[],\n filesystemSegments: Set<string>\n): SchemaWarning[] {\n const warnings: SchemaWarning[] = [];\n\n // Build a map of param name → bracket form for filesystem segments\n const fsParamToKey = new Map<string, string>();\n for (const fsKey of filesystemSegments) {\n const name = extractParamName(fsKey);\n if (name) {\n fsParamToKey.set(name, fsKey);\n }\n }\n\n // Build a set of schema param names for the missing-key check\n const schemaParamNames = new Set<string>();\n\n for (const schemaKey of schemaKeys) {\n const schemaParamName = extractParamName(schemaKey);\n if (!schemaParamName) continue;\n\n schemaParamNames.add(schemaParamName);\n\n if (filesystemSegments.has(schemaKey)) {\n // Exact match — no issue\n continue;\n }\n\n // Check if the param name exists but with a different bracket form\n const fsKey = fsParamToKey.get(schemaParamName);\n if (fsKey) {\n warnings.push({\n type: 'bracket-mismatch',\n key: schemaKey,\n filesystemKey: fsKey,\n message:\n `Schema key '${schemaKey}' does not match filesystem bracket form '${fsKey}'. ` +\n `Update the schema key to '${fsKey}'.`,\n });\n } else {\n warnings.push({\n type: 'stale-key',\n key: schemaKey,\n message:\n `Schema key '${schemaKey}' does not match any dynamic segment in the filesystem. ` +\n `Remove it from app/schema.ts or create the corresponding route segment.`,\n });\n }\n }\n\n // Check for filesystem segments not in schema (informational)\n for (const fsKey of filesystemSegments) {\n const name = extractParamName(fsKey);\n if (name && !schemaParamNames.has(name)) {\n warnings.push({\n type: 'missing-key',\n key: fsKey,\n message:\n `Dynamic segment '${fsKey}' has no codec in app/schema.ts (defaults to string). ` +\n `Run: timber schema sync`,\n });\n }\n }\n\n return warnings;\n}\n","/**\n * Shared route-tree walkers (TIM-848).\n *\n * Tiny helpers that walk a `SegmentNode<TFile>` tree generically. Both the\n * build-time tree (`SegmentNode<RouteFile>`) and the runtime manifest\n * tree (`SegmentNode<ManifestFile>`) flow through these helpers because\n * the walker only reads the structural fields shared by both shapes\n * (`children`, `slots`, `page`, `route`, `urlPath`).\n *\n * Before this module, three near-identical `collectRoutes` functions\n * lived in `plugins/dev-404-page.ts`, `plugins/build-report.ts`, and\n * `routing/codegen.ts`. The codegen one is special-purpose (it\n * accumulates `ParamEntry[]` and resolves codec chains) and stays\n * local; the other two now share `collectLeafRoutes` from this file.\n */\n\nimport type { SegmentNode } from './types.ts';\n\n/** A leaf route discovered while walking the segment tree. */\nexport interface LeafRoute<TFile> {\n /** URL path of the leaf (root is \"/\"). */\n urlPath: string;\n /** Segment chain from root to this leaf, inclusive. */\n segments: SegmentNode<TFile>[];\n /** The page file at this leaf, if any. */\n page?: TFile;\n /** The route handler file at this leaf, if any. */\n route?: TFile;\n}\n\n/** Options for `collectLeafRoutes`. */\nexport interface CollectLeafRoutesOptions {\n /**\n * If true, recurse into parallel slots and emit slot leaves alongside\n * the main route tree. Defaults to `false` because slots render\n * alongside their parent at the same URL and are not separately\n * URL-addressable. The build report excludes slots; route-listing\n * UIs that want to show \"all leaves with a page handler\" can opt in.\n */\n includeSlots?: boolean;\n}\n\n/**\n * Walk a segment tree and collect every leaf with a `page` or `route`\n * handler. Generic over `TFile` so it works on both the build-time\n * scanner output and the runtime manifest tree.\n *\n * - Pages and route handlers at the same URL produce two distinct\n * entries (the build report deduplicates by URL afterward).\n * - Parallel slots are skipped unless `includeSlots: true` (slots\n * share their parent's URL and are not addressable on their own).\n * - Intercepting subtrees are skipped unconditionally. They render only\n * on soft navigation and add no URL depth, so their computed `urlPath`s\n * are not addresses — listing them would advertise routes (`/[year]`)\n * that no request can reach. This matches every other consumer of the\n * tree that produces URLs: the sitemap generator, the static generator,\n * prerendering and the prebuilt-payload builder all skip them too.\n * - Result is sorted by `urlPath` for deterministic output.\n */\nexport function collectLeafRoutes<TFile>(\n root: SegmentNode<TFile>,\n options: CollectLeafRoutesOptions = {}\n): LeafRoute<TFile>[] {\n const { includeSlots = false } = options;\n const result: LeafRoute<TFile>[] = [];\n walk(root, [], result, includeSlots);\n result.sort((a, b) => a.urlPath.localeCompare(b.urlPath));\n return result;\n}\n\nfunction walk<TFile>(\n node: SegmentNode<TFile>,\n chain: SegmentNode<TFile>[],\n result: LeafRoute<TFile>[],\n includeSlots: boolean\n): void {\n if (node.segmentType === 'intercepting') return;\n\n const currentChain = [...chain, node];\n const path = node.urlPath || '/';\n\n if (node.page) {\n result.push({ urlPath: path, segments: currentChain, page: node.page });\n }\n if (node.route) {\n result.push({ urlPath: path, segments: currentChain, route: node.route });\n }\n\n for (const child of node.children) {\n walk(child, currentChain, result, includeSlots);\n }\n\n if (includeSlots) {\n for (const slotNode of Object.values(node.slots)) {\n walk(slotNode, currentChain, result, includeSlots);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,SAAgB,+BAA+B,MAA8B;CAC3E,MAAM,2BAAW,IAAI,IAAY;CACjC,SAAS,KAAK,MAAM,QAAQ;CAC5B,OAAO;AACT;AAEA,SAAS,SAAS,MAAmB,UAA6B;CAChE,IAAI,K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Z,MAAM;GACN,KAAK;GACL,eAAe;GACf,SACE,eAAe,UAAU,4CAA4C,MAAM,+BAC9C,MAAM;EACvC,CAAC;OAED,SAAS,KAAK;GACZ,MAAM;GACN,KAAK;GACL,SACE,eAAe,UAAU;EAE7B,CAAC;CAEL;CAGA,KAAK,MAAM,SAAS,oBAAoB;EACtC,MAAM,OAAO,iBAAiB,KAAK;EACnC,IAAI,QAAQ,CAAC,iBAAiB,IAAI,IAAI,GACpC,SAAS,KAAK;GACZ,MAAM;GACN,KAAK;GACL,SACE,oBAAoB,MAAM;EAE9B,CAAC;CAEL;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;;;;;AC/FA,SAAgB,kBACd,MACA,UAAoC,CAAC,GACjB;CACpB,MAAM,EAAE,eAAe,UAAU;CACjC,MAAM,SAA6B,CAAC;CACpC,KAAK,MAAM,CAAC,GAAG,QAAQ,YAAY;CACnC,OAAO,MAAM,GAAG,MAAM,EAAE,QAAQ,cAAc,EAAE,OAAO,CAAC;CACxD,OAAO;AACT;AAEA,SAAS,KACP,MACA,OACA,QACA,cACM;CACN,IAAI,KAAK,gBAAgB,gBAAgB;CAEzC,MAAM,eAAe,CAAC,GAAG,OAAO,IAAI;CACpC,MAAM,OAAO,KAAK,WAAW;CAE7B,IAAI,KAAK,MACP,OAAO,KAAK;EAAE,SAAS;EAAM,UAAU;EAAc,MAAM,KAAK;CAAK,CAAC;CAExE,IAAI,KAAK,OACP,OAAO,KAAK;EAAE,SAAS;EAAM,UAAU;EAAc,OAAO,KAAK;CAAM,CAAC;CAG1E,KAAK,MAAM,SAAS,KAAK,UACvB,KAAK,OAAO,cAAc,QAAQ,YAAY;CAGhD,IAAI,cACF,KAAK,MAAM,YAAY,OAAO,OAAO,KAAK,KAAK,GAC7C,KAAK,UAAU,cAAc,QAAQ,YAAY;AAGvD"}
|
|
1
|
+
{"version":3,"file":"walkers-DIE203ir.js","names":[],"sources":["../../src/routing/schema-validation.ts","../../src/routing/walkers.ts"],"sourcesContent":["/**\n * Schema key/value validation against the filesystem route tree.\n *\n * Runs at codegen time (build + dev) to catch mismatches between\n * app/schema.ts keys and the actual dynamic segments on disk.\n *\n * Design doc: design/41-global-params.md\n */\n\nimport { readFileCached } from './file-cache.ts';\nimport type { RouteTree, SegmentNode } from './types.ts';\nimport { findSchemaFile, parseExistingSchemaKeys } from '../cli-schema-sync.ts';\nimport { classifyUrlSegment } from './segment-classify.ts';\n\nexport interface SchemaWarning {\n type: 'stale-key' | 'missing-key' | 'bracket-mismatch';\n key: string;\n message: string;\n filesystemKey?: string;\n}\n\n/**\n * Collect all unique bracket-keyed dynamic segment names from a route tree.\n * Returns entries like '[artistSlug]', '[...slug]', '[[...topic]]'.\n */\nexport function collectDynamicSegmentsFromTree(tree: RouteTree): Set<string> {\n const segments = new Set<string>();\n walkTree(tree.root, segments);\n return segments;\n}\n\nfunction walkTree(node: SegmentNode, segments: Set<string>): void {\n if (node.paramName && node.segmentName) {\n const classified = classifyUrlSegment(node.segmentName);\n if (classified.kind !== 'static') {\n // Use bare bracket form for schema keys — affixed segments like\n // `img-[id].png` register as `[id]`, matching runtime codec lookup.\n if (classified.kind === 'dynamic' && (classified.prefix || classified.suffix)) {\n segments.add(`[${classified.name}]`);\n } else {\n segments.add(node.segmentName);\n }\n }\n }\n for (const child of node.children) {\n walkTree(child, segments);\n }\n for (const slot of Object.values(node.slots)) {\n walkTree(slot, segments);\n }\n}\n\n/**\n * Extract the param name from a bracket key.\n * '[id]' → 'id', '[...slug]' → 'slug', '[[...topic]]' → 'topic'\n */\nfunction extractParamName(bracketKey: string): string | null {\n const seg = classifyUrlSegment(bracketKey);\n if (seg.kind === 'static') return null;\n return seg.name;\n}\n\n/**\n * Validate schema keys against the filesystem route tree.\n *\n * Returns warnings for:\n * - Stale keys: schema keys that don't match any filesystem segment\n * - Bracket form mismatches: same param name, different bracket form\n * - Missing keys: filesystem segments not registered in schema (informational)\n */\nexport function validateSchemaAgainstRoutes(tree: RouteTree, appDir: string): SchemaWarning[] {\n const schemaPath = findSchemaFile(appDir);\n if (!schemaPath) return [];\n\n const content = readFileCached(schemaPath);\n const schemaKeys = parseExistingSchemaKeys(content);\n\n if (schemaKeys.length === 0) return [];\n\n const filesystemSegments = collectDynamicSegmentsFromTree(tree);\n\n return validateKeys(schemaKeys, filesystemSegments);\n}\n\n/**\n * Core validation: compare schema keys against filesystem segments.\n * Exported separately for testing without filesystem dependencies.\n */\nexport function validateKeys(\n schemaKeys: string[],\n filesystemSegments: Set<string>\n): SchemaWarning[] {\n const warnings: SchemaWarning[] = [];\n\n // Build a map of param name → bracket form for filesystem segments\n const fsParamToKey = new Map<string, string>();\n for (const fsKey of filesystemSegments) {\n const name = extractParamName(fsKey);\n if (name) {\n fsParamToKey.set(name, fsKey);\n }\n }\n\n // Build a set of schema param names for the missing-key check\n const schemaParamNames = new Set<string>();\n\n for (const schemaKey of schemaKeys) {\n const schemaParamName = extractParamName(schemaKey);\n if (!schemaParamName) continue;\n\n schemaParamNames.add(schemaParamName);\n\n if (filesystemSegments.has(schemaKey)) {\n // Exact match — no issue\n continue;\n }\n\n // Check if the param name exists but with a different bracket form\n const fsKey = fsParamToKey.get(schemaParamName);\n if (fsKey) {\n warnings.push({\n type: 'bracket-mismatch',\n key: schemaKey,\n filesystemKey: fsKey,\n message:\n `Schema key '${schemaKey}' does not match filesystem bracket form '${fsKey}'. ` +\n `Update the schema key to '${fsKey}'.`,\n });\n } else {\n warnings.push({\n type: 'stale-key',\n key: schemaKey,\n message:\n `Schema key '${schemaKey}' does not match any dynamic segment in the filesystem. ` +\n `Remove it from app/schema.ts or create the corresponding route segment.`,\n });\n }\n }\n\n // Check for filesystem segments not in schema (informational)\n for (const fsKey of filesystemSegments) {\n const name = extractParamName(fsKey);\n if (name && !schemaParamNames.has(name)) {\n warnings.push({\n type: 'missing-key',\n key: fsKey,\n message:\n `Dynamic segment '${fsKey}' has no codec in app/schema.ts (defaults to string). ` +\n `Run: timber schema sync`,\n });\n }\n }\n\n return warnings;\n}\n","/**\n * Shared route-tree walkers (TIM-848).\n *\n * Tiny helpers that walk a `SegmentNode<TFile>` tree generically. Both the\n * build-time tree (`SegmentNode<RouteFile>`) and the runtime manifest\n * tree (`SegmentNode<ManifestFile>`) flow through these helpers because\n * the walker only reads the structural fields shared by both shapes\n * (`children`, `slots`, `page`, `route`, `urlPath`).\n *\n * Before this module, three near-identical `collectRoutes` functions\n * lived in `plugins/dev-404-page.ts`, `plugins/build-report.ts`, and\n * `routing/codegen.ts`. The codegen one is special-purpose (it\n * accumulates `ParamEntry[]` and resolves codec chains) and stays\n * local; the other two now share `collectLeafRoutes` from this file.\n */\n\nimport type { SegmentNode } from './types.ts';\n\n/** A leaf route discovered while walking the segment tree. */\nexport interface LeafRoute<TFile> {\n /** URL path of the leaf (root is \"/\"). */\n urlPath: string;\n /** Segment chain from root to this leaf, inclusive. */\n segments: SegmentNode<TFile>[];\n /** The page file at this leaf, if any. */\n page?: TFile;\n /** The route handler file at this leaf, if any. */\n route?: TFile;\n}\n\n/** Options for `collectLeafRoutes`. */\nexport interface CollectLeafRoutesOptions {\n /**\n * If true, recurse into parallel slots and emit slot leaves alongside\n * the main route tree. Defaults to `false` because slots render\n * alongside their parent at the same URL and are not separately\n * URL-addressable. The build report excludes slots; route-listing\n * UIs that want to show \"all leaves with a page handler\" can opt in.\n */\n includeSlots?: boolean;\n}\n\n/**\n * Walk a segment tree and collect every leaf with a `page` or `route`\n * handler. Generic over `TFile` so it works on both the build-time\n * scanner output and the runtime manifest tree.\n *\n * - Pages and route handlers at the same URL produce two distinct\n * entries (the build report deduplicates by URL afterward).\n * - Parallel slots are skipped unless `includeSlots: true` (slots\n * share their parent's URL and are not addressable on their own).\n * - Intercepting subtrees are skipped unconditionally. They render only\n * on soft navigation and add no URL depth, so their computed `urlPath`s\n * are not addresses — listing them would advertise routes (`/[year]`)\n * that no request can reach. This matches every other consumer of the\n * tree that produces URLs: the sitemap generator, the static generator,\n * prerendering and the prebuilt-payload builder all skip them too.\n * - Result is sorted by `urlPath` for deterministic output.\n */\nexport function collectLeafRoutes<TFile>(\n root: SegmentNode<TFile>,\n options: CollectLeafRoutesOptions = {}\n): LeafRoute<TFile>[] {\n const { includeSlots = false } = options;\n const result: LeafRoute<TFile>[] = [];\n walk(root, [], result, includeSlots);\n result.sort((a, b) => a.urlPath.localeCompare(b.urlPath));\n return result;\n}\n\nfunction walk<TFile>(\n node: SegmentNode<TFile>,\n chain: SegmentNode<TFile>[],\n result: LeafRoute<TFile>[],\n includeSlots: boolean\n): void {\n if (node.segmentType === 'intercepting') return;\n\n const currentChain = [...chain, node];\n const path = node.urlPath || '/';\n\n if (node.page) {\n result.push({ urlPath: path, segments: currentChain, page: node.page });\n }\n if (node.route) {\n result.push({ urlPath: path, segments: currentChain, route: node.route });\n }\n\n for (const child of node.children) {\n walk(child, currentChain, result, includeSlots);\n }\n\n if (includeSlots) {\n for (const slotNode of Object.values(node.slots)) {\n walk(slotNode, currentChain, result, includeSlots);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,SAAgB,+BAA+B,MAA8B;CAC3E,MAAM,2BAAW,IAAI,IAAY;CACjC,SAAS,KAAK,MAAM,QAAQ;CAC5B,OAAO;AACT;AAEA,SAAS,SAAS,MAAmB,UAA6B;CAChE,IAAI,KAAK,aAAa,KAAK,aAAa;EACtC,MAAM,aAAa,mBAAmB,KAAK,WAAW;EACtD,IAAI,WAAW,SAAS,UAAU;GAGhC,IAAI,WAAW,SAAS,cAAc,WAAW,UAAU,WAAW,SACpE,SAAS,IAAI,IAAI,WAAW,KAAK,EAAE;QAEnC,SAAS,IAAI,KAAK,WAAW;EAEjC;CACF;CACA,KAAK,MAAM,SAAS,KAAK,UACvB,SAAS,OAAO,QAAQ;CAE1B,KAAK,MAAM,QAAQ,OAAO,OAAO,KAAK,KAAK,GACzC,SAAS,MAAM,QAAQ;AAE3B;;;;;AAMA,SAAS,iBAAiB,YAAmC;CAC3D,MAAM,MAAM,mBAAmB,UAAU;CACz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UAAoC,CAAC,GACjB;CACpB,MAAM,EAAE,eAAe,UAAU;CACjC,MAAM,SAA6B,CAAC;CACpC,KAAK,MAAM,CAAC,GAAG,QAAQ,YAAY;CACnC,OAAO,MAAM,GAAG,MAAM,EAAE,QAAQ,cAAc,EAAE,OAAO,CAAC;CACxD,OAAO;AACT;AAEA,SAAS,KACP,MACA,OACA,QACA,cACM;CACN,IAAI,KAAK,gBAAgB,gBAAgB;CAEzC,MAAM,eAAe,CAAC,GAAG,OAAO,IAAI;CACpC,MAAM,OAAO,KAAK,WAAW;CAE7B,IAAI,KAAK,MACP,OAAO,KAAK;EAAE,SAAS;EAAM,UAAU;EAAc,MAAM,KAAK;CAAK,CAAC;CAExE,IAAI,KAAK,OACP,OAAO,KAAK;EAAE,SAAS;EAAM,UAAU;EAAc,OAAO,KAAK;CAAM,CAAC;CAG1E,KAAK,MAAM,SAAS,KAAK,UACvB,KAAK,OAAO,cAAc,QAAQ,YAAY;CAGhD,IAAI,cACF,KAAK,MAAM,YAAY,OAAO,OAAO,KAAK,KAAK,GAC7C,KAAK,UAAU,cAAc,QAAQ,YAAY;AAGvD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { rename, rm, writeFile } from "node:fs/promises";
|
|
3
|
-
|
|
3
|
+
// src/utils/write-file-atomic.ts
|
|
4
4
|
/**
|
|
5
5
|
* Replace a file's contents in one step: write a uniquely named temp sibling,
|
|
6
6
|
* then `rename()` it over the target.
|
|
@@ -26,7 +26,6 @@ async function writeFileAtomic(path, data) {
|
|
|
26
26
|
throw err;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { writeFileAtomic as t };
|
|
31
30
|
|
|
32
|
-
//# sourceMappingURL=write-file-atomic-
|
|
31
|
+
//# sourceMappingURL=write-file-atomic-DW8m_Atv.js.map
|
package/dist/_chunks/{write-file-atomic-D1qWqHb4.js.map → write-file-atomic-DW8m_Atv.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-file-atomic-
|
|
1
|
+
{"version":3,"file":"write-file-atomic-DW8m_Atv.js","names":[],"sources":["../../src/utils/write-file-atomic.ts"],"sourcesContent":["/**\n * Replace a file's contents in one step: write a uniquely named temp sibling,\n * then `rename()` it over the target.\n *\n * `writeFile()` opens its target with `O_TRUNC`, so for the length of the write\n * a concurrent reader sees an empty or half-written file under the real name.\n * `rename()` within one directory swaps the name atomically, so a reader sees\n * either the old file or the new one — never a torn one — and a crashed\n * writer leaves no partial artifact under the final name.\n *\n * The temp name is unique per call, not a fixed `${path}.tmp`: two writers of\n * the same path (a dev server and a `vite build` rewriting the same route\n * types, parallel CLI invocations sharing a cache) would otherwise write into\n * one temp file and rename each other's half-written bytes into place.\n */\n\nimport { randomUUID } from 'node:crypto';\nimport { rename, rm, writeFile } from 'node:fs/promises';\n\nexport async function writeFileAtomic(path: string, data: Uint8Array | string): Promise<void> {\n const tmp = `${path}.${randomUUID()}.tmp`;\n try {\n await writeFile(tmp, data);\n await rename(tmp, path);\n } catch (err) {\n // Best-effort cleanup. If the directory refuses the write it may refuse\n // the rm too, and that error — naming a random temp path — must not\n // replace the one that says what actually failed.\n await rm(tmp, { force: true }).catch(() => {});\n throw err;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,eAAsB,gBAAgB,MAAc,MAA0C;CAC5F,MAAM,MAAM,GAAG,KAAK,GAAG,WAAW,EAAE;CACpC,IAAI;EACF,MAAM,UAAU,KAAK,IAAI;EACzB,MAAM,OAAO,KAAK,IAAI;CACxB,SAAS,KAAK;EAIZ,MAAM,GAAG,KAAK,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;EAC7C,MAAM;CACR;AACF"}
|
|
@@ -12,13 +12,22 @@ export interface BuildOutputBaseOptions {
|
|
|
12
12
|
* Nitro uses 'public', Cloudflare uses 'static'.
|
|
13
13
|
*/
|
|
14
14
|
publicDirName: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the platform reads `_headers` and `_redirects` from the public
|
|
17
|
+
* directory (Cloudflare, Netlify). When false, the output has neither — no
|
|
18
|
+
* generated `_headers`, and not the user's `public/_headers` or
|
|
19
|
+
* `public/_redirects`, which Vite copies into the client output: on a host
|
|
20
|
+
* that does not read them they are plain files, served to anyone who asks
|
|
21
|
+
* for `/_headers` (TIM-1605).
|
|
22
|
+
*/
|
|
23
|
+
platformFiles: boolean;
|
|
15
24
|
}
|
|
16
25
|
/**
|
|
17
26
|
* Run the platform-agnostic build output steps shared by all adapters:
|
|
18
27
|
*
|
|
19
28
|
* 1. Create the output directory
|
|
20
29
|
* 2. Copy client assets to the public/static directory
|
|
21
|
-
* 3. Write the `_headers` file for static asset cache control
|
|
30
|
+
* 3. Write the `_headers` file for static asset cache control, if `platformFiles`
|
|
22
31
|
* 4. Copy RSC and SSR server bundles into the output directory
|
|
23
32
|
* 5. Write the manifest-init module if present
|
|
24
33
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-output-helper.d.ts","sourceRoot":"","sources":["../../src/adapters/build-output-helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-output-helper.d.ts","sourceRoot":"","sources":["../../src/adapters/build-output-helper.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,iDAAiD;AACjD,MAAM,WAAW,sBAAsB;IACrC,8BAA8B;IAC9B,MAAM,EAAE,YAAY,CAAC;IACrB,+BAA+B;IAC/B,SAAS,EAAE,oBAAoB,CAAC;IAChC,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;;;OAOG;IACH,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkEvF;AA8BD,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,OAAO,CAAC,MAAM,EAAE,CAAC,CA2BnB;AA2BD;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,oBAAoB,EAC/B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,IAAI,CAAC,CAcf;AAoBD;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2B1F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as runWithBindings } from "../_chunks/cloudflare-
|
|
2
|
-
|
|
1
|
+
import { f as runWithBindings } from "../_chunks/cloudflare-B75X6u4O.js";
|
|
2
|
+
// src/adapters/cloudflare-dev.ts
|
|
3
3
|
/**
|
|
4
4
|
* Dynamically import wrangler. Extracted as a named export so tests
|
|
5
5
|
* can mock it without needing wrangler installed.
|
|
@@ -68,7 +68,6 @@ function cloudflareDevBindings(options = {}) {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
//#endregion
|
|
72
71
|
export { DEV_REQUEST_WRAPPER_KEY, cloudflareDevBindings, loadWrangler };
|
|
73
72
|
|
|
74
73
|
//# sourceMappingURL=cloudflare-dev.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as warnLossyJsonValue } from "../_chunks/json-lossy-check-
|
|
2
|
-
import { l as getCloudflareBindings } from "../_chunks/cloudflare-
|
|
3
|
-
|
|
1
|
+
import { t as warnLossyJsonValue } from "../_chunks/json-lossy-check-DVkLUlfC.js";
|
|
2
|
+
import { l as getCloudflareBindings } from "../_chunks/cloudflare-B75X6u4O.js";
|
|
3
|
+
// src/adapters/cloudflare-kv-cache.ts
|
|
4
4
|
var LEGACY_GRACE_MS = 2592e6;
|
|
5
5
|
/**
|
|
6
6
|
* Parse a tag index value, handling both the old format (string[]) and the
|
|
@@ -117,7 +117,6 @@ var CloudflareKVCacheHandler = class {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
//#endregion
|
|
121
120
|
export { CloudflareKVCacheHandler };
|
|
122
121
|
|
|
123
122
|
//# sourceMappingURL=cloudflare-kv-cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../../src/adapters/cloudflare.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAEV,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,YAAY,EACb,MAAM,YAAY,CAAC;AA0CpB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAUtE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAE/E;AAMD,wFAAwF;AACxF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,kFAAkF;AAClF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;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mExB;AAkCD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAYzC;AAED,sCAAsC;AACtC,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,wBAAwB,EACjC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAC1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgDzB;AAID;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,oBAAoB,EAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,wBAAwB,GACjC,OAAO,CAAC,IAAI,CAAC,CAOf;AAID,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,aAAa,EACpC,SAAS,SAAgC,GACxC,cAAc,CAUhB;AAKD;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAOf;AAuBD,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3C,sBAAsB,IAAI,IAAI,CAAC;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as buildStaticOutput, n as cloudflare, r as generateBindingsConfig, i as generatePrebuiltSourceModule, a as generatePreviewCommand, o as generateRuntimeInitModule, s as generateWorkerEntry, c as generateWranglerConfig, l as getCloudflareBindings, u as readPrebuiltData, d as readUserWranglerConfig, f as runWithBindings, p as stagePagesPreview } from "../_chunks/cloudflare-
|
|
1
|
+
export { t as buildStaticOutput, n as cloudflare, r as generateBindingsConfig, i as generatePrebuiltSourceModule, a as generatePreviewCommand, o as generateRuntimeInitModule, s as generateWorkerEntry, c as generateWranglerConfig, l as getCloudflareBindings, u as readPrebuiltData, d as readUserWranglerConfig, f as runWithBindings, p as stagePagesPreview } from "../_chunks/cloudflare-B75X6u4O.js";
|
|
@@ -15,6 +15,12 @@ export interface PresetConfig {
|
|
|
15
15
|
supportsWaitUntil: boolean;
|
|
16
16
|
/** Whether the runtime supports application-level 103 Early Hints. */
|
|
17
17
|
supportsEarlyHints: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the platform reads `_headers` and `_redirects` from the public
|
|
20
|
+
* directory. Everywhere else they are just public files anyone can fetch,
|
|
21
|
+
* so the build leaves them out (TIM-1605).
|
|
22
|
+
*/
|
|
23
|
+
readsPlatformFiles: boolean;
|
|
18
24
|
/** Value for TIMBER_RUNTIME env var. See design/25-production-deployments.md. */
|
|
19
25
|
runtimeName: string;
|
|
20
26
|
/** Additional nitro.config fields for this preset. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nitro-presets.d.ts","sourceRoot":"","sources":["../../src/adapters/nitro-presets.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,aAAa,GACb,SAAS,GACT,cAAc,GACd,YAAY,GACZ,aAAa,GACb,iBAAiB,GACjB,aAAa,GACb,KAAK,CAAC;AAEV,2CAA2C;AAC3C,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sEAAsE;IACtE,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iFAAiF;IACjF,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"nitro-presets.d.ts","sourceRoot":"","sources":["../../src/adapters/nitro-presets.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,aAAa,GACb,SAAS,GACT,cAAc,GACd,YAAY,GACZ,aAAa,GACb,iBAAiB,GACjB,aAAa,GACb,KAAK,CAAC;AAEV,2CAA2C;AAC3C,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sEAAsE;IACtE,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iFAAiF;IACjF,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,YAAY,CAmF5D,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,kBAA+C,CAAC;AAEhF;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,YAAY,CAEjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nitro-preview.d.ts","sourceRoot":"","sources":["../../src/adapters/nitro-preview.ts"],"names":[],"mappings":"AAuEA,2EAA2E;AAC3E,MAAM,MAA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AAE,QAAQ,CAAC;IACjB,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAsS3E;AAED,oDAAoD;AACpD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAS7F;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CA0HnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nitro.d.ts","sourceRoot":"","sources":["../../src/adapters/nitro.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS/C,OAAO,EAAuC,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"nitro.d.ts","sourceRoot":"","sources":["../../src/adapters/nitro.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS/C,OAAO,EAAuC,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAQ3F,OAAO,KAAK,EAIV,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAIpB,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,SAAS,CAAC;AAEtD,qCAAqC;AACrC,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;O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C,gBAAgB,CAAC,CAgE3B;AAGD;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAcf"}
|
package/dist/adapters/nitro.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { t as RSC_CONTENT_TYPE } from "../_chunks/rsc-media-type-
|
|
2
|
-
import { a as
|
|
1
|
+
import { t as RSC_CONTENT_TYPE } from "../_chunks/rsc-media-type-m8jz9u6_.js";
|
|
2
|
+
import { a as REDIRECTS_FILE, i as HEADERS_FILE } from "../_chunks/fs-identity-BmQ_Agg-.js";
|
|
3
|
+
import { a as STATIC_CACHE, i as IMMUTABLE_CACHE, n as runSharedBuildSteps, o as adapterBase, r as writeHeadersFile, t as buildStaticDirectoryOutput } from "../_chunks/build-output-helper-B7wWGTfR.js";
|
|
3
4
|
import { transformWithOxc } from "vite";
|
|
4
5
|
import { basename, dirname, join, relative, sep } from "node:path";
|
|
5
6
|
import { existsSync } from "node:fs";
|
|
6
|
-
import { cp, glob, readFile, writeFile } from "node:fs/promises";
|
|
7
|
+
import { cp, glob, readFile, rm, writeFile } from "node:fs/promises";
|
|
7
8
|
import { execFile } from "node:child_process";
|
|
8
|
-
|
|
9
|
+
// src/server/compress.ts?raw
|
|
9
10
|
var compress_default = "// Response compression for self-hosted deployments (dev server, Nitro preview).\n//\n// Gzips with node:zlib, flushing per chunk; a Node body stays a Node stream. 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. A Node-body response is asked whether it owns one\n // (a null-body status does not) without reading `.body`, which would\n // convert it to a Web stream.\n const nodeBody = nodeBodyThrough(response);\n if (nodeBody ? !nodeBody.hasBody : !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 // 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 const init = { status: response.status, statusText: response.statusText, headers };\n // A Node body is gzipped as a Node stream and stays one to the socket.\n const nodeBody = nodeBodyThrough(response);\n if (nodeBody) return nodeBody.through(createSyncFlushGzip(), init);\n return new Response(compressWithGzip(response.body!), init);\n}\n\n// ─── Node bodies ──────────────────────────────────────────────────────────\n//\n// A response with a Node body (SSR and Flight payloads on Node) carries its\n// operations under a registry symbol (server/node-response.ts). This module is\n// emitted standalone and cannot import that one, so it repeats the key;\n// tests/node-body-response.test.ts holds the two to the same string.\n\n/** Registry key of the Node-body brand; must equal `NODE_BODY` in node-response.ts. */\nexport const NODE_BODY_KEY = 'timber.response.nodeBody';\n\n/** The Node-body operations compression needs. */\ninterface NodeBodyThrough {\n readonly hasBody: boolean;\n through(stream: import('node:stream').Duplex, init: ResponseInit): Response;\n}\n\nfunction isNodeBodyThrough(value: unknown): value is NodeBodyThrough {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'through' in value &&\n typeof value.through === 'function' &&\n 'hasBody' in value &&\n typeof value.hasBody === 'boolean'\n );\n}\n\nfunction nodeBodyThrough(response: Response): NodeBodyThrough | null {\n const ops: unknown = Reflect.get(response, Symbol.for(NODE_BODY_KEY));\n return isNodeBodyThrough(ops) ? ops : null;\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/** gzip that flushes every chunk as it arrives. */\nfunction createSyncFlushGzip(): ReturnType<typeof createGzip> {\n return createGzip({ flush: constants.Z_SYNC_FLUSH });\n}\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 = createSyncFlushGzip();\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";
|
|
10
|
-
|
|
11
|
-
//#region src/adapters/compress-module.ts
|
|
11
|
+
// src/adapters/compress-module.ts
|
|
12
12
|
/**
|
|
13
13
|
* The one import `server/compress.ts` is allowed to carry, and its inlined
|
|
14
14
|
* form.
|
|
@@ -82,11 +82,9 @@ function assertStandalone(code, source, emitted) {
|
|
|
82
82
|
async function generateCompressModule() {
|
|
83
83
|
return "// Generated by @timber-js/app — compiled from server/compress.ts.\n// Do not edit — this file is regenerated on each build.\n" + inlineCompressImports((await transformWithOxc(compress_default, "compress.ts", { lang: "ts" })).code);
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region src/adapters/canonicalize-module.ts
|
|
85
|
+
// src/server/canonicalize.ts?raw
|
|
86
|
+
var canonicalize_default = "/**\n * URL canonicalization — runs once at the request boundary.\n *\n * Every layer (proxy.ts, middleware.ts, access.ts, components) sees the same\n * canonical path. No re-decoding occurs at any later stage.\n *\n * See design/07-routing.md §\"URL Canonicalization & Security\"\n */\n\n/** Result of canonicalization — either a clean path or a rejection. */\nexport type CanonicalizeResult = { ok: true; pathname: string } | { ok: false; status: 400 };\n\n/**\n * Encoded separators that produce a 400 rejection.\n * %2f (/) and %5c (\\) cause path-confusion attacks.\n *\n * Shared between the runtime canonicalizer and the build-time route scanner\n * to ensure both enforce identical security rules. See design/13-security.md.\n */\nexport const ENCODED_SEPARATOR_RE = /%2f|%5c/i;\n\n/** Null byte — rejected. Shared with the route scanner. */\nexport const NULL_BYTE_RE = /%00/i;\n\n/**\n * Canonicalize a URL pathname.\n *\n * 1. Reject encoded separators (%2f, %5c) and null bytes (%00)\n * 2. Single percent-decode\n * 3. Collapse // → /\n * 4. Resolve .. segments (reject if escaping root)\n * 5. Strip trailing slash (except root \"/\")\n *\n * @param rawPathname - The raw pathname from the request URL (percent-encoded)\n * @param stripTrailingSlash - Whether to strip trailing slashes. Default: true.\n */\nexport function canonicalize(rawPathname: string, stripTrailingSlash = true): CanonicalizeResult {\n // Step 1: Reject dangerous encoded sequences BEFORE decoding.\n // This must happen on the raw input so %252f doesn't bypass after a single decode.\n if (ENCODED_SEPARATOR_RE.test(rawPathname)) {\n return { ok: false, status: 400 };\n }\n if (NULL_BYTE_RE.test(rawPathname)) {\n return { ok: false, status: 400 };\n }\n\n // Step 2: Single percent-decode.\n // Double-encoded input (%2561 → %61) stays as %61 — not decoded again.\n let decoded: string;\n try {\n decoded = decodeURIComponent(rawPathname);\n } catch {\n // Malformed percent-encoding → 400\n return { ok: false, status: 400 };\n }\n\n // Reject null bytes that appeared after decoding (from valid %00-like sequences\n // that weren't caught above — belt and suspenders).\n if (decoded.includes('\\0')) {\n return { ok: false, status: 400 };\n }\n\n // Backslash is NOT a path separator — keep as literal character.\n // But reject if it would create // after normalization (e.g., /\\evil.com).\n // We do NOT convert \\ to / — it stays as a literal.\n\n // Step 3: Collapse consecutive slashes.\n let pathname = decoded.replace(/\\/\\/+/g, '/');\n\n // Step 4: Resolve .. and . segments.\n const segments = pathname.split('/');\n const resolved: string[] = [];\n for (const seg of segments) {\n if (seg === '..') {\n if (resolved.length <= 1) {\n // Trying to escape root — 400\n return { ok: false, status: 400 };\n }\n resolved.pop();\n } else if (seg !== '.') {\n resolved.push(seg);\n }\n }\n\n pathname = resolved.join('/') || '/';\n\n // Step 5: Strip trailing slash (except root \"/\").\n if (stripTrailingSlash && pathname.length > 1 && pathname.endsWith('/')) {\n pathname = pathname.slice(0, -1);\n }\n\n return { ok: true, pathname };\n}\n\n/**\n * The path a safe request for `rawPathname` should be redirected to — or\n * `rawPathname` itself when it is already canonical.\n *\n * Applies the structural steps of `canonicalize()` — collapse `//` (step 3)\n * and strip the trailing slash (step 5) — to the **encoded** path, without\n * decoding. That is what the browser will send back, so the redirect is\n * idempotent: `/%61dmin` differs from its canonical form `/admin` only by\n * percent-encoding, and redirecting it to `/admin` would compare against the\n * decoded form forever. Decoding cannot introduce a `/` (`%2f` is rejected),\n * so the structure is the same before and after decoding.\n *\n * Dot segments are not handled here: the request URL is parsed by the WHATWG\n * URL parser, which has already resolved `.`, `..` and their encoded forms.\n *\n * Only meaningful for a path `canonicalize()` accepted. The collapse also\n * means the result can never start with `//`, so it is never a\n * protocol-relative redirect target.\n *\n * See design/07-routing.md §\"Non-Canonical URLs Redirect\"\n */\nexport function canonicalRequestPath(rawPathname: string, stripTrailingSlash = true): string {\n let pathname = rawPathname.replace(/\\/\\/+/g, '/');\n if (stripTrailingSlash && pathname.length > 1 && pathname.endsWith('/')) {\n pathname = pathname.slice(0, -1);\n }\n return pathname;\n}\n\n/**\n * Build a request's URL from its origin and its raw request target, or\n * return null when the result is not a URL (the caller answers 400).\n *\n * An origin-form target (`/path`) is concatenated, not resolved against the\n * origin: resolved as a relative reference, `//evil.com/` names another host,\n * and the pipeline would see `/` instead of the path it must redirect to\n * `/evil.com` (TIM-1571). Any other form is resolved against the origin:\n * the asterisk-form `OPTIONS *` becomes `/*`, and an absolute-form target\n * (`GET http://host/a`) keeps only its path and query. Its scheme and\n * authority are the client's word, not the connection's: they would stand in\n * for the Host that the dev server's allowedHosts check and CSRF read, and a\n * non-http scheme (`foo://x/`) makes an opaque origin the pipeline cannot\n * build URLs from, so that is null too.\n *\n * Shared by the dev server and the Nitro preview server (which ships this\n * file as `_canonicalize.mjs`), so the two cannot disagree about which path a\n * request target names. Production adapters build the URL in their own\n * runtime (srvx for Nitro).\n */\nexport function requestTargetUrl(origin: string, target: string): URL | null {\n if (target.startsWith('/')) return URL.parse(origin + target);\n const resolved = URL.parse(target, origin);\n if (resolved?.protocol !== 'http:' && resolved?.protocol !== 'https:') return null;\n return URL.parse(origin + resolved.pathname + resolved.search);\n}\n";
|
|
87
|
+
// src/adapters/canonicalize-module.ts
|
|
90
88
|
/**
|
|
91
89
|
* Compile server/canonicalize.ts into a standalone ESM module exporting
|
|
92
90
|
* `canonicalize`.
|
|
@@ -98,8 +96,7 @@ async function generateCanonicalizeModule() {
|
|
|
98
96
|
assertStandalone(result.code, "server/canonicalize.ts", "_canonicalize.mjs");
|
|
99
97
|
return "// Generated by @timber-js/app — compiled from server/canonicalize.ts.\n// Do not edit — this file is regenerated on each build.\n" + result.code;
|
|
100
98
|
}
|
|
101
|
-
|
|
102
|
-
//#region src/adapters/nitro-immutable-assets.ts
|
|
99
|
+
// src/adapters/nitro-immutable-assets.ts
|
|
103
100
|
/** The generated module, written beside the Nitro entry that imports it. */
|
|
104
101
|
var IMMUTABLE_ASSETS_MODULE = "_immutable-assets.mjs";
|
|
105
102
|
/**
|
|
@@ -196,14 +193,14 @@ export default function immutableAssets(nitroApp) {
|
|
|
196
193
|
}
|
|
197
194
|
`;
|
|
198
195
|
}
|
|
199
|
-
|
|
200
|
-
//#region src/adapters/nitro-presets.ts
|
|
196
|
+
// src/adapters/nitro-presets.ts
|
|
201
197
|
var PRESET_CONFIGS = {
|
|
202
198
|
"vercel": {
|
|
203
199
|
nitroPreset: "vercel",
|
|
204
200
|
outputDir: ".vercel/output",
|
|
205
201
|
supportsWaitUntil: true,
|
|
206
202
|
supportsEarlyHints: false,
|
|
203
|
+
readsPlatformFiles: false,
|
|
207
204
|
runtimeName: "vercel",
|
|
208
205
|
extraConfig: { vercel: { functions: { maxDuration: 30 } } }
|
|
209
206
|
},
|
|
@@ -212,6 +209,7 @@ var PRESET_CONFIGS = {
|
|
|
212
209
|
outputDir: ".vercel/output",
|
|
213
210
|
supportsWaitUntil: true,
|
|
214
211
|
supportsEarlyHints: false,
|
|
212
|
+
readsPlatformFiles: false,
|
|
215
213
|
runtimeName: "vercel-edge"
|
|
216
214
|
},
|
|
217
215
|
"netlify": {
|
|
@@ -219,6 +217,7 @@ var PRESET_CONFIGS = {
|
|
|
219
217
|
outputDir: ".netlify/functions-internal",
|
|
220
218
|
supportsWaitUntil: false,
|
|
221
219
|
supportsEarlyHints: false,
|
|
220
|
+
readsPlatformFiles: true,
|
|
222
221
|
runtimeName: "netlify"
|
|
223
222
|
},
|
|
224
223
|
"netlify-edge": {
|
|
@@ -226,6 +225,7 @@ var PRESET_CONFIGS = {
|
|
|
226
225
|
outputDir: ".netlify/edge-functions",
|
|
227
226
|
supportsWaitUntil: true,
|
|
228
227
|
supportsEarlyHints: false,
|
|
228
|
+
readsPlatformFiles: true,
|
|
229
229
|
runtimeName: "netlify-edge"
|
|
230
230
|
},
|
|
231
231
|
"aws-lambda": {
|
|
@@ -233,6 +233,7 @@ var PRESET_CONFIGS = {
|
|
|
233
233
|
outputDir: ".output",
|
|
234
234
|
supportsWaitUntil: false,
|
|
235
235
|
supportsEarlyHints: false,
|
|
236
|
+
readsPlatformFiles: false,
|
|
236
237
|
runtimeName: "aws-lambda"
|
|
237
238
|
},
|
|
238
239
|
"deno-deploy": {
|
|
@@ -240,6 +241,7 @@ var PRESET_CONFIGS = {
|
|
|
240
241
|
outputDir: ".output",
|
|
241
242
|
supportsWaitUntil: true,
|
|
242
243
|
supportsEarlyHints: false,
|
|
244
|
+
readsPlatformFiles: false,
|
|
243
245
|
runtimeName: "deno-deploy"
|
|
244
246
|
},
|
|
245
247
|
"azure-functions": {
|
|
@@ -247,6 +249,7 @@ var PRESET_CONFIGS = {
|
|
|
247
249
|
outputDir: ".output",
|
|
248
250
|
supportsWaitUntil: false,
|
|
249
251
|
supportsEarlyHints: false,
|
|
252
|
+
readsPlatformFiles: false,
|
|
250
253
|
runtimeName: "azure-functions"
|
|
251
254
|
},
|
|
252
255
|
"node-server": {
|
|
@@ -254,6 +257,7 @@ var PRESET_CONFIGS = {
|
|
|
254
257
|
outputDir: ".output",
|
|
255
258
|
supportsWaitUntil: true,
|
|
256
259
|
supportsEarlyHints: false,
|
|
260
|
+
readsPlatformFiles: false,
|
|
257
261
|
runtimeName: "node-server"
|
|
258
262
|
},
|
|
259
263
|
"bun": {
|
|
@@ -261,13 +265,13 @@ var PRESET_CONFIGS = {
|
|
|
261
265
|
outputDir: ".output",
|
|
262
266
|
supportsWaitUntil: true,
|
|
263
267
|
supportsEarlyHints: false,
|
|
268
|
+
readsPlatformFiles: false,
|
|
264
269
|
runtimeName: "bun"
|
|
265
270
|
}
|
|
266
271
|
};
|
|
267
272
|
/** Presets that produce a locally-runnable server entry. */
|
|
268
273
|
var LOCALLY_PREVIEWABLE = /* @__PURE__ */ new Set(["node-server", "bun"]);
|
|
269
|
-
|
|
270
|
-
//#region src/adapters/nitro-preview.ts
|
|
274
|
+
// src/adapters/nitro-preview.ts
|
|
271
275
|
/**
|
|
272
276
|
* Content-Type by file extension for the preview server. Static hosts decide
|
|
273
277
|
* this themselves; the table covers the file types a web build ships so the
|
|
@@ -442,7 +446,7 @@ import { createServer } from 'node:http';
|
|
|
442
446
|
import { readFile, stat } from 'node:fs/promises';
|
|
443
447
|
import { join, extname, sep } from 'node:path';
|
|
444
448
|
import { fileURLToPath } from 'node:url';
|
|
445
|
-
import { canonicalize } from './_canonicalize.mjs';
|
|
449
|
+
import { canonicalize, requestTargetUrl } from './_canonicalize.mjs';
|
|
446
450
|
|
|
447
451
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
448
452
|
|
|
@@ -513,6 +517,9 @@ const envPort = process.env.PORT ? parseInt(process.env.PORT, 10) : null;
|
|
|
513
517
|
const portIsExplicit = envPort != null && Number.isFinite(envPort) && envPort > 0;
|
|
514
518
|
const startPort = portIsExplicit ? envPort : 3000;
|
|
515
519
|
const host = process.env.HOST || 'localhost';
|
|
520
|
+
// An IPv6 HOST ('::', '::1') binds as is but needs brackets in a URL;
|
|
521
|
+
// unbracketed, every request URL is unparseable and answered 400.
|
|
522
|
+
const urlHost = host.includes(':') && !host.startsWith('[') ? \`[\${host}]\` : host;
|
|
516
523
|
|
|
517
524
|
// Set after listenWithBump() resolves so request handlers can build
|
|
518
525
|
// absolute URLs from the actual bound port (which may differ from
|
|
@@ -527,16 +534,17 @@ const server = createServer(async (req, res) => {
|
|
|
527
534
|
// connection it would be attacker-controlled. The CSRF layer honors it
|
|
528
535
|
// separately for reverse-proxy deployments.
|
|
529
536
|
const scheme = req.socket?.encrypted ? 'https' : 'http';
|
|
530
|
-
//
|
|
531
|
-
//
|
|
532
|
-
//
|
|
533
|
-
//
|
|
534
|
-
//
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
537
|
+
// requestTargetUrl() (server/canonicalize.ts) concatenates an origin-form
|
|
538
|
+
// target and resolves any other form, so '//evil.com/' stays a path the
|
|
539
|
+
// pipeline redirects (TIM-1571) and 'OPTIONS *' is '/*'. A target that
|
|
540
|
+
// names no URL is answered here: thrown in this callback, which has no
|
|
541
|
+
// catch around it, the rejection would take the preview process down.
|
|
542
|
+
const url = requestTargetUrl(\`\${scheme}://\${urlHost}:\${boundPort}\`, req.url || '/');
|
|
543
|
+
if (!url) {
|
|
544
|
+
res.writeHead(400, { 'Content-Type': 'text/plain' });
|
|
545
|
+
res.end('Bad Request');
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
540
548
|
|
|
541
549
|
// The runtime's own request-boundary canonicalizer (_canonicalize.mjs,
|
|
542
550
|
// compiled from server/canonicalize.ts): one decode, and the same 400s for
|
|
@@ -640,44 +648,63 @@ export function sendNodeResponse(nodeRes, webRes) {
|
|
|
640
648
|
// pipe it straight to the socket, no Web Streams round trip. pipe() rather
|
|
641
649
|
// than pipeline(), which allocates an AbortController and an error on every
|
|
642
650
|
// finish; a client that disconnects early destroys the body (aborting the
|
|
643
|
-
// render), and a body that errors destroys the socket.
|
|
651
|
+
// render), and a body that errors mid-stream destroys the socket.
|
|
652
|
+
//
|
|
653
|
+
// As srvx's pipeBody does, the status line waits until the body is
|
|
654
|
+
// readable: a body that errors before its first chunk answers a bare 500
|
|
655
|
+
// instead of closing the socket with nothing written (TIM-1602).
|
|
644
656
|
if (typeof webRes._toNodeResponse === 'function') {
|
|
645
657
|
const res = webRes._toNodeResponse();
|
|
646
658
|
if (res.body && typeof res.body.pipe === 'function') {
|
|
647
|
-
if (!nodeRes.headersSent) {
|
|
648
|
-
if (nodeRes.req?.httpVersion === '2.0') {
|
|
649
|
-
nodeRes.writeHead(res.status, res.headers);
|
|
650
|
-
} else {
|
|
651
|
-
nodeRes.writeHead(res.status, res.statusText, res.headers);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
659
|
const body = res.body;
|
|
655
660
|
// The client already left: 'close' has fired and will not again.
|
|
656
661
|
if (nodeRes.destroyed) {
|
|
657
662
|
body.destroy();
|
|
658
663
|
return;
|
|
659
664
|
}
|
|
665
|
+
// Already failed: its 'error' has fired and 'readable' never will.
|
|
666
|
+
if (body.destroyed) {
|
|
667
|
+
writeHead(nodeRes, 500, 'Internal Server Error', []);
|
|
668
|
+
return new Promise((resolve) => nodeRes.end(resolve));
|
|
669
|
+
}
|
|
660
670
|
return new Promise((resolve) => {
|
|
661
|
-
|
|
662
|
-
|
|
671
|
+
function cleanup() {
|
|
672
|
+
body.off('error', onEarlyError);
|
|
673
|
+
body.off('readable', onReadable);
|
|
674
|
+
nodeRes.off('close', onEarlyClose);
|
|
675
|
+
}
|
|
676
|
+
function onEarlyError() {
|
|
677
|
+
cleanup();
|
|
678
|
+
body.destroy();
|
|
679
|
+
writeHead(nodeRes, 500, 'Internal Server Error', []);
|
|
680
|
+
nodeRes.end(resolve);
|
|
681
|
+
}
|
|
682
|
+
function onEarlyClose() {
|
|
683
|
+
cleanup();
|
|
684
|
+
body.destroy();
|
|
663
685
|
resolve();
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
686
|
+
}
|
|
687
|
+
function onReadable() {
|
|
688
|
+
cleanup();
|
|
689
|
+
writeHead(nodeRes, res.status, res.statusText, res.headers);
|
|
690
|
+
nodeRes.once('close', () => {
|
|
691
|
+
if (!body.readableEnded) body.destroy();
|
|
692
|
+
resolve();
|
|
693
|
+
});
|
|
694
|
+
nodeRes.on('error', () => body.destroy());
|
|
695
|
+
body.once('error', (error) => nodeRes.destroy(error));
|
|
696
|
+
body.pipe(nodeRes);
|
|
697
|
+
}
|
|
698
|
+
body.once('error', onEarlyError);
|
|
699
|
+
body.once('readable', onReadable);
|
|
700
|
+
nodeRes.once('close', onEarlyClose);
|
|
668
701
|
});
|
|
669
702
|
}
|
|
670
703
|
webRes = new Response(res.body, { status: res.status, statusText: res.statusText, headers: pairs(res.headers) });
|
|
671
704
|
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
if (nodeRes.req?.httpVersion === '2.0') {
|
|
676
|
-
nodeRes.writeHead(webRes.status, writeHeaders);
|
|
677
|
-
} else {
|
|
678
|
-
nodeRes.writeHead(webRes.status, webRes.statusText, writeHeaders);
|
|
679
|
-
}
|
|
680
|
-
}
|
|
705
|
+
// A Web body's status line goes out before its first read, as in srvx:
|
|
706
|
+
// one that errors before its first chunk closes the socket unanswered.
|
|
707
|
+
writeHead(nodeRes, webRes.status, webRes.statusText, [...webRes.headers].flat());
|
|
681
708
|
if (!webRes.body) {
|
|
682
709
|
return new Promise((resolve) => nodeRes.end(resolve));
|
|
683
710
|
}
|
|
@@ -714,6 +741,15 @@ export function sendNodeResponse(nodeRes, webRes) {
|
|
|
714
741
|
});
|
|
715
742
|
}
|
|
716
743
|
|
|
744
|
+
function writeHead(nodeRes, status, statusText, headers) {
|
|
745
|
+
if (nodeRes.headersSent) return;
|
|
746
|
+
if (nodeRes.req?.httpVersion === '2.0') {
|
|
747
|
+
nodeRes.writeHead(status, headers);
|
|
748
|
+
} else {
|
|
749
|
+
nodeRes.writeHead(status, statusText, headers);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
717
753
|
function pairs(flat) {
|
|
718
754
|
const out = [];
|
|
719
755
|
for (let i = 0; i < flat.length; i += 2) out.push([flat[i], flat[i + 1]]);
|
|
@@ -721,8 +757,7 @@ function pairs(flat) {
|
|
|
721
757
|
}
|
|
722
758
|
`;
|
|
723
759
|
}
|
|
724
|
-
|
|
725
|
-
//#region src/adapters/nitro.ts
|
|
760
|
+
// src/adapters/nitro.ts
|
|
726
761
|
/**
|
|
727
762
|
* Create a Nitro-based adapter for multi-platform deployment.
|
|
728
763
|
*
|
|
@@ -749,7 +784,8 @@ function nitro(options = {}) {
|
|
|
749
784
|
if (artifacts.output === "static") {
|
|
750
785
|
await buildStaticDirectoryOutput(config, artifacts, outDir, "public");
|
|
751
786
|
const publicDir = join(outDir, "public");
|
|
752
|
-
|
|
787
|
+
const target = options.staticTarget ?? "generic";
|
|
788
|
+
if (target !== "github-pages") await writeHeadersFile(publicDir, config, artifacts);
|
|
753
789
|
await writeFile(join(outDir, CANONICALIZE_MODULE), await generateCanonicalizeModule());
|
|
754
790
|
await writeFile(join(outDir, PREVIEW_SCRIPT), generatePreviewScript({
|
|
755
791
|
output: "static",
|
|
@@ -757,11 +793,12 @@ function nitro(options = {}) {
|
|
|
757
793
|
base: adapterBase(config),
|
|
758
794
|
contentTypes: artifacts.contentTypes
|
|
759
795
|
}));
|
|
760
|
-
if (
|
|
796
|
+
if (target === "github-pages") {
|
|
761
797
|
await writeFile(join(publicDir, ".nojekyll"), "");
|
|
762
798
|
try {
|
|
763
799
|
if ((await readFile(join(publicDir, "_redirects"), "utf-8")).trim().length > 0) console.warn("[timber] Warning: GitHub Pages does not support _redirects files. Redirect rules from middleware/proxy will not work on this platform.");
|
|
764
800
|
} catch {}
|
|
801
|
+
for (const name of [HEADERS_FILE, REDIRECTS_FILE]) await rm(join(publicDir, name), { force: true });
|
|
765
802
|
}
|
|
766
803
|
return;
|
|
767
804
|
}
|
|
@@ -769,7 +806,8 @@ function nitro(options = {}) {
|
|
|
769
806
|
config,
|
|
770
807
|
artifacts,
|
|
771
808
|
outDir,
|
|
772
|
-
publicDirName: "public"
|
|
809
|
+
publicDirName: "public",
|
|
810
|
+
platformFiles: PRESET_CONFIGS[preset].readsPlatformFiles
|
|
773
811
|
});
|
|
774
812
|
await writeFile(join(outDir, "_compress.mjs"), await generateCompressModule());
|
|
775
813
|
await writeFile(join(outDir, "_send-response.mjs"), generateSendResponseModule());
|
|
@@ -992,7 +1030,6 @@ async function copyPrebuiltToVercelFuncClones(functionsDir, prebuiltSrc, baseFun
|
|
|
992
1030
|
}
|
|
993
1031
|
await Promise.all(funcDirs.map((dir) => cp(prebuiltSrc, join(dir, "prebuilt"), { recursive: true })));
|
|
994
1032
|
}
|
|
995
|
-
//#endregion
|
|
996
1033
|
export { copyPrebuiltToVercelFuncClones, generateNitroEntry, getPostBuildHint, isSuppressedNitroHint, nitro, runNitroBuild, selectSuppressedHintPrefixes, wrapNitroLoggerForBuild };
|
|
997
1034
|
|
|
998
1035
|
//# sourceMappingURL=nitro.js.map
|