@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
package/src/cli-init.ts
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `timber init` — point a project's agent instruction files at the guide
|
|
3
|
+
* that ships inside the installed `@timber-js/app` package.
|
|
4
|
+
*
|
|
5
|
+
* The guide (`node_modules/@timber-js/app/agent-skill.md`) is never copied.
|
|
6
|
+
* A copy freezes at the version `init` ran with; a pointer always reads the
|
|
7
|
+
* installed version. Each of `AGENTS.md` and `CLAUDE.md` gets one
|
|
8
|
+
* marker-delimited block that timber owns; everything outside the markers
|
|
9
|
+
* belongs to the user and is never touched.
|
|
10
|
+
*
|
|
11
|
+
* This module is also the single source of the block text: the
|
|
12
|
+
* create-timber-app templates are generated from `agentsFileContent()` /
|
|
13
|
+
* `claudeFileContent()` and a test fails if they drift.
|
|
14
|
+
*
|
|
15
|
+
* See design/11-platform.md §"`timber init` — agent guide pointer blocks".
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
existsSync,
|
|
20
|
+
lstatSync,
|
|
21
|
+
readFileSync,
|
|
22
|
+
readlinkSync,
|
|
23
|
+
realpathSync,
|
|
24
|
+
renameSync,
|
|
25
|
+
rmSync,
|
|
26
|
+
writeFileSync,
|
|
27
|
+
} from 'node:fs';
|
|
28
|
+
import { dirname, join, relative, resolve, sep } from 'node:path';
|
|
29
|
+
|
|
30
|
+
export const BLOCK_START = '<!-- timber:start -->';
|
|
31
|
+
export const BLOCK_END = '<!-- timber:end -->';
|
|
32
|
+
|
|
33
|
+
/** Where the guide lives, relative to the project root, in a non-hoisted install. */
|
|
34
|
+
export const AGENT_GUIDE_PATH = 'node_modules/@timber-js/app/agent-skill.md';
|
|
35
|
+
|
|
36
|
+
/** The AGENTS.md block: a plain pointer, for every AGENTS.md-reading tool. */
|
|
37
|
+
export function agentsBlock(guide: string = AGENT_GUIDE_PATH): string {
|
|
38
|
+
return [
|
|
39
|
+
BLOCK_START,
|
|
40
|
+
`This is a timber.js app. Before working, read \`${guide}\`.`,
|
|
41
|
+
'It matches the installed timber version and updates when timber is upgraded.',
|
|
42
|
+
BLOCK_END,
|
|
43
|
+
].join('\n');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The CLAUDE.md block: Claude Code's `@path` imports, so the guide is
|
|
48
|
+
* loaded into every session instead of relying on the agent following a
|
|
49
|
+
* pointer. `@AGENTS.md` carries the user's own AGENTS.md content to Claude.
|
|
50
|
+
* A missing import target is skipped silently, so the block is harmless
|
|
51
|
+
* before `node_modules` exists.
|
|
52
|
+
*/
|
|
53
|
+
export function claudeBlock(guide: string = AGENT_GUIDE_PATH): string {
|
|
54
|
+
return [BLOCK_START, `@${guide}`, '@AGENTS.md', BLOCK_END].join('\n');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** A freshly created AGENTS.md: just the block. */
|
|
58
|
+
export function agentsFileContent(): string {
|
|
59
|
+
return agentsBlock() + '\n';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A freshly created CLAUDE.md: just the block. */
|
|
63
|
+
export function claudeFileContent(): string {
|
|
64
|
+
return claudeBlock() + '\n';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Files timber wrote before the pointer model. A file matching one of
|
|
69
|
+
* these is timber's, not the user's, and is replaced (after a backup)
|
|
70
|
+
* rather than appended to. Anything else is user-authored.
|
|
71
|
+
*/
|
|
72
|
+
function isLegacyCopy(content: string): boolean {
|
|
73
|
+
const trimmed = content.replace(/^\uFEFF/, '').trim();
|
|
74
|
+
const firstLine = trimmed.split(/\r?\n/, 1)[0].trim();
|
|
75
|
+
return (
|
|
76
|
+
// Old `timber init`: the full agent-skill.md copied into AGENTS.md.
|
|
77
|
+
firstLine === '# timber.js — AI Agent Skill' ||
|
|
78
|
+
// Old create-timber-app AGENTS.md.
|
|
79
|
+
firstLine === '# timber.js Project' ||
|
|
80
|
+
// Old create-timber-app CLAUDE.md, and old `init`'s Windows fallback.
|
|
81
|
+
trimmed === 'Read AGENTS.md for project context and conventions.' ||
|
|
82
|
+
// Old `init`'s CLAUDE.md symlink, checked out with core.symlinks=false:
|
|
83
|
+
// a regular file whose whole content is the link target.
|
|
84
|
+
trimmed === 'AGENTS.md'
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type InitOutcome =
|
|
89
|
+
| { kind: 'created' }
|
|
90
|
+
| { kind: 'updated' }
|
|
91
|
+
| { kind: 'appended' }
|
|
92
|
+
| { kind: 'unchanged' }
|
|
93
|
+
| { kind: 'replaced-legacy'; backup: string }
|
|
94
|
+
| { kind: 'replaced-symlink' }
|
|
95
|
+
| { kind: 'skipped-symlink'; target: string };
|
|
96
|
+
|
|
97
|
+
/** What `init` will do to one file, decided before anything is written. */
|
|
98
|
+
interface Plan {
|
|
99
|
+
outcome: InitOutcome;
|
|
100
|
+
apply(): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Indices of lines that are exactly `marker` (surrounding whitespace allowed). */
|
|
104
|
+
function markerLines(lines: string[], marker: string): number[] {
|
|
105
|
+
return lines.flatMap((line, i) => (line.trim() === marker ? [i] : []));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Replace the contents of an existing block, or return null when the file
|
|
110
|
+
* has none. A marker counts only on a line of its own, so prose or a code
|
|
111
|
+
* sample that mentions one is ordinary content. A start without an end (or
|
|
112
|
+
* the reverse, or two blocks) is a hand-edit we cannot interpret: fail
|
|
113
|
+
* loudly rather than append a second block or guess where the user's
|
|
114
|
+
* content ends. `eol` keeps a CRLF file CRLF.
|
|
115
|
+
*/
|
|
116
|
+
function replaceBlock(content: string, block: string, file: string, eol: string): string | null {
|
|
117
|
+
// Split on \n only: a CRLF file's lines keep their \r, so every line
|
|
118
|
+
// outside the block is reassembled byte-for-byte.
|
|
119
|
+
const lines = content.split('\n');
|
|
120
|
+
const starts = markerLines(lines, BLOCK_START);
|
|
121
|
+
const ends = markerLines(lines, BLOCK_END);
|
|
122
|
+
if (starts.length === 0 && ends.length === 0) return null;
|
|
123
|
+
if (starts.length !== 1 || ends.length !== 1 || ends[0] < starts[0]) {
|
|
124
|
+
throw new Error(
|
|
125
|
+
`[timber] ${file} has malformed timber markers — expected exactly one ` +
|
|
126
|
+
`${BLOCK_START} line followed by one ${BLOCK_END} line. ` +
|
|
127
|
+
`Fix or remove them, then re-run \`timber init\`. Nothing was written.`
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
const blockLines = block.split('\n').map((line) => (eol === '\r\n' ? line + '\r' : line));
|
|
131
|
+
// The end-marker line carried its own \r; the block's last line now does.
|
|
132
|
+
return [...lines.slice(0, starts[0]), ...blockLines, ...lines.slice(ends[0] + 1)].join('\n');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** `<file>.bak`, or `.bak.1`, `.bak.2`, … — never overwrites a backup. */
|
|
136
|
+
function freeBackupPath(path: string): string {
|
|
137
|
+
if (!existsSync(`${path}.bak`)) return `${path}.bak`;
|
|
138
|
+
for (let i = 1; ; i++) {
|
|
139
|
+
const candidate = `${path}.bak.${i}`;
|
|
140
|
+
if (!existsSync(candidate)) return candidate;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Both paths name the same file (case-insensitive filesystems included). */
|
|
145
|
+
function sameFile(a: string, b: string): boolean {
|
|
146
|
+
try {
|
|
147
|
+
return realpathSync.native(a) === realpathSync.native(b);
|
|
148
|
+
} catch {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Decide what to do with one file. Pure: reads, never writes. `runInit`
|
|
155
|
+
* plans both files before applying either, so an error in one (malformed
|
|
156
|
+
* markers) leaves both untouched.
|
|
157
|
+
*/
|
|
158
|
+
export function planBlock(root: string, name: string, block: string): Plan {
|
|
159
|
+
const path = join(root, name);
|
|
160
|
+
const stat = lstatSync(path, { throwIfNoEntry: false });
|
|
161
|
+
const write = (content: string) => () => writeFileSync(path, content);
|
|
162
|
+
|
|
163
|
+
// timber never writes through a symlink: the target may be the sibling
|
|
164
|
+
// agent file (the CLAUDE block would land in AGENTS.md) or a file shared
|
|
165
|
+
// outside the project.
|
|
166
|
+
if (stat?.isSymbolicLink()) {
|
|
167
|
+
const agentsPath = join(root, 'AGENTS.md');
|
|
168
|
+
const target = resolve(root, readlinkSync(path));
|
|
169
|
+
// Old `init` made CLAUDE.md a symlink to AGENTS.md: that one is timber's,
|
|
170
|
+
// so it becomes a regular file (which also sidesteps Windows symlink
|
|
171
|
+
// EPERM). Its content still reaches Claude through the block's
|
|
172
|
+
// @AGENTS.md. Matched by real path too, for case-insensitive filesystems.
|
|
173
|
+
if (name === 'CLAUDE.md' && (target === agentsPath || sameFile(path, agentsPath))) {
|
|
174
|
+
return {
|
|
175
|
+
outcome: { kind: 'replaced-symlink' },
|
|
176
|
+
apply: () => {
|
|
177
|
+
rmSync(path);
|
|
178
|
+
writeFileSync(path, block + '\n');
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
// Any other link (a user's own, or dangling) is left alone.
|
|
183
|
+
return { outcome: { kind: 'skipped-symlink', target }, apply: () => {} };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!stat) return { outcome: { kind: 'created' }, apply: write(block + '\n') };
|
|
187
|
+
|
|
188
|
+
const content = readFileSync(path, 'utf8');
|
|
189
|
+
const eol = content.includes('\r\n') ? '\r\n' : '\n';
|
|
190
|
+
const replaced = replaceBlock(content, block, name, eol);
|
|
191
|
+
if (replaced !== null) {
|
|
192
|
+
return replaced === content
|
|
193
|
+
? { outcome: { kind: 'unchanged' }, apply: () => {} }
|
|
194
|
+
: { outcome: { kind: 'updated' }, apply: write(replaced) };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (isLegacyCopy(content)) {
|
|
198
|
+
const backup = freeBackupPath(path);
|
|
199
|
+
return {
|
|
200
|
+
outcome: { kind: 'replaced-legacy', backup },
|
|
201
|
+
apply: () => {
|
|
202
|
+
// Back up first, then replace: the copy may carry the user's edits.
|
|
203
|
+
// rename keeps the original bytes and fails before anything is lost.
|
|
204
|
+
renameSync(path, backup);
|
|
205
|
+
writeFileSync(path, block + '\n');
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const separator = content.length === 0 ? '' : content.endsWith('\n') ? eol : eol + eol;
|
|
211
|
+
const appended = content + separator + block.split('\n').join(eol) + eol;
|
|
212
|
+
return { outcome: { kind: 'appended' }, apply: write(appended) };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function outcomeLine(name: string, outcome: InitOutcome, root: string): string {
|
|
216
|
+
const rel = (path: string) => relative(root, path) || '.';
|
|
217
|
+
switch (outcome.kind) {
|
|
218
|
+
case 'created':
|
|
219
|
+
return `${name}: created`;
|
|
220
|
+
case 'updated':
|
|
221
|
+
return `${name}: updated timber block`;
|
|
222
|
+
case 'appended':
|
|
223
|
+
return `${name}: appended timber block`;
|
|
224
|
+
case 'unchanged':
|
|
225
|
+
return `${name}: unchanged`;
|
|
226
|
+
case 'replaced-symlink':
|
|
227
|
+
return `${name}: replaced symlink to AGENTS.md with a regular file`;
|
|
228
|
+
case 'replaced-legacy':
|
|
229
|
+
return `${name}: replaced old timber-generated copy (backup: ${rel(outcome.backup)})`;
|
|
230
|
+
case 'skipped-symlink':
|
|
231
|
+
return (
|
|
232
|
+
`${name}: skipped — it is a symlink to ${rel(outcome.target)}, and timber does not ` +
|
|
233
|
+
`write through links. Add the block to the file you want it in, or replace the link.`
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Where the installed guide is, relative to `root`: `node_modules` in the
|
|
240
|
+
* project, or one a package manager hoisted to an ancestor (npm/yarn/bun
|
|
241
|
+
* workspaces). Null when no install is found (not installed yet, or Yarn PnP).
|
|
242
|
+
*/
|
|
243
|
+
export function findAgentGuide(root: string): string | null {
|
|
244
|
+
for (let dir = root; ; dir = dirname(dir)) {
|
|
245
|
+
if (existsSync(join(dir, AGENT_GUIDE_PATH))) {
|
|
246
|
+
return relative(root, join(dir, AGENT_GUIDE_PATH)).split(sep).join('/');
|
|
247
|
+
}
|
|
248
|
+
if (dirname(dir) === dir) return null;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** Run `timber init` in `root`: plan both files, then write them. */
|
|
253
|
+
export function runInit(root: string): void {
|
|
254
|
+
const found = findAgentGuide(root);
|
|
255
|
+
const guide = found ?? AGENT_GUIDE_PATH;
|
|
256
|
+
const plans: Array<[string, Plan]> = [
|
|
257
|
+
['AGENTS.md', planBlock(root, 'AGENTS.md', agentsBlock(guide))],
|
|
258
|
+
['CLAUDE.md', planBlock(root, 'CLAUDE.md', claudeBlock(guide))],
|
|
259
|
+
];
|
|
260
|
+
// AGENTS.md first: a legacy CLAUDE.md link to it is replaced only after
|
|
261
|
+
// AGENTS.md is in its final state.
|
|
262
|
+
for (const [name, plan] of plans) {
|
|
263
|
+
plan.apply();
|
|
264
|
+
console.log(`[timber] ${outcomeLine(name, plan.outcome, root)}`);
|
|
265
|
+
}
|
|
266
|
+
console.log(`[timber] Agent guide: ${guide}`);
|
|
267
|
+
if (found === null) {
|
|
268
|
+
console.log(
|
|
269
|
+
`[timber] Note: ${AGENT_GUIDE_PATH} does not exist yet. Install @timber-js/app ` +
|
|
270
|
+
`(Yarn PnP has no node_modules, so the pointer cannot resolve there).`
|
|
271
|
+
);
|
|
272
|
+
} else if (found.startsWith('../')) {
|
|
273
|
+
console.log(
|
|
274
|
+
'[timber] Note: the guide is hoisted above this project. Claude Code may not load an ' +
|
|
275
|
+
'@import from outside the project directory without approval; AGENTS.md still points at it.'
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
}
|
package/src/cli.ts
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
// timber preview — Serve the production build
|
|
12
12
|
// timber check — Validate types + routes without building
|
|
13
13
|
// timber graph — Classify a file's module environment(s) (design/47)
|
|
14
|
+
// timber dev status — List running dev servers for this checkout (design/21)
|
|
15
|
+
// timber init — Point AGENTS.md / CLAUDE.md at the installed agent guide
|
|
14
16
|
|
|
15
17
|
// Type-only — the implementation is imported dynamically inside runCheck so the
|
|
16
18
|
// CLI's other commands never load the route scanner.
|
|
@@ -27,11 +29,11 @@ export interface ParsedArgs {
|
|
|
27
29
|
config: string | undefined;
|
|
28
30
|
/** `--project`: the tsconfig `timber check` passes to tsgo. */
|
|
29
31
|
project: string | undefined;
|
|
30
|
-
/** `timber graph`
|
|
32
|
+
/** `timber graph` and `timber dev status`: emit the machine-readable JSON contract. */
|
|
31
33
|
json: boolean;
|
|
32
34
|
/** `timber graph` only: classify the whole project. */
|
|
33
35
|
all: boolean;
|
|
34
|
-
/** Positional arguments after the command (`schema sync`, `graph <file>`). */
|
|
36
|
+
/** Positional arguments after the command (`schema sync`, `dev status`, `graph <file>`). */
|
|
35
37
|
rest: string[];
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -63,7 +65,8 @@ export interface CommandOptions {
|
|
|
63
65
|
*
|
|
64
66
|
* Each subcommand declares its exact flags (the `check --project` precedent,
|
|
65
67
|
* TIM-1332): `graph` additionally accepts a file positional plus `--json` and
|
|
66
|
-
* `--all`, and those two are rejected everywhere else
|
|
68
|
+
* `--all`, and those two are rejected everywhere else — except `--json`,
|
|
69
|
+
* which `dev status` accepts too.
|
|
67
70
|
*/
|
|
68
71
|
export function parseArgs(args: string[]): ParsedArgs {
|
|
69
72
|
if (args.length === 0) {
|
|
@@ -89,14 +92,13 @@ export function parseArgs(args: string[]): ParsedArgs {
|
|
|
89
92
|
if (!config) {
|
|
90
93
|
throw new Error('--config requires a path argument');
|
|
91
94
|
}
|
|
92
|
-
} else if (arg === '--json'
|
|
95
|
+
} else if (arg === '--json') {
|
|
96
|
+
json = true;
|
|
97
|
+
} else if (arg === '--all') {
|
|
93
98
|
if (command !== 'graph') {
|
|
94
|
-
throw new Error(
|
|
95
|
-
`${arg} is only valid for \`timber graph\` (the module-environment query).`
|
|
96
|
-
);
|
|
99
|
+
throw new Error(`--all is only valid for \`timber graph\` (the module-environment query).`);
|
|
97
100
|
}
|
|
98
|
-
|
|
99
|
-
else all = true;
|
|
101
|
+
all = true;
|
|
100
102
|
} else if (arg === '--project') {
|
|
101
103
|
if (command !== 'check') {
|
|
102
104
|
throw new Error(
|
|
@@ -118,13 +120,24 @@ export function parseArgs(args: string[]): ParsedArgs {
|
|
|
118
120
|
`Unknown option: ${arg}. The timber CLI accepts --config <path>` +
|
|
119
121
|
` (and --project <path> for \`check\`).${portHint}`
|
|
120
122
|
);
|
|
121
|
-
} else if (
|
|
123
|
+
} else if (
|
|
124
|
+
command === 'schema' ||
|
|
125
|
+
command === 'init' ||
|
|
126
|
+
command === 'graph' ||
|
|
127
|
+
(command === 'dev' && rest.length === 0 && arg === 'status')
|
|
128
|
+
) {
|
|
122
129
|
rest.push(arg);
|
|
123
130
|
} else {
|
|
124
131
|
throw new Error(`Unexpected argument: ${arg}. Usage: timber ${command} [--config <path>]`);
|
|
125
132
|
}
|
|
126
133
|
}
|
|
127
134
|
|
|
135
|
+
// Checked after the loop so flag order does not matter (`dev --json status`).
|
|
136
|
+
const devStatus = command === 'dev' && rest[0] === 'status';
|
|
137
|
+
if (json && command !== 'graph' && !devStatus) {
|
|
138
|
+
throw new Error(`--json is only valid for \`timber graph\` and \`timber dev status\`.`);
|
|
139
|
+
}
|
|
140
|
+
|
|
128
141
|
if (command === 'graph' && rest.length > 1) {
|
|
129
142
|
throw new Error(
|
|
130
143
|
`timber graph takes one file. Usage: timber graph <file> [--json], or timber graph --all --json`
|
|
@@ -344,72 +357,6 @@ export async function runSchema(args: string[]): Promise<void> {
|
|
|
344
357
|
}
|
|
345
358
|
}
|
|
346
359
|
|
|
347
|
-
// ─── Init Subcommand ─────────────────────────────────────────────────────────
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* `timber init` — write AGENTS.md (and a CLAUDE.md symlink to it) to the
|
|
351
|
-
* project root so AI coding agents can discover timber.js documentation and
|
|
352
|
-
* conventions.
|
|
353
|
-
*
|
|
354
|
-
* The content is read from the installed @timber-js/app package itself, so it
|
|
355
|
-
* stays in sync with the installed version.
|
|
356
|
-
*/
|
|
357
|
-
export async function runInit(): Promise<void> {
|
|
358
|
-
const { readFileSync, writeFileSync, existsSync, symlinkSync } = await import('node:fs');
|
|
359
|
-
const { resolve, dirname } = await import('node:path');
|
|
360
|
-
const { fileURLToPath } = await import('node:url');
|
|
361
|
-
|
|
362
|
-
const root = process.cwd();
|
|
363
|
-
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
364
|
-
|
|
365
|
-
const agentSkillPath = resolve(packageRoot, 'agent-skill.md');
|
|
366
|
-
if (!existsSync(agentSkillPath)) {
|
|
367
|
-
throw new Error(
|
|
368
|
-
'agent-skill.md not found in @timber-js/app package. ' +
|
|
369
|
-
'This may be a development install — try reinstalling.'
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
const agentSkill = readFileSync(agentSkillPath, 'utf-8');
|
|
374
|
-
|
|
375
|
-
const agentsPath = resolve(root, 'AGENTS.md');
|
|
376
|
-
const claudePath = resolve(root, 'CLAUDE.md');
|
|
377
|
-
|
|
378
|
-
const wrote: string[] = [];
|
|
379
|
-
|
|
380
|
-
if (existsSync(agentsPath)) {
|
|
381
|
-
console.log('[timber] AGENTS.md already exists — skipping (delete it first to regenerate)');
|
|
382
|
-
} else {
|
|
383
|
-
writeFileSync(agentsPath, agentSkill);
|
|
384
|
-
wrote.push('AGENTS.md');
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
if (existsSync(claudePath)) {
|
|
388
|
-
console.log('[timber] CLAUDE.md already exists — skipping (delete it first to regenerate)');
|
|
389
|
-
} else {
|
|
390
|
-
try {
|
|
391
|
-
// Relative target so the link survives the project directory moving.
|
|
392
|
-
// The 'file' type argument is required for Windows (ignored elsewhere).
|
|
393
|
-
symlinkSync('AGENTS.md', claudePath, 'file');
|
|
394
|
-
wrote.push('CLAUDE.md (symlink)');
|
|
395
|
-
} catch {
|
|
396
|
-
// Windows without Developer Mode or admin rights can't create symlinks
|
|
397
|
-
// (EPERM) — fall back to a plain pointer file.
|
|
398
|
-
writeFileSync(claudePath, 'Read AGENTS.md for project context and conventions.\n');
|
|
399
|
-
wrote.push('CLAUDE.md');
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
if (wrote.length > 0) {
|
|
404
|
-
console.log(
|
|
405
|
-
`[timber] Created ${wrote.join(' and ')} — AI agents can now discover timber.js docs.`
|
|
406
|
-
);
|
|
407
|
-
console.log('[timber] Full documentation: node_modules/@timber-js/app/docs/');
|
|
408
|
-
} else {
|
|
409
|
-
console.log('[timber] Nothing to do — both files already exist.');
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
360
|
// ─── Main Entry Point ────────────────────────────────────────────────────────
|
|
414
361
|
|
|
415
362
|
async function main(): Promise<void> {
|
|
@@ -418,7 +365,12 @@ async function main(): Promise<void> {
|
|
|
418
365
|
|
|
419
366
|
switch (parsed.command) {
|
|
420
367
|
case 'dev':
|
|
421
|
-
|
|
368
|
+
if (parsed.rest[0] === 'status') {
|
|
369
|
+
const { runDevStatus } = await import('./cli-dev-status.ts');
|
|
370
|
+
await runDevStatus({ config: parsed.config, json: parsed.json });
|
|
371
|
+
} else {
|
|
372
|
+
await runDev(options);
|
|
373
|
+
}
|
|
422
374
|
break;
|
|
423
375
|
case 'build':
|
|
424
376
|
await runBuild(options);
|
|
@@ -432,9 +384,11 @@ async function main(): Promise<void> {
|
|
|
432
384
|
case 'schema':
|
|
433
385
|
await runSchema(parsed.rest);
|
|
434
386
|
break;
|
|
435
|
-
case 'init':
|
|
436
|
-
await
|
|
387
|
+
case 'init': {
|
|
388
|
+
const { runInit } = await import('./cli-init.ts');
|
|
389
|
+
runInit(process.cwd());
|
|
437
390
|
break;
|
|
391
|
+
}
|
|
438
392
|
case 'graph': {
|
|
439
393
|
// Lazy import — the graph implementation (and, on a cache miss,
|
|
440
394
|
// Vite + the crawl child) never loads for the other commands.
|
|
@@ -58,6 +58,12 @@ interface DenyDigest {
|
|
|
58
58
|
* first *reachable* owner via its ancestry context.
|
|
59
59
|
*/
|
|
60
60
|
owners?: string[];
|
|
61
|
+
/**
|
|
62
|
+
* A deny no boundary in this tree may place: a gate for a segment of the
|
|
63
|
+
* URL's own route that an intercepted navigation did not render (TIM-1607).
|
|
64
|
+
* Every boundary declines it but the terminal, which leaves the SPA.
|
|
65
|
+
*/
|
|
66
|
+
leaveSpa?: boolean;
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
/** Structured digest returned by RSC onError for RedirectSignal. */
|
|
@@ -261,6 +267,16 @@ export class TimberErrorBoundary extends Component<
|
|
|
261
267
|
return this.markStatusPage(null);
|
|
262
268
|
}
|
|
263
269
|
|
|
270
|
+
// A deny the tree cannot hold: its deny pages, and the layouts they
|
|
271
|
+
// render in, belong to a route this tree is not. Nothing here may claim
|
|
272
|
+
// it — not a keyed owner, not a slot, not a status filter — so it passes
|
|
273
|
+
// every boundary to the terminal, which leaves the SPA below and lets the
|
|
274
|
+
// document request render the URL's own answer (TIM-1607).
|
|
275
|
+
const leavesSpa = parsed?.type !== 'deny' || parsed.leaveSpa === true;
|
|
276
|
+
if (parsed?.type === 'deny' && parsed.leaveSpa && !this.props.lastResort) {
|
|
277
|
+
throw error;
|
|
278
|
+
}
|
|
279
|
+
|
|
264
280
|
// Owner-addressed denies: the digest carries an ordered `owners` list
|
|
265
281
|
// of segment keys with matching deny pages. This boundary claims the
|
|
266
282
|
// deny only when it is the first *reachable* owner — i.e. its
|
|
@@ -299,8 +315,9 @@ export class TimberErrorBoundary extends Component<
|
|
|
299
315
|
// the Fizz shell fails and the pipeline serves that page directly. The
|
|
300
316
|
// envelope still covers errors that land inside Flight's opening window;
|
|
301
317
|
// this covers the ones that land after it, which used to be held for
|
|
302
|
-
// (TIM-1495, TIM-1497).
|
|
303
|
-
|
|
318
|
+
// (TIM-1495, TIM-1497). A deny the tree cannot hold (above) leaves the
|
|
319
|
+
// same way, for the same reason: no page for it exists in this SPA.
|
|
320
|
+
if (this.props.lastResort && leavesSpa) {
|
|
304
321
|
if (typeof window === 'undefined') {
|
|
305
322
|
throw error;
|
|
306
323
|
}
|
package/src/client/use-cookie.ts
CHANGED
|
@@ -35,6 +35,8 @@ export interface ClientCookieOptions {
|
|
|
35
35
|
sameSite?: 'strict' | 'lax' | 'none';
|
|
36
36
|
/** Only send over HTTPS. Default: true in production. */
|
|
37
37
|
secure?: boolean;
|
|
38
|
+
/** Partitioned (CHIPS) — isolate cookie per top-level site. */
|
|
39
|
+
partitioned?: boolean;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
export type CookieSetter = (value: string, options?: ClientCookieOptions) => void;
|
|
@@ -67,7 +69,10 @@ export function serializeOptions(options?: ClientCookieOptions): string {
|
|
|
67
69
|
maxAge: options.maxAge,
|
|
68
70
|
expires: options.expires,
|
|
69
71
|
sameSite,
|
|
70
|
-
|
|
72
|
+
// Browsers reject SameSite=None and Partitioned without Secure, so a
|
|
73
|
+
// write that omits it silently does nothing — imply it (TIM-1606).
|
|
74
|
+
secure: options.secure ?? (sameSite === 'none' || options.partitioned ? true : undefined),
|
|
75
|
+
partitioned: options.partitioned,
|
|
71
76
|
});
|
|
72
77
|
// Strip everything up to and including the first "; "
|
|
73
78
|
const idx = full.indexOf('; ');
|
|
@@ -83,13 +88,33 @@ function notify(name: string): void {
|
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
/**
|
|
86
|
-
*
|
|
87
|
-
* Called by defineCookie's imperative client .set()/.delete() methods
|
|
88
|
-
* so mounted useCookie() consumers re-render.
|
|
91
|
+
* Write a cookie via document.cookie and notify useCookie subscribers.
|
|
89
92
|
*
|
|
90
|
-
*
|
|
93
|
+
* Auto-encode mirrors the server's `cookies().set()` contract: values are
|
|
94
|
+
* URL-encoded on write, URL-decoded on read, so the logical bytes
|
|
95
|
+
* round-trip losslessly. See design/29-cookies.md §"Encoding Contract".
|
|
96
|
+
*
|
|
97
|
+
* @internal — shared by useCookie() and defineCookie's client methods
|
|
98
|
+
*/
|
|
99
|
+
export function writeClientCookie(
|
|
100
|
+
name: string,
|
|
101
|
+
value: string,
|
|
102
|
+
options?: ClientCookieOptions
|
|
103
|
+
): void {
|
|
104
|
+
document.cookie = `${name}=${encodeURIComponent(value)}${serializeOptions(options)}`;
|
|
105
|
+
notify(name);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Delete a cookie via document.cookie and notify useCookie subscribers.
|
|
110
|
+
*
|
|
111
|
+
* Keeps every attribute but the lifetime: a partitioned cookie is only
|
|
112
|
+
* removed by a deletion that is also `Partitioned` (TIM-1606).
|
|
113
|
+
*
|
|
114
|
+
* @internal — shared by useCookie() and defineCookie's client methods
|
|
91
115
|
*/
|
|
92
|
-
export function
|
|
116
|
+
export function deleteClientCookie(name: string, options?: ClientCookieOptions): void {
|
|
117
|
+
document.cookie = `${name}=${serializeOptions({ ...options, maxAge: 0, expires: new Date(0) })}`;
|
|
93
118
|
notify(name);
|
|
94
119
|
}
|
|
95
120
|
|
|
@@ -152,23 +177,10 @@ export function useCookie(
|
|
|
152
177
|
` '@timber-js/app/cookies' and call its useCookie() hook instead.`
|
|
153
178
|
);
|
|
154
179
|
}
|
|
155
|
-
|
|
156
|
-
// Auto-encode mirrors the server's `cookies().set()` contract:
|
|
157
|
-
// values are URL-encoded on write, URL-decoded on read, so the
|
|
158
|
-
// logical bytes round-trip losslessly. See design/29-cookies.md
|
|
159
|
-
// §"Encoding Contract".
|
|
160
|
-
document.cookie = `${name}=${encodeURIComponent(newValue)}${serializeOptions(merged)}`;
|
|
161
|
-
notify(name);
|
|
180
|
+
writeClientCookie(name, newValue, { ...defaultOptions, ...options });
|
|
162
181
|
};
|
|
163
182
|
|
|
164
|
-
const deleteCookie = (): void =>
|
|
165
|
-
const path = defaultOptions?.path ?? '/';
|
|
166
|
-
const domain = defaultOptions?.domain;
|
|
167
|
-
let cookieStr = `${name}=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=${path}`;
|
|
168
|
-
if (domain) cookieStr += `; Domain=${domain}`;
|
|
169
|
-
document.cookie = cookieStr;
|
|
170
|
-
notify(name);
|
|
171
|
-
};
|
|
183
|
+
const deleteCookie = (): void => deleteClientCookie(name, defaultOptions);
|
|
172
184
|
|
|
173
185
|
return [value, setCookie, deleteCookie];
|
|
174
186
|
}
|
package/src/config-types.ts
CHANGED
|
@@ -124,6 +124,22 @@ export interface TimberUserConfig {
|
|
|
124
124
|
dev?: {
|
|
125
125
|
/** Threshold in ms to highlight slow phases in dev logging output. Default: 200. */
|
|
126
126
|
slowPhaseMs?: number;
|
|
127
|
+
/**
|
|
128
|
+
* Hostname the dev server prints and opens, as `<hostname>.localhost`.
|
|
129
|
+
* Each app gets its own name, and so its own cookie jar: cookies are not
|
|
130
|
+
* scoped by port, so apps sharing `localhost` overwrite each other's.
|
|
131
|
+
*
|
|
132
|
+
* Default: derived from package.json `name` (`@acme/web` →
|
|
133
|
+
* `web.acme.localhost`), else the app directory's name. Placeholder
|
|
134
|
+
* names (`my-timber-app`, `my-app`, `app`) fall through to the directory.
|
|
135
|
+
* Under `server.https` the name is used only when the certificate covers
|
|
136
|
+
* it. Set a name
|
|
137
|
+
* (`"blog"` or `"blog.localhost"`) to choose it, or `false` to keep
|
|
138
|
+
* plain `localhost`. `localhost:<port>` keeps working either way.
|
|
139
|
+
*
|
|
140
|
+
* See design/21-dev-server.md §"Dev Hostnames".
|
|
141
|
+
*/
|
|
142
|
+
hostname?: string | false;
|
|
127
143
|
};
|
|
128
144
|
/**
|
|
129
145
|
* Control Server-Timing header output.
|
|
@@ -292,13 +308,14 @@ export interface TimberUserConfig {
|
|
|
292
308
|
*/
|
|
293
309
|
cache?: {
|
|
294
310
|
/**
|
|
295
|
-
* Promote the
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
311
|
+
* Promote the key-discipline warning to a hard error. When true, a
|
|
312
|
+
* runtime-tier cache.component that reads request context (cookies,
|
|
313
|
+
* headers, searchParams) during a capture render, or a cache.data fn
|
|
314
|
+
* that reads it (or segment params) while computing its value, throws instead of logging —
|
|
315
|
+
* the tainted result is never cached.
|
|
299
316
|
*
|
|
300
317
|
* Default: false (structured error-level diagnostic, rate-limited per
|
|
301
|
-
*
|
|
318
|
+
* callsite). Recommended true for any app serving authenticated content.
|
|
302
319
|
*
|
|
303
320
|
* See design/45-cache-lifetimes.md §Enforcement.
|
|
304
321
|
*/
|
package/src/config-validation.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { createRequire } from 'node:module';
|
|
12
12
|
import type { TimberUserConfig } from './config-types.ts';
|
|
13
|
+
import { devHostnameError } from './plugins/dev-hostname.ts';
|
|
13
14
|
import { DEFAULT_RENDER_TIMEOUT_MS, RENDER_TIMEOUT_CEILING_MS } from './server/render-timeout.ts';
|
|
14
15
|
|
|
15
16
|
// ─── Types ──────────────────────────────────────────────────────────────────
|
|
@@ -185,6 +186,22 @@ export function validateConfig(config: TimberUserConfig): ConfigError[] {
|
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
|
|
189
|
+
// dev.hostname — not fatal: it is dev-only, so a typo must not fail
|
|
190
|
+
// `timber build`. Dev startup still refuses it (deriveDevHostname throws).
|
|
191
|
+
if (config.dev?.hostname !== undefined) {
|
|
192
|
+
const problem = devHostnameError(config.dev.hostname);
|
|
193
|
+
if (problem) {
|
|
194
|
+
errors.push({
|
|
195
|
+
field: 'dev.hostname',
|
|
196
|
+
message: `dev.hostname ${problem}`,
|
|
197
|
+
value: config.dev.hostname,
|
|
198
|
+
suggestion:
|
|
199
|
+
'Use DNS labels separated by dots, e.g. dev: { hostname: "blog" } for blog.localhost, ' +
|
|
200
|
+
'or false to keep plain localhost.',
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
188
205
|
// sitemap
|
|
189
206
|
if (config.sitemap != null && typeof config.sitemap === 'object') {
|
|
190
207
|
if (config.sitemap.enabled && !config.sitemap.baseUrl) {
|