@timber-js/app 0.2.0-alpha.222 → 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-vBHr2vqd.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-DdcDLpBj.js → cache-api-TDZ4hlDc.js} +190 -38
- 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-BchW_AtW.js → chains-Dgm3PrMe.js} +3 -4
- package/dist/_chunks/{chains-BchW_AtW.js.map → chains-Dgm3PrMe.js.map} +1 -1
- package/dist/_chunks/{classify-IqzMpxMs.js → classify--_kINHQV.js} +4 -5
- package/dist/_chunks/{classify-IqzMpxMs.js.map → classify--_kINHQV.js.map} +1 -1
- package/dist/_chunks/{cli-check-DQne_YhU.js → cli-check-Dv3f8d2j.js} +5 -6
- package/dist/_chunks/{cli-check-DQne_YhU.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-BS-RFGE2.js → cli-schema-sync-DIPurq7X.js} +4 -5
- package/dist/_chunks/{cli-schema-sync-BS-RFGE2.js.map → cli-schema-sync-DIPurq7X.js.map} +1 -1
- package/dist/_chunks/{cli-schema-sync-v872sHms.js → cli-schema-sync-uq72EZmD.js} +1 -1
- package/dist/_chunks/{client-dep-entries-BJyP9SIu.js → client-dep-entries-CP7AkMCM.js} +4 -5
- package/dist/_chunks/{client-dep-entries-BJyP9SIu.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-VwzrtjIt.js → convention-lint-hZwz5wd4.js} +8 -11
- package/dist/_chunks/{convention-lint-VwzrtjIt.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-BNr5drEO.js → dev-server-C61GWpGg.js} +369 -55
- 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-BdHUOUqg.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-B9PFncvb.js → global-context-DbxNWeBP.js} +2 -3
- package/dist/_chunks/{global-context-B9PFncvb.js.map → global-context-DbxNWeBP.js.map} +1 -1
- 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-C3Sht92C.js → json-lossy-check-DVkLUlfC.js} +3 -4
- package/dist/_chunks/{json-lossy-check-C3Sht92C.js.map → json-lossy-check-DVkLUlfC.js.map} +1 -1
- package/dist/_chunks/{live-graph-DEu_GWbc.js → live-graph-BcVjQ1Te.js} +6 -7
- package/dist/_chunks/{live-graph-DEu_GWbc.js.map → live-graph-BcVjQ1Te.js.map} +1 -1
- package/dist/_chunks/{logger-CI_hThfy.js → logger-CWk44DLp.js} +89 -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-bF0bKoig.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-DTWIfNgD.js → poison-scan-DJYxZc_7.js} +4 -5
- package/dist/_chunks/{poison-scan-DTWIfNgD.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-Ln_u7fX-.js → render-timeout-MrrqD1wd.js} +2 -3
- package/dist/_chunks/{render-timeout-Ln_u7fX-.js.map → render-timeout-MrrqD1wd.js.map} +1 -1
- package/dist/_chunks/{resolve-schema-CkAInout.js → resolve-schema-B-aCuTu3.js} +3 -4
- package/dist/_chunks/{resolve-schema-CkAInout.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-C8fdKvKG.js → scanner-CJC-ScJU.js} +15 -23
- package/dist/_chunks/{scanner-C8fdKvKG.js.map → scanner-CJC-ScJU.js.map} +1 -1
- package/dist/_chunks/{schema-bridge-DpOmvZlI.js → schema-bridge-DyRs3cqy.js} +2 -3
- package/dist/_chunks/{schema-bridge-DpOmvZlI.js.map → schema-bridge-DyRs3cqy.js.map} +1 -1
- 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-D3DNxKFq.js → segment-context-CYiGTi3K.js} +4 -6
- package/dist/_chunks/{segment-context-D3DNxKFq.js.map → segment-context-CYiGTi3K.js.map} +1 -1
- 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-CO3dk0V1.js → sizeof-DG4W40lv.js} +3 -4
- package/dist/_chunks/{sizeof-CO3dk0V1.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-BqzxnwGC.js → walkers-DIE203ir.js} +6 -8
- package/dist/_chunks/{walkers-BqzxnwGC.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/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/index.js +22 -34
- 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/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 +5 -1
- package/dist/plugins/dev-server.d.ts.map +1 -1
- package/dist/plugins/dev-store-clear.d.ts +59 -4
- package/dist/plugins/dev-store-clear.d.ts.map +1 -1
- 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/search-params/index.js +5 -7
- package/dist/search-params/index.js.map +1 -1
- 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 +1061 -943
- package/dist/server/internal.js.map +1 -1
- package/dist/server/logger.d.ts +17 -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 +8 -0
- 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/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 +2 -2
- 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/key-discipline.ts +218 -0
- package/src/cache/timber-cache.ts +42 -5
- 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/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 +96 -37
- package/src/plugins/dev-store-clear.ts +105 -7
- 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 +9 -0
- package/src/server/access-gate.tsx +32 -20
- package/src/server/action-handler.ts +40 -34
- 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 +23 -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 +18 -0
- package/src/server/prebuilt-runtime.ts +43 -44
- 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-vBHr2vqd.js.map +0 -1
- package/dist/_chunks/build-output-helper-RV_BRcF1.js.map +0 -1
- package/dist/_chunks/cache-api-DdcDLpBj.js.map +0 -1
- package/dist/_chunks/chains-B8TCLved.js +0 -1
- package/dist/_chunks/cli-context-BJQB6rtF.js +0 -1
- package/dist/_chunks/dev-server-BNr5drEO.js.map +0 -1
- package/dist/_chunks/dev-server-CUg7Mqh_.js +0 -1
- package/dist/_chunks/dev-store-BOa304m_.js.map +0 -1
- package/dist/_chunks/flight-source-node-BdHUOUqg.js.map +0 -1
- package/dist/_chunks/graph-cache-CYiUS2aS.js.map +0 -1
- package/dist/_chunks/logger-CI_hThfy.js.map +0 -1
- package/dist/_chunks/node-response-bF0bKoig.js.map +0 -1
- package/dist/_chunks/plugin-context-DxMMvjUt.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
|
@@ -46,11 +46,7 @@ import {
|
|
|
46
46
|
withoutChildrenOutlet,
|
|
47
47
|
wrapInSlotsProvider,
|
|
48
48
|
} from './prebuilt/slots.ts';
|
|
49
|
-
import {
|
|
50
|
-
createKeyDisciplineProxy,
|
|
51
|
-
emitKeyDisciplineWarning,
|
|
52
|
-
shouldCheckKeyDiscipline,
|
|
53
|
-
} from './prebuilt/key-discipline.ts';
|
|
49
|
+
import { observeKeyDiscipline } from '../cache/key-discipline.ts';
|
|
54
50
|
import {
|
|
55
51
|
createCaptureScope,
|
|
56
52
|
isCaptureActive,
|
|
@@ -64,9 +60,16 @@ import {
|
|
|
64
60
|
lookupArtifactSeed,
|
|
65
61
|
type Seed,
|
|
66
62
|
} from './prebuilt/payload-source.ts';
|
|
67
|
-
import {
|
|
63
|
+
import {
|
|
64
|
+
lookupOverlay,
|
|
65
|
+
mayStoreRerender,
|
|
66
|
+
storeOverlayEntry,
|
|
67
|
+
overlayKey,
|
|
68
|
+
} from './prebuilt/overlay.ts';
|
|
68
69
|
import {
|
|
69
70
|
clearDevPrebuiltStore,
|
|
71
|
+
devComponentTag,
|
|
72
|
+
devEntryKey,
|
|
70
73
|
discardDevEntry,
|
|
71
74
|
getDevSeed,
|
|
72
75
|
isDevPrebuiltCacheBypassed,
|
|
@@ -298,12 +301,6 @@ async function captureComponentPayload(
|
|
|
298
301
|
// reports the component's own error rather than a stand-in.
|
|
299
302
|
let renderError: { error: unknown } | undefined;
|
|
300
303
|
|
|
301
|
-
// Key-discipline diagnostic (design/45 §Enforcement): proxy the ALS
|
|
302
|
-
// store to detect request-context reads during the capture render.
|
|
303
|
-
// The proxy is transparent — it never blocks or throws; it only observes.
|
|
304
|
-
const store = requestContextAls.getStore();
|
|
305
|
-
const discipline = store && shouldCheckKeyDiscipline(id) ? createKeyDisciplineProxy(store) : null;
|
|
306
|
-
|
|
307
304
|
const doCapture = (): Promise<Uint8Array> =>
|
|
308
305
|
capture.run(async () => {
|
|
309
306
|
// Outside the request's React.cache scope: this payload is stored
|
|
@@ -330,13 +327,10 @@ async function captureComponentPayload(
|
|
|
330
327
|
return bytes;
|
|
331
328
|
});
|
|
332
329
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (discipline && discipline.accessedApis.size > 0) {
|
|
338
|
-
emitKeyDisciplineWarning(id, discipline.accessedApis);
|
|
339
|
-
}
|
|
330
|
+
// Key-discipline diagnostic (design/45 §Enforcement): request-context
|
|
331
|
+
// reads during the capture render are reported, or rejected in strict mode
|
|
332
|
+
// so the tainted payload is never stored.
|
|
333
|
+
const bytes = await observeKeyDiscipline({ tier: 'cache.component', id }, doCapture);
|
|
340
334
|
|
|
341
335
|
return { bytes, nested: capture.nestedRenders() };
|
|
342
336
|
}
|
|
@@ -386,18 +380,20 @@ async function inlineRerender(
|
|
|
386
380
|
): Promise<{ element: unknown } | null> {
|
|
387
381
|
const tags = resolveTags(options, props);
|
|
388
382
|
const oKey = overlayKey(id, cacheKey);
|
|
389
|
-
|
|
383
|
+
// Keyed by the overlay key, which carries the dev namespace: a request
|
|
384
|
+
// after a save never joins a re-render of the pre-save code.
|
|
385
|
+
const sfKey = `prebuilt:${oKey}\0${lastInvalidationEpochFor(oKey, tags)}`;
|
|
390
386
|
|
|
391
387
|
try {
|
|
392
388
|
const payload = await componentSingleflight.do(sfKey, async (signal) => {
|
|
393
389
|
const startEpoch = currentInvalidationEpoch();
|
|
394
390
|
const captured = await captureComponentPayload(id, component, props, options);
|
|
395
391
|
// Skip the store if aborted (singleflight timeout) or if the
|
|
396
|
-
// key/tags were invalidated while rendering
|
|
392
|
+
// key/tags were invalidated, or a dev save landed, while rendering.
|
|
397
393
|
if (
|
|
398
394
|
!signal.aborted &&
|
|
399
395
|
hasRuntimeLifetime(options) &&
|
|
400
|
-
|
|
396
|
+
mayStoreRerender(startEpoch, id, cacheKey, oKey, tags)
|
|
401
397
|
) {
|
|
402
398
|
await storeCapturedEntry(id, cacheKey, captured, options, tags, hasSeed);
|
|
403
399
|
}
|
|
@@ -449,7 +445,7 @@ function backgroundRerender(
|
|
|
449
445
|
const tags = resolveTags(options, props);
|
|
450
446
|
const oKey = overlayKey(id, cacheKey);
|
|
451
447
|
const startEpoch = currentInvalidationEpoch();
|
|
452
|
-
const sfKey = `prebuilt-bg:${
|
|
448
|
+
const sfKey = `prebuilt-bg:${oKey}\0${lastInvalidationEpochFor(oKey, tags)}`;
|
|
453
449
|
|
|
454
450
|
const work = requestContextAls.run(snapshot, () =>
|
|
455
451
|
componentSingleflight
|
|
@@ -461,7 +457,7 @@ function backgroundRerender(
|
|
|
461
457
|
signal,
|
|
462
458
|
async () => {
|
|
463
459
|
const captured = await captureComponentPayload(id, component, props, options);
|
|
464
|
-
if (!signal.aborted &&
|
|
460
|
+
if (!signal.aborted && mayStoreRerender(startEpoch, id, cacheKey, oKey, tags)) {
|
|
465
461
|
await storeCapturedEntry(id, cacheKey, captured, options, tags, hasSeed);
|
|
466
462
|
}
|
|
467
463
|
},
|
|
@@ -489,9 +485,6 @@ function backgroundRerender(
|
|
|
489
485
|
}
|
|
490
486
|
}
|
|
491
487
|
|
|
492
|
-
/** Components already announced by the one-time dev log. */
|
|
493
|
-
const devLoggedIds = new Set<string>();
|
|
494
|
-
|
|
495
488
|
/**
|
|
496
489
|
* Dev: the seed for a prerender entry — the stored capture, or a new one
|
|
497
490
|
* rendered exactly as the build would render it (synthetic store, isolated
|
|
@@ -514,10 +507,16 @@ async function resolveDevSeed(
|
|
|
514
507
|
if (stored) return { payload: stored.bytes, capturedAt: stored.capturedAt };
|
|
515
508
|
|
|
516
509
|
const tags = resolveTags(options, props);
|
|
517
|
-
|
|
518
|
-
//
|
|
519
|
-
//
|
|
520
|
-
|
|
510
|
+
// A source change that drops this component invalidates its tag (or
|
|
511
|
+
// everything), and a hard reload its entry key, so the epoch scopes the
|
|
512
|
+
// flight: a request after either never joins a capture from before it. A
|
|
513
|
+
// save that keeps the component does not. Every save drops an ISR seed
|
|
514
|
+
// (prebuilt/dev-store.ts), so its capture is guarded like a re-render:
|
|
515
|
+
// on the overlay key, which every save moves.
|
|
516
|
+
const isr = hasRuntimeLifetime(options);
|
|
517
|
+
const guardKey = isr ? overlayKey(id, cacheKey) : devEntryKey(id, cacheKey);
|
|
518
|
+
const guardTags = [...tags, devComponentTag(id)];
|
|
519
|
+
const sfKey = `prebuilt-dev:${guardKey}\0${lastInvalidationEpochFor(guardKey, guardTags)}`;
|
|
521
520
|
try {
|
|
522
521
|
return await componentSingleflight.do(sfKey, async (signal) => {
|
|
523
522
|
const startEpoch = currentInvalidationEpoch();
|
|
@@ -537,18 +536,17 @@ async function resolveDevSeed(
|
|
|
537
536
|
}
|
|
538
537
|
// A save (or revalidateTag) while this rendered: the bytes may come
|
|
539
538
|
// from the old code, so this request gets them but the store does not.
|
|
540
|
-
|
|
541
|
-
|
|
539
|
+
const moved = isr && overlayKey(id, cacheKey) !== guardKey;
|
|
540
|
+
if (!signal.aborted && !moved && !wasInvalidatedSince(startEpoch, guardKey, guardTags)) {
|
|
541
|
+
setDevSeed(id, cacheKey, {
|
|
542
|
+
bytes: outcome.bytes,
|
|
543
|
+
tags,
|
|
544
|
+
capturedAt,
|
|
545
|
+
isr,
|
|
546
|
+
});
|
|
542
547
|
warnNestingClamps({ id, options, tags }, outcome.nested, warnedNestingPairs, (m) =>
|
|
543
548
|
console.warn(m)
|
|
544
549
|
);
|
|
545
|
-
if (!devLoggedIds.has(id)) {
|
|
546
|
-
devLoggedIds.add(id);
|
|
547
|
-
console.log(
|
|
548
|
-
`[timber] cache.component "${id}": prerendered in dev — served from memory until ` +
|
|
549
|
-
`a file changes. A hard reload (Cache-Control: no-cache) renders it again.`
|
|
550
|
-
);
|
|
551
|
-
}
|
|
552
550
|
}
|
|
553
551
|
return { payload: outcome.bytes, capturedAt };
|
|
554
552
|
});
|
|
@@ -756,12 +754,13 @@ export function __prebuilt<C extends ServerComponent>(
|
|
|
756
754
|
const registration: PrebuiltRegistration = { id, component, options };
|
|
757
755
|
if (isDevPrebuiltStoreActive()) {
|
|
758
756
|
// Dev: a second registration of an ID means its module re-evaluated,
|
|
759
|
-
// so some code in this subtree changed.
|
|
760
|
-
// the watcher event already did (it may land after this
|
|
761
|
-
// rendered).
|
|
757
|
+
// so some code in this subtree changed. Drop its entries rather than
|
|
758
|
+
// trust that the watcher event already did (it may land after this
|
|
759
|
+
// request rendered). Only its own: every module whose code could have
|
|
760
|
+
// changed with it re-evaluates too, and drops its own. Dev keeps only the ID: nothing walks the registry there,
|
|
762
761
|
// and an edited call site gets a new ID, so holding registrations
|
|
763
762
|
// would pin every superseded component and its module for the session.
|
|
764
|
-
if (devRegisteredIds.has(id)) clearDevPrebuiltStore();
|
|
763
|
+
if (devRegisteredIds.has(id)) clearDevPrebuiltStore([id]);
|
|
765
764
|
devRegisteredIds.add(id);
|
|
766
765
|
} else {
|
|
767
766
|
registry.set(id, registration);
|
package/src/server/primitives.ts
CHANGED
|
@@ -141,6 +141,20 @@ export class DenySignal extends Error {
|
|
|
141
141
|
*/
|
|
142
142
|
_hardNavigate?: boolean;
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* When true, no boundary in the tree that threw this may place it: the
|
|
146
|
+
* denying gate guards a segment of the URL's own route that the rendered
|
|
147
|
+
* tree does not contain, so none of its deny pages, nor their layouts, are
|
|
148
|
+
* here. Set by the gate an intercepted navigation renders for each such
|
|
149
|
+
* segment (TIM-1607), together with `_hardNavigate`.
|
|
150
|
+
*
|
|
151
|
+
* Flight's `onError` does not late-address it, and its row carries
|
|
152
|
+
* `leaveSpa`, which every client boundary declines but the terminal, which
|
|
153
|
+
* leaves the SPA — so the document request for the URL renders the URL's
|
|
154
|
+
* own deny page with its real status, wherever the deny lands in time.
|
|
155
|
+
*/
|
|
156
|
+
_leaveSpa?: boolean;
|
|
157
|
+
|
|
144
158
|
constructor(status: number, data?: JsonSerializable) {
|
|
145
159
|
super(`Access denied with status ${status}`);
|
|
146
160
|
this.name = 'DenySignal';
|
|
@@ -18,14 +18,39 @@ export function nonceAttr(nonce: string | undefined): string {
|
|
|
18
18
|
return nonce ? ` nonce="${nonce}"` : '';
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* The reason to abort a render with when its consumer releases it.
|
|
23
|
+
*
|
|
24
|
+
* The framework releases a Flight render it no longer needs — the renderer
|
|
25
|
+
* once a deny or redirect is captured, a tee once either branch is done —
|
|
26
|
+
* usually without a reason. React then reports the abort to the render's
|
|
27
|
+
* `onError` as a plain `Error("The render was aborted by the server without a
|
|
28
|
+
* reason.")`, which reads as an application failure: a `metadata()` that
|
|
29
|
+
* denies while the page is still fetching logged an unhandled render error
|
|
30
|
+
* (TIM-1597). An `AbortError` is what {@link isAbortError} already treats as
|
|
31
|
+
* not-an-error. A reason the caller did pass (a timeout, the tee's divergence
|
|
32
|
+
* guard) is kept, so those still reach the log.
|
|
33
|
+
*/
|
|
34
|
+
export function releaseReason(reason: unknown): unknown {
|
|
35
|
+
return reason ?? new DOMException('The render was released by its consumer.', 'AbortError');
|
|
36
|
+
}
|
|
37
|
+
|
|
21
38
|
/**
|
|
22
39
|
* Check if an error is an abort error (connection closed by client).
|
|
23
40
|
*
|
|
24
41
|
* When the browser aborts a request (page refresh, navigation away),
|
|
25
42
|
* the AbortSignal fires and React/streams throw an AbortError. This
|
|
26
43
|
* is not an application error — suppress it from error boundaries and logs.
|
|
44
|
+
*
|
|
45
|
+
* A native `ReadableStream.tee()` cancels its source with an array of both
|
|
46
|
+
* branches' reasons (Streams spec, ReadableStreamDefaultTee), so a Web
|
|
47
|
+
* render released through a tee is aborted with `[reason1, reason2]`. That is
|
|
48
|
+
* an abort when every entry is — a tee whose branches were both released
|
|
49
|
+
* ({@link releaseReason}) — and an error when any entry is, such as the
|
|
50
|
+
* divergence guard's.
|
|
27
51
|
*/
|
|
28
52
|
export function isAbortError(error: unknown): boolean {
|
|
53
|
+
if (Array.isArray(error)) return error.length > 0 && error.every(isAbortError);
|
|
29
54
|
if (error instanceof DOMException && error.name === 'AbortError') return true;
|
|
30
55
|
if (error instanceof Error && error.name === 'AbortError') return true;
|
|
31
56
|
return false;
|
|
@@ -211,12 +211,36 @@ export function runWithSlotSegmentParams<T>(
|
|
|
211
211
|
): T {
|
|
212
212
|
const store = requestContextAls.getStore();
|
|
213
213
|
if (!store?.segmentParams) return fn();
|
|
214
|
+
return runWithSegmentParams(
|
|
215
|
+
slotSegmentPath ?? store.matchedSegmentPath,
|
|
216
|
+
mergeSlotParams(store.segmentParams, slotParams),
|
|
217
|
+
fn
|
|
218
|
+
);
|
|
219
|
+
}
|
|
214
220
|
|
|
215
|
-
|
|
216
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Run `fn` with exactly these segment params, and this matched segment
|
|
223
|
+
* path, standing in for the main route's — what a no-arg
|
|
224
|
+
* `getSegmentParams()` returns inside it.
|
|
225
|
+
*
|
|
226
|
+
* The parallel-slot scope above is one use. The other is an intercepted
|
|
227
|
+
* navigation (TIM-1607): the URL's own middleware and access.ts run while the
|
|
228
|
+
* request publishes the *rendered* route's params, and each must see the
|
|
229
|
+
* params of the route it was written for. Same Proxy, for the same reason:
|
|
230
|
+
* every write still reaches the live store.
|
|
231
|
+
*
|
|
232
|
+
* @internal — framework use only
|
|
233
|
+
*/
|
|
234
|
+
export function runWithSegmentParams<T>(
|
|
235
|
+
matchedSegmentPath: string | undefined,
|
|
236
|
+
segmentParams: CoercedParams,
|
|
237
|
+
fn: () => T
|
|
238
|
+
): T {
|
|
239
|
+
const store = requestContextAls.getStore();
|
|
240
|
+
if (!store) return fn();
|
|
217
241
|
const scoped = new Proxy(store, {
|
|
218
242
|
get(target, prop, receiver) {
|
|
219
|
-
if (prop === 'segmentParams') return
|
|
243
|
+
if (prop === 'segmentParams') return segmentParams;
|
|
220
244
|
if (prop === 'matchedSegmentPath') return matchedSegmentPath;
|
|
221
245
|
return Reflect.get(target, prop, receiver);
|
|
222
246
|
},
|
|
@@ -51,6 +51,7 @@ import { loadModule, type ManifestLoader } from './safe-load.ts';
|
|
|
51
51
|
import { loadFallbackModule } from './pipeline-helpers.ts';
|
|
52
52
|
import { replaceOutermostSegmentOutlet } from './route-element-helpers.ts';
|
|
53
53
|
import { getActionErrorForRender } from './request-context.ts';
|
|
54
|
+
import { loadInterceptionGates } from './interception-gates.ts';
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
* The `segments` array handed to a layout's `SegmentProvider` — the value
|
|
@@ -221,6 +222,13 @@ export async function buildRouteElement(
|
|
|
221
222
|
// No pre-render access pass needed. See TIM-1363.
|
|
222
223
|
const { metadataSources, layoutComponents, PageComponent, deferSuspenseFor, accessFns } =
|
|
223
224
|
await loadRouteModules(segments, req.url);
|
|
225
|
+
// An intercepted navigation renders a route its URL does not name. The
|
|
226
|
+
// URL's whole access chain gates the tree, from its top, with the URL's
|
|
227
|
+
// params; the segments both chains share get no gate of their own here, so
|
|
228
|
+
// each access.ts runs once (TIM-1607, interception-gates.ts).
|
|
229
|
+
const interceptionGates = await loadInterceptionGates(match);
|
|
230
|
+
const gateFor = (i: number): AccessFn =>
|
|
231
|
+
i < (interceptionGates?.sharedCount ?? 0) ? undefined : accessFns[i];
|
|
224
232
|
|
|
225
233
|
// Compute state-tree keys for all segments. Route groups accumulate
|
|
226
234
|
// ancestor group names for globally unique keys (e.g., "/(a)/(shared)"
|
|
@@ -402,7 +410,7 @@ export async function buildRouteElement(
|
|
|
402
410
|
// client hard-navigates for a clean full render — when the deny lands
|
|
403
411
|
// inside Flight's opening window. After it, the unaddressed row reaches
|
|
404
412
|
// the terminal boundary the last full render left mounted. See TIM-1363.
|
|
405
|
-
const accessFn =
|
|
413
|
+
const accessFn = gateFor(i);
|
|
406
414
|
if (accessFn) {
|
|
407
415
|
element = wrapAccessGate(
|
|
408
416
|
element,
|
|
@@ -568,7 +576,7 @@ export async function buildRouteElement(
|
|
|
568
576
|
// Parent layouts (from outer iterations) form the shell. Access runs
|
|
569
577
|
// exactly once, during render, inside React.cache scope — layouts
|
|
570
578
|
// share the cache. See TIM-1363, design/04-authorization.md.
|
|
571
|
-
const accessFn =
|
|
579
|
+
const accessFn = gateFor(i);
|
|
572
580
|
if (accessFn) {
|
|
573
581
|
element = wrapAccessGate(
|
|
574
582
|
element,
|
|
@@ -584,6 +592,11 @@ export async function buildRouteElement(
|
|
|
584
592
|
}
|
|
585
593
|
}
|
|
586
594
|
|
|
595
|
+
// The URL's own gates, around everything a segment of this tree renders —
|
|
596
|
+
// slots included — and inside the terminal below, which leaves the SPA for
|
|
597
|
+
// their deny (TIM-1607).
|
|
598
|
+
if (interceptionGates) element = interceptionGates.wrap(element, h);
|
|
599
|
+
|
|
587
600
|
// On partial navigation (some segments skipped), the client already has a
|
|
588
601
|
// SegmentOutlet mounted at the outermost non-skipped segment's position.
|
|
589
602
|
// Sending another SegmentOutlet in the payload causes double-wrapping —
|
|
@@ -151,9 +151,10 @@ async function runHandler(handler: RouteHandler, ctx: RouteContext): Promise<Res
|
|
|
151
151
|
/**
|
|
152
152
|
* Merge response headers from ctx.headers into the handler's response.
|
|
153
153
|
* ctx.headers (set by middleware or the handler) are applied to the final response.
|
|
154
|
-
* Handler-set headers take precedence over ctx.headers.
|
|
154
|
+
* Handler-set headers take precedence over ctx.headers. Metadata routes
|
|
155
|
+
* behind gates merge their middleware's headers the same way.
|
|
155
156
|
*/
|
|
156
|
-
function mergeResponseHeaders(res: Response, ctxHeaders: Headers): Response {
|
|
157
|
+
export function mergeResponseHeaders(res: Response, ctxHeaders: Headers): Response {
|
|
157
158
|
// If no ctx headers to merge, return as-is
|
|
158
159
|
let hasCtxHeaders = false;
|
|
159
160
|
ctxHeaders.forEach(() => {
|
|
@@ -93,6 +93,20 @@ function matchPathname(root: ManifestSegmentNode, pathname: string): RouteMatch
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
/**
|
|
97
|
+
* The matched segment path of a chain — its segment names, groups and slots
|
|
98
|
+
* included — as `getSegmentParams()`'s dev-mode validation compares against.
|
|
99
|
+
* See design/41-global-params.md §Runtime Validation.
|
|
100
|
+
*/
|
|
101
|
+
export function matchedSegmentPath(chain: ManifestSegmentNode[]): string {
|
|
102
|
+
const path =
|
|
103
|
+
chain
|
|
104
|
+
.map((s) => s.segmentName)
|
|
105
|
+
.filter(Boolean)
|
|
106
|
+
.join('/') || '/';
|
|
107
|
+
return path.startsWith('/') ? path : `/${path}`;
|
|
108
|
+
}
|
|
109
|
+
|
|
96
110
|
/**
|
|
97
111
|
* Collect middleware from a matched segment chain, root to leaf.
|
|
98
112
|
*
|
|
@@ -152,14 +166,19 @@ export interface MetadataRouteMatch {
|
|
|
152
166
|
contentType: string;
|
|
153
167
|
/** The manifest file reference for the handler module. */
|
|
154
168
|
file: ManifestFile;
|
|
155
|
-
/**
|
|
156
|
-
|
|
169
|
+
/**
|
|
170
|
+
* The segment chain from the root to the segment that owns the file, as
|
|
171
|
+
* a page's match would carry it: route groups and a zero-segment
|
|
172
|
+
* `[[...slug]]` the file sits in included. The pipeline coerces params
|
|
173
|
+
* and runs `middleware.ts` / `access.ts` over it (TIM-1609, TIM-1612).
|
|
174
|
+
*/
|
|
175
|
+
segments: ManifestSegmentNode[];
|
|
157
176
|
/**
|
|
158
177
|
* Whether this is a static file (e.g. sitemap.xml, favicon.ico, icon.png)
|
|
159
178
|
* that should be served from disk rather than executed as a handler.
|
|
160
179
|
*/
|
|
161
180
|
isStatic: boolean;
|
|
162
|
-
/**
|
|
181
|
+
/** Raw segment params from dynamic segments in the URL prefix. */
|
|
163
182
|
segmentParams: Record<string, string | string[]>;
|
|
164
183
|
}
|
|
165
184
|
|
|
@@ -213,8 +232,8 @@ export function matchMetadataRoute(
|
|
|
213
232
|
// For root-level routes (e.g. /sitemap.xml), prefix is empty → root segment.
|
|
214
233
|
const prefixParts = parts.slice(0, -1);
|
|
215
234
|
|
|
216
|
-
let
|
|
217
|
-
let params: Record<string, string | string[]
|
|
235
|
+
let segments: ManifestSegmentNode[] = [];
|
|
236
|
+
let params: Record<string, string | string[]> = {};
|
|
218
237
|
let file: ManifestFile | null = null;
|
|
219
238
|
|
|
220
239
|
// Find the metadata file owner. For prefix matches, iterate all matching
|
|
@@ -223,8 +242,6 @@ export function matchMetadataRoute(
|
|
|
223
242
|
// search all group children since findMetadataRouteInSegment may return
|
|
224
243
|
// a file with the wrong extension when multiple groups own the same
|
|
225
244
|
// convention with different static types.
|
|
226
|
-
segment = root;
|
|
227
|
-
params = {};
|
|
228
245
|
const candidates = [...metadataOwnerCandidates(root, prefixParts)];
|
|
229
246
|
|
|
230
247
|
// Two passes: direct owners first (node itself + groups), then
|
|
@@ -232,20 +249,21 @@ export function matchMetadataRoute(
|
|
|
232
249
|
// candidate must beat a zero-segment catch-all on an earlier candidate.
|
|
233
250
|
for (const allowCatchAll of [false, true]) {
|
|
234
251
|
for (const candidate of candidates) {
|
|
235
|
-
|
|
252
|
+
const owner = candidate.chain[candidate.chain.length - 1];
|
|
253
|
+
if (!convention.nestable && owner !== root) continue;
|
|
236
254
|
const found = findMetadataRouteInSegment(
|
|
237
|
-
|
|
255
|
+
owner,
|
|
238
256
|
baseName,
|
|
239
257
|
allowCatchAll && convention.nestable
|
|
240
258
|
);
|
|
241
259
|
if (!found) continue;
|
|
242
260
|
if (convention.serveExtension) {
|
|
243
|
-
const resolvedServePath = resolveServePathForFile(baseName, found.filePath);
|
|
261
|
+
const resolvedServePath = resolveServePathForFile(baseName, found.file.filePath);
|
|
244
262
|
if (lastPart !== resolvedServePath) continue;
|
|
245
263
|
}
|
|
246
|
-
|
|
264
|
+
segments = [...candidate.chain, ...found.descent];
|
|
247
265
|
params = candidate.params;
|
|
248
|
-
file = found;
|
|
266
|
+
file = found.file;
|
|
249
267
|
break;
|
|
250
268
|
}
|
|
251
269
|
if (file) break;
|
|
@@ -263,7 +281,7 @@ export function matchMetadataRoute(
|
|
|
263
281
|
type: convention.type,
|
|
264
282
|
contentType,
|
|
265
283
|
file,
|
|
266
|
-
|
|
284
|
+
segments,
|
|
267
285
|
isStatic,
|
|
268
286
|
segmentParams: params,
|
|
269
287
|
};
|
|
@@ -287,19 +305,21 @@ export function matchMetadataRoute(
|
|
|
287
305
|
* child of the root IS at the root.
|
|
288
306
|
*
|
|
289
307
|
* The segment's own metadata file wins over a zero-segment child's.
|
|
308
|
+
*
|
|
309
|
+
* `descent` is the path below `node` to the segment that owns the file —
|
|
310
|
+
* empty when `node` owns it — so the match's chain reaches the owner.
|
|
290
311
|
*/
|
|
291
312
|
function findMetadataRouteInSegment(
|
|
292
313
|
node: ManifestSegmentNode,
|
|
293
314
|
baseName: string,
|
|
294
315
|
nestable: boolean
|
|
295
|
-
): ManifestFile | null {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
316
|
+
): { file: ManifestFile; descent: ManifestSegmentNode[] } | null {
|
|
317
|
+
const own = node.metadataRoutes?.[baseName];
|
|
318
|
+
if (own) return { file: own, descent: [] };
|
|
299
319
|
for (const child of node.children) {
|
|
300
320
|
if (child.segmentType === 'group' || (nestable && child.segmentType === 'optional-catch-all')) {
|
|
301
321
|
const found = findMetadataRouteInSegment(child, baseName, nestable);
|
|
302
|
-
if (found) return found;
|
|
322
|
+
if (found) return { file: found.file, descent: [child, ...found.descent] };
|
|
303
323
|
}
|
|
304
324
|
}
|
|
305
325
|
return null;
|
|
@@ -316,30 +336,25 @@ function findMetadataRouteInSegment(
|
|
|
316
336
|
function* metadataOwnerCandidates(
|
|
317
337
|
root: ManifestSegmentNode,
|
|
318
338
|
prefixParts: string[]
|
|
319
|
-
): Generator<{
|
|
339
|
+
): Generator<{ chain: ManifestSegmentNode[]; params: Record<string, string | string[]> }> {
|
|
320
340
|
if (prefixParts.length === 0) {
|
|
321
|
-
|
|
322
|
-
//
|
|
323
|
-
|
|
324
|
-
for (const child of root.children) {
|
|
325
|
-
if (child.segmentType === 'group') {
|
|
326
|
-
yield* groupDescendants(child);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
341
|
+
// The root, then each group below it individually, so the caller can
|
|
342
|
+
// validate extensions per-group rather than taking the first file found.
|
|
343
|
+
yield* groupDescendants([root]);
|
|
329
344
|
} else {
|
|
330
345
|
for (const result of matchUrlPartsAll(root, prefixParts, { requireTerminal: false })) {
|
|
331
|
-
yield {
|
|
346
|
+
yield { chain: result.chain, params: result.params };
|
|
332
347
|
}
|
|
333
348
|
}
|
|
334
349
|
}
|
|
335
350
|
|
|
336
351
|
function* groupDescendants(
|
|
337
|
-
|
|
338
|
-
): Generator<{
|
|
339
|
-
yield {
|
|
340
|
-
for (const child of
|
|
352
|
+
chain: ManifestSegmentNode[]
|
|
353
|
+
): Generator<{ chain: ManifestSegmentNode[]; params: Record<string, string | string[]> }> {
|
|
354
|
+
yield { chain, params: {} };
|
|
355
|
+
for (const child of chain[chain.length - 1].children) {
|
|
341
356
|
if (child.segmentType === 'group') {
|
|
342
|
-
yield* groupDescendants(child);
|
|
357
|
+
yield* groupDescendants([...chain, child]);
|
|
343
358
|
}
|
|
344
359
|
}
|
|
345
360
|
}
|
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
* per route type (TIM-1537, TIM-1533).
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { withSpan, setSpanAttribute } from '../tracing.ts';
|
|
17
16
|
import type { ManifestSegmentNode } from '../route-matcher.ts';
|
|
18
17
|
import { loadModule } from '../safe-load.ts';
|
|
19
|
-
import {
|
|
18
|
+
import { runAccessChain } from '../traced-access.ts';
|
|
20
19
|
import { handleRouteRequest } from '../route-handler.ts';
|
|
21
20
|
import type { RouteModule } from '../route-handler.ts';
|
|
22
21
|
import type { RouteContext } from '../types.ts';
|
|
@@ -38,37 +37,7 @@ export async function handleApiRoute(
|
|
|
38
37
|
): Promise<Response> {
|
|
39
38
|
const leaf = segments[segments.length - 1];
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
// Each access.ts is independent — deny()/redirect() throws a signal.
|
|
43
|
-
for (const segment of segments) {
|
|
44
|
-
if (segment.access) {
|
|
45
|
-
const accessMod = await loadModule(segment.access);
|
|
46
|
-
const accessFn = accessMod.default as (() => unknown) | undefined;
|
|
47
|
-
if (accessFn) {
|
|
48
|
-
await withSpan(
|
|
49
|
-
'timber.access',
|
|
50
|
-
{ 'timber.segment': segment.segmentName ?? 'unknown' },
|
|
51
|
-
async () => {
|
|
52
|
-
try {
|
|
53
|
-
await accessFn();
|
|
54
|
-
await setSpanAttribute('timber.result', 'pass');
|
|
55
|
-
} catch (error) {
|
|
56
|
-
if (isDenySignal(error)) {
|
|
57
|
-
await setSpanAttribute('timber.result', 'deny');
|
|
58
|
-
await setSpanAttribute('timber.deny_status', error.status);
|
|
59
|
-
if (error.sourceFile) {
|
|
60
|
-
await setSpanAttribute('timber.deny_file', error.sourceFile);
|
|
61
|
-
}
|
|
62
|
-
} else if (isRedirectSignal(error)) {
|
|
63
|
-
await setSpanAttribute('timber.result', 'redirect');
|
|
64
|
-
}
|
|
65
|
-
throw error;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
40
|
+
await runAccessChain(segments);
|
|
72
41
|
|
|
73
42
|
// Load route.ts module and dispatch.
|
|
74
43
|
// Segment params / query params are NOT on `ctx` — handlers read them
|
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
PREBUILT_DEV_CLEAR_EVENT,
|
|
63
63
|
clearDevPrebuiltStore,
|
|
64
64
|
setDevPrebuiltStoreMode,
|
|
65
|
+
type DevStoreClear,
|
|
65
66
|
} from '../prebuilt/dev-store.ts';
|
|
66
67
|
import { renderRoute } from './render-route.ts';
|
|
67
68
|
import { isDebug, isDevMode, setDebugFromConfig } from '../debug.ts';
|
|
@@ -70,7 +71,7 @@ import { setPrebuiltPayloadSource } from '../prebuilt/payload-source.ts';
|
|
|
70
71
|
import { setRscFunctions, setComponentRefreshTimeout } from '../prebuilt-runtime.ts';
|
|
71
72
|
import { cancelFlightSource, setFlightRenderTimeout } from '../flight-source.ts';
|
|
72
73
|
import { installReactCacheBridge } from '../react-cache-bridge.ts';
|
|
73
|
-
import { setKeyDisciplineStrict } from '
|
|
74
|
+
import { setKeyDisciplineStrict } from '../../cache/key-discipline.ts';
|
|
74
75
|
import { createAutoSitemapHandler } from '../sitemap-handler.ts';
|
|
75
76
|
import { generateStaticSite } from '../static-generator.ts';
|
|
76
77
|
|
|
@@ -144,13 +145,16 @@ async function createRequestHandler(manifest: typeof routeManifest, runtimeConfi
|
|
|
144
145
|
// In dev mode there are no prebuilt artifacts — source stays null and the
|
|
145
146
|
// in-memory dev store stands in for them: prerender entries are captured
|
|
146
147
|
// on first request and cleared on every dev-server watcher event, which
|
|
147
|
-
// the timber-dev-server plugin forwards here (TIM-1588)
|
|
148
|
+
// the timber-dev-server plugin forwards here (TIM-1588), scoped to the
|
|
149
|
+
// components the saved module could have changed (TIM-1599). Without HMR
|
|
148
150
|
// (`server.hmr: false`) no event would ever clear it, so dev bypasses
|
|
149
151
|
// cache.component caching entirely and every wrapper renders live.
|
|
150
152
|
if (isDevMode()) {
|
|
151
153
|
if (import.meta.hot) {
|
|
152
154
|
setDevPrebuiltStoreMode('active');
|
|
153
|
-
import.meta.hot.on(PREBUILT_DEV_CLEAR_EVENT,
|
|
155
|
+
import.meta.hot.on(PREBUILT_DEV_CLEAR_EVENT, (data: DevStoreClear) =>
|
|
156
|
+
clearDevPrebuiltStore(data.componentIds)
|
|
157
|
+
);
|
|
154
158
|
} else {
|
|
155
159
|
setDevPrebuiltStoreMode('bypass');
|
|
156
160
|
}
|
|
@@ -313,6 +317,7 @@ async function createRequestHandler(manifest: typeof routeManifest, runtimeConfi
|
|
|
313
317
|
matchRoute,
|
|
314
318
|
csrf: csrfConfig,
|
|
315
319
|
matchMetadataRoute,
|
|
320
|
+
renderTimeoutMs: (config as Record<string, unknown>).renderTimeoutMs as number,
|
|
316
321
|
// 103 Early Hints — fires after route match, before middleware.
|
|
317
322
|
// Collects CSS, font, and JS chunk Link headers from the build manifest
|
|
318
323
|
// so the browser starts fetching critical resources while the server renders.
|
|
@@ -69,7 +69,12 @@ export function renderRscStream(
|
|
|
69
69
|
// Resolve it against the leaf deny chain and stamp the full
|
|
70
70
|
// candidate list so the client can find the first reachable
|
|
71
71
|
// owner via its ancestry context.
|
|
72
|
-
|
|
72
|
+
//
|
|
73
|
+
// Not a deny the tree cannot hold (`_leaveSpa`, TIM-1607): the
|
|
74
|
+
// leaf chain here is the rendered route's, and its files are not
|
|
75
|
+
// the URL's answer. Left unaddressed, it is the deny fallback's
|
|
76
|
+
// inside the opening window, and the client terminal's after it.
|
|
77
|
+
if (!error.owners && leafDenyChain && !error._leaveSpa) {
|
|
73
78
|
const entries = matchDenyEntries(leafDenyChain, error.status);
|
|
74
79
|
if (entries.length > 0) {
|
|
75
80
|
error.owners = entries.map((e) => e.ownerKey);
|
|
@@ -81,6 +86,7 @@ export function renderRscStream(
|
|
|
81
86
|
status: error.status,
|
|
82
87
|
data: error.data,
|
|
83
88
|
owners: error.owners,
|
|
89
|
+
leaveSpa: error._leaveSpa,
|
|
84
90
|
});
|
|
85
91
|
}
|
|
86
92
|
if (isRedirectSignal(error)) {
|