@timber-js/app 0.2.0-alpha.222 → 0.2.0-alpha.224
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-B7o4As0l.js} +383 -55
- package/dist/_chunks/dev-server-B7o4As0l.js.map +1 -0
- package/dist/_chunks/dev-server-hZzmbMvK.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 +40 -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.d.ts.map +1 -1
- package/dist/index.js +698 -237
- 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/optimize-package-imports-defaults.d.ts +13 -0
- package/dist/plugins/optimize-package-imports-defaults.d.ts.map +1 -0
- package/dist/plugins/optimize-package-imports.d.ts +113 -0
- package/dist/plugins/optimize-package-imports.d.ts.map +1 -0
- 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 +42 -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 +40 -5
- package/src/config-validation.ts +37 -0
- package/src/cookies/define-cookie.ts +10 -46
- package/src/cookies/json-cookie.ts +4 -4
- package/src/index.ts +2 -0
- 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/optimize-package-imports-defaults.ts +88 -0
- package/src/plugins/optimize-package-imports.ts +439 -0
- 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
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { n as RENDER_TIMEOUT_CEILING_MS, t as DEFAULT_RENDER_TIMEOUT_MS } from "./render-timeout-
|
|
2
|
-
import {
|
|
3
|
-
import { n as isScannableSourceFile, t as buildSourceExtensions } from "./scan-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
1
|
+
import { n as RENDER_TIMEOUT_CEILING_MS, t as DEFAULT_RENDER_TIMEOUT_MS } from "./render-timeout-MrrqD1wd.js";
|
|
2
|
+
import { n as STATUS_ENDPOINT_PATH, r as devRecordRoot, s as registerDevDiscovery } from "./dev-discovery-YnabkCKD.js";
|
|
3
|
+
import { n as isScannableSourceFile, t as buildSourceExtensions } from "./scan-CyizcBiX.js";
|
|
4
|
+
import "./graph-cache-B1LAg4t7.js";
|
|
5
|
+
import { t as RSC_CONTENT_TYPE } from "./rsc-media-type-m8jz9u6_.js";
|
|
6
|
+
import { o as isMetadataRouteServePath } from "./metadata-routes-BL26HCDd.js";
|
|
7
|
+
import { a as requestTargetUrl, i as canonicalize } from "./canonicalize-CqK135BN.js";
|
|
8
|
+
import { t as PREBUILT_DEV_CLEAR_EVENT } from "./dev-store-BvdqtHvK.js";
|
|
9
|
+
import { t as matchUrlParts } from "./tree-match-Bqdr9szG.js";
|
|
9
10
|
import { loadConfigFromFile, normalizePath } from "vite";
|
|
10
11
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
11
12
|
import { createRequire } from "node:module";
|
|
@@ -17,10 +18,11 @@ import "node:https";
|
|
|
17
18
|
import "node:http2";
|
|
18
19
|
import { pathToFileURL } from "node:url";
|
|
19
20
|
import { styleText } from "node:util";
|
|
21
|
+
import { X509Certificate } from "node:crypto";
|
|
20
22
|
import { realpath, stat } from "node:fs/promises";
|
|
21
23
|
import { isIP } from "node:net";
|
|
22
24
|
import { constants, createGzip } from "node:zlib";
|
|
23
|
-
|
|
25
|
+
// ../../node_modules/.pnpm/srvx@1.0.8/node_modules/srvx/dist/adapters/node.mjs
|
|
24
26
|
function sendNodeResponse(nodeRes, webRes) {
|
|
25
27
|
try {
|
|
26
28
|
return _sendNodeResponse(nodeRes, webRes, false) || Promise.resolve();
|
|
@@ -83,6 +85,10 @@ function pipeBody(stream, nodeRes, status, statusText, headers) {
|
|
|
83
85
|
stream.pipe(nodeRes);
|
|
84
86
|
return new Promise((resolve) => nodeRes.on("close", resolve));
|
|
85
87
|
}
|
|
88
|
+
if (stream.readableEnded && !stream.errored) {
|
|
89
|
+
writeHead(nodeRes, status, statusText, headers);
|
|
90
|
+
return endNodeResponse(nodeRes);
|
|
91
|
+
}
|
|
86
92
|
if (stream.destroyed) {
|
|
87
93
|
writeHead(nodeRes, 500, "Internal Server Error", []);
|
|
88
94
|
return endNodeResponse(nodeRes);
|
|
@@ -91,6 +97,7 @@ function pipeBody(stream, nodeRes, status, statusText, headers) {
|
|
|
91
97
|
function cleanup() {
|
|
92
98
|
stream.off("error", onEarlyError);
|
|
93
99
|
stream.off("readable", onReadable);
|
|
100
|
+
stream.off("end", onEnd);
|
|
94
101
|
nodeRes.off("close", onResClose);
|
|
95
102
|
}
|
|
96
103
|
function onEarlyError() {
|
|
@@ -108,6 +115,12 @@ function pipeBody(stream, nodeRes, status, statusText, headers) {
|
|
|
108
115
|
writeHead(nodeRes, status, statusText, headers);
|
|
109
116
|
pipeline$1(stream, nodeRes).catch(() => {}).then(() => resolve());
|
|
110
117
|
}
|
|
118
|
+
function onEnd() {
|
|
119
|
+
cleanup();
|
|
120
|
+
if (nodeRes.destroyed) return resolve();
|
|
121
|
+
writeHead(nodeRes, status, statusText, headers);
|
|
122
|
+
endNodeResponse(nodeRes).then(resolve);
|
|
123
|
+
}
|
|
111
124
|
function onResClose() {
|
|
112
125
|
cleanup();
|
|
113
126
|
stream.destroy();
|
|
@@ -115,6 +128,7 @@ function pipeBody(stream, nodeRes, status, statusText, headers) {
|
|
|
115
128
|
}
|
|
116
129
|
stream.once("error", onEarlyError);
|
|
117
130
|
stream.once("readable", onReadable);
|
|
131
|
+
stream.once("end", onEnd);
|
|
118
132
|
nodeRes.once("close", onResClose);
|
|
119
133
|
});
|
|
120
134
|
}
|
|
@@ -149,8 +163,7 @@ function streamBody(stream, nodeRes) {
|
|
|
149
163
|
nodeRes.off("error", streamCancel);
|
|
150
164
|
});
|
|
151
165
|
}
|
|
152
|
-
|
|
153
|
-
//#region src/dev-tools/stack-classifier.ts
|
|
166
|
+
// src/dev-tools/stack-classifier.ts
|
|
154
167
|
/** Parse file/line/col from a stack frame line. */
|
|
155
168
|
function parseFrame(frameLine) {
|
|
156
169
|
const parenMatch = /\(([^)]+):(\d+):(\d+)\)/.exec(frameLine);
|
|
@@ -202,8 +215,7 @@ function classifyStack(stack, projectRoot) {
|
|
|
202
215
|
};
|
|
203
216
|
});
|
|
204
217
|
}
|
|
205
|
-
|
|
206
|
-
//#region src/dev-tools/terminal.ts
|
|
218
|
+
// src/dev-tools/terminal.ts
|
|
207
219
|
/**
|
|
208
220
|
* Terminal error formatting — boxed, color-coded error output for dev mode.
|
|
209
221
|
*
|
|
@@ -318,8 +330,7 @@ function extractFnName(frameLine) {
|
|
|
318
330
|
const match = /at\s+(\S+)\s+\(/.exec(frameLine.trim());
|
|
319
331
|
return match ? match[1] : "";
|
|
320
332
|
}
|
|
321
|
-
|
|
322
|
-
//#region src/dev-tools/overlay.ts
|
|
333
|
+
// src/dev-tools/overlay.ts
|
|
323
334
|
/** Labels for terminal output. */
|
|
324
335
|
var PHASE_LABELS$1 = {
|
|
325
336
|
"module-transform": "Module Transform",
|
|
@@ -408,8 +419,7 @@ function sendErrorToOverlay(server, error, phase, projectRoot) {
|
|
|
408
419
|
console.debug("[timber] overlay error send failed:", e instanceof Error ? e.message : e);
|
|
409
420
|
}
|
|
410
421
|
}
|
|
411
|
-
|
|
412
|
-
//#region src/server/utils/escape-html.ts
|
|
422
|
+
// src/server/utils/escape-html.ts
|
|
413
423
|
/**
|
|
414
424
|
* Shared HTML escaping utility.
|
|
415
425
|
*
|
|
@@ -425,8 +435,7 @@ function sendErrorToOverlay(server, error, phase, projectRoot) {
|
|
|
425
435
|
function escapeHtml(str) {
|
|
426
436
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
427
437
|
}
|
|
428
|
-
|
|
429
|
-
//#region src/dev-tools/dev-page-shell.ts
|
|
438
|
+
// src/dev-tools/dev-page-shell.ts
|
|
430
439
|
/**
|
|
431
440
|
* Shared scaffold for dev-mode HTML pages (dev error page, dev 404 page).
|
|
432
441
|
*
|
|
@@ -630,8 +639,7 @@ var SHARED_CSS = `
|
|
|
630
639
|
|
|
631
640
|
.timber-logo { font-weight: 600; white-space: nowrap; }
|
|
632
641
|
`;
|
|
633
|
-
|
|
634
|
-
//#region src/dev-tools/error-page.ts
|
|
642
|
+
// src/dev-tools/error-page.ts
|
|
635
643
|
/**
|
|
636
644
|
* Dev error page — self-contained HTML error page for dev server 500s.
|
|
637
645
|
*
|
|
@@ -883,8 +891,243 @@ var ERROR_CSS = `
|
|
|
883
891
|
|
|
884
892
|
.btn:hover { opacity: 0.85; }
|
|
885
893
|
`;
|
|
886
|
-
|
|
887
|
-
|
|
894
|
+
// src/plugins/dev-hostname.ts
|
|
895
|
+
/**
|
|
896
|
+
* Per-app dev hostnames — print and open `<name>.localhost:<port>`.
|
|
897
|
+
*
|
|
898
|
+
* Cookies are not scoped by port, so every app served on `localhost` shares
|
|
899
|
+
* one cookie jar: two apps on :3000 and :3001 overwrite each other's
|
|
900
|
+
* sessions, and service workers stuck to `localhost:3000` carry over to
|
|
901
|
+
* whichever project next gets that port. Browsers resolve
|
|
902
|
+
* `*.localhost` (at any depth) to loopback with no DNS or `/etc/hosts` setup,
|
|
903
|
+
* so giving each app its own name gives it its own cookie jar.
|
|
904
|
+
*
|
|
905
|
+
* This only changes the URL Vite prints, opens, and records for discovery.
|
|
906
|
+
* Nothing is proxied, no `Host` is rewritten, and plain `localhost:<port>`
|
|
907
|
+
* keeps working. Vite's host check already accepts `*.localhost`.
|
|
908
|
+
*
|
|
909
|
+
* See design/21-dev-server.md §"Dev Hostnames" (TIM-1613).
|
|
910
|
+
*/
|
|
911
|
+
var LOCALHOST = "localhost";
|
|
912
|
+
var LOCALHOST_SUFFIX = `.${LOCALHOST}`;
|
|
913
|
+
/** RFC 1035 label limit. */
|
|
914
|
+
var MAX_LABEL_LENGTH = 63;
|
|
915
|
+
/** RFC 1035 name limit, `.localhost` included. */
|
|
916
|
+
var MAX_HOSTNAME_LENGTH = 253;
|
|
917
|
+
/**
|
|
918
|
+
* Package names that say nothing about the app: the create-timber-app
|
|
919
|
+
* default (`packages/create-timber-app/src/index.ts`) and the generic names
|
|
920
|
+
* people leave in templates. They would put every unrenamed app on the same
|
|
921
|
+
* hostname, and so the same cookie jar, which is exactly what this
|
|
922
|
+
* feature is for avoiding. The directory name is used instead.
|
|
923
|
+
*/
|
|
924
|
+
var PLACEHOLDER_PACKAGE_NAMES = /* @__PURE__ */ new Set([
|
|
925
|
+
"app",
|
|
926
|
+
"my-app",
|
|
927
|
+
"my-timber-app"
|
|
928
|
+
]);
|
|
929
|
+
var LABEL_RE = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
930
|
+
/**
|
|
931
|
+
* Reduce arbitrary text to one DNS label: lowercase, anything outside
|
|
932
|
+
* `[a-z0-9-]` becomes `-`, runs of `-` collapse, no leading or trailing
|
|
933
|
+
* `-`, at most 63 characters. May return '' when nothing usable is left.
|
|
934
|
+
*/
|
|
935
|
+
function sanitizeLabel(raw) {
|
|
936
|
+
return raw.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/-{2,}/g, "-").replace(/^-+/, "").slice(0, MAX_LABEL_LENGTH).replace(/-+$/, "");
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Labels for a package name, most specific first: `@acme/web` →
|
|
940
|
+
* `['web', 'acme']` (so `web.acme.localhost`), `example-blog` →
|
|
941
|
+
* `['example-blog']`. Placeholders and non-strings give `[]`.
|
|
942
|
+
*/
|
|
943
|
+
function packageNameLabels(name) {
|
|
944
|
+
if (typeof name !== "string") return [];
|
|
945
|
+
if (PLACEHOLDER_PACKAGE_NAMES.has(name.trim().toLowerCase())) return [];
|
|
946
|
+
const scoped = /^@([^/]+)\/(.+)$/.exec(name);
|
|
947
|
+
return (scoped ? [scoped[2], scoped[1]] : [name]).map(sanitizeLabel).filter(Boolean);
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Why a `dev.hostname` value is unusable, or null when it is fine. Accepts
|
|
951
|
+
* `false` (opt out: keep plain `localhost`) or a dot-separated sequence of
|
|
952
|
+
* DNS labels, case-insensitively, with or without a trailing `.localhost`.
|
|
953
|
+
*/
|
|
954
|
+
function devHostnameError(value) {
|
|
955
|
+
if (value === false) return null;
|
|
956
|
+
if (typeof value !== "string") return `must be a string like "blog" or false, got ${JSON.stringify(value)}.`;
|
|
957
|
+
const labels = stripLocalhost(value.toLowerCase());
|
|
958
|
+
if (labels === "") return `${JSON.stringify(value)} names no app. Use a name like "blog", or false to keep plain localhost.`;
|
|
959
|
+
const bad = labels.split(".").find((label) => !LABEL_RE.test(label));
|
|
960
|
+
if (bad !== void 0) return `${JSON.stringify(value)} is not a valid hostname: label ${JSON.stringify(bad)} must be 1-63 characters of a-z, 0-9 and "-", not starting or ending with "-".`;
|
|
961
|
+
if (labels.length + LOCALHOST_SUFFIX.length > MAX_HOSTNAME_LENGTH) return `${JSON.stringify(value)} is longer than a hostname can be (253 characters with .localhost).`;
|
|
962
|
+
return null;
|
|
963
|
+
}
|
|
964
|
+
function stripLocalhost(name) {
|
|
965
|
+
if (name === LOCALHOST) return "";
|
|
966
|
+
return name.endsWith(LOCALHOST_SUFFIX) ? name.slice(0, -LOCALHOST_SUFFIX.length) : name;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* The dev hostname for an app. In order:
|
|
970
|
+
*
|
|
971
|
+
* 1. `dev.hostname`, when set (`false` → plain `localhost`). An invalid value
|
|
972
|
+
* throws; config validation reports it as fatal before this runs.
|
|
973
|
+
* 2. package.json `name`, unless it is a placeholder. Preferred over the
|
|
974
|
+
* directory because it is stable across clones and worktrees, so OAuth
|
|
975
|
+
* callback URLs registered against it keep working, and because monorepo
|
|
976
|
+
* directories are generic (`apps/web` everywhere).
|
|
977
|
+
* 3. The directory name.
|
|
978
|
+
* 4. Plain `localhost`, when nothing usable is left after sanitizing.
|
|
979
|
+
*/
|
|
980
|
+
function deriveDevHostname(source) {
|
|
981
|
+
const { override } = source;
|
|
982
|
+
if (override === false) return LOCALHOST;
|
|
983
|
+
if (override !== void 0) {
|
|
984
|
+
const error = devHostnameError(override);
|
|
985
|
+
if (error) throw new Error(`[timber] dev.hostname ${error}`);
|
|
986
|
+
return `${stripLocalhost(override.toLowerCase())}${LOCALHOST_SUFFIX}`;
|
|
987
|
+
}
|
|
988
|
+
let labels = packageNameLabels(source.packageName);
|
|
989
|
+
if (labels.length === 0) labels = [sanitizeLabel(source.dirName)].filter(Boolean);
|
|
990
|
+
return labels.length === 0 ? LOCALHOST : `${labels.join(".")}${LOCALHOST_SUFFIX}`;
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* `deriveDevHostname` for the app in `appDir` — the directory its
|
|
994
|
+
* `.timber/` lives in (`devRecordRoot`), where its package.json is. A
|
|
995
|
+
* missing or unreadable package.json falls through to the directory name.
|
|
996
|
+
*/
|
|
997
|
+
function resolveDevHostname(appDir, override) {
|
|
998
|
+
let packageName;
|
|
999
|
+
try {
|
|
1000
|
+
packageName = JSON.parse(readFileSync(join(appDir, "package.json"), "utf8")).name;
|
|
1001
|
+
} catch {
|
|
1002
|
+
packageName = void 0;
|
|
1003
|
+
}
|
|
1004
|
+
return deriveDevHostname({
|
|
1005
|
+
override,
|
|
1006
|
+
packageName,
|
|
1007
|
+
dirName: basename(appDir)
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* A `cert` entry as Vite reads it (`readFileIfExists` in its
|
|
1012
|
+
* `resolveHttpsConfig`): a string is first tried as a file path, resolved
|
|
1013
|
+
* against the cwd, and is PEM text only when no such file can be read.
|
|
1014
|
+
* `config.server.https` keeps the raw option, so the path is read here too.
|
|
1015
|
+
*/
|
|
1016
|
+
function certBytes(entry) {
|
|
1017
|
+
if (entry instanceof Uint8Array) return entry;
|
|
1018
|
+
if (typeof entry !== "string") return null;
|
|
1019
|
+
try {
|
|
1020
|
+
return readFileSync(resolve(entry));
|
|
1021
|
+
} catch {
|
|
1022
|
+
return entry;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* Whether a TLS `cert` option (PEM string or Buffer, a path to one, or an
|
|
1027
|
+
* array of them — Node's `tls` shape plus Vite's paths) names `hostname`.
|
|
1028
|
+
* A `pfx`-only config has no `cert` and so keeps `localhost`. An https dev server prints the
|
|
1029
|
+
* named URL only when it does: a trusted certificate issued for `localhost`
|
|
1030
|
+
* alone (mkcert's default) would turn a working URL into a certificate error.
|
|
1031
|
+
*/
|
|
1032
|
+
function certCoversHostname(cert, hostname) {
|
|
1033
|
+
return (Array.isArray(cert) ? cert : [cert]).some((entry) => {
|
|
1034
|
+
const pem = certBytes(entry);
|
|
1035
|
+
if (pem === null) return false;
|
|
1036
|
+
try {
|
|
1037
|
+
return new X509Certificate(pem).checkHost(hostname) !== void 0;
|
|
1038
|
+
} catch {
|
|
1039
|
+
return false;
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* The hostname to print for this server, after the https check. `https` is
|
|
1045
|
+
* Vite's resolved `server.https` (undefined for plain http).
|
|
1046
|
+
*/
|
|
1047
|
+
function effectiveDevHostname(hostname, https) {
|
|
1048
|
+
if (hostname === LOCALHOST || !https) return hostname;
|
|
1049
|
+
return certCoversHostname(https.cert, hostname) ? hostname : LOCALHOST;
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Rename the `localhost` entries of `urls.local` to `hostname`. Only those:
|
|
1053
|
+
* an explicit loopback IP (`host: '127.0.0.1'`) is what the developer asked
|
|
1054
|
+
* to see, certificate-derived names already name a host, and network URLs
|
|
1055
|
+
* are other machines' way in. Idempotent: a renamed URL is no longer a
|
|
1056
|
+
* `localhost` URL.
|
|
1057
|
+
*/
|
|
1058
|
+
function withDevHostname(urls, hostname) {
|
|
1059
|
+
if (hostname === LOCALHOST) return urls;
|
|
1060
|
+
const local = urls.local.map((href) => {
|
|
1061
|
+
const url = new URL(href);
|
|
1062
|
+
if (url.hostname !== LOCALHOST) return href;
|
|
1063
|
+
url.hostname = hostname;
|
|
1064
|
+
return url.href;
|
|
1065
|
+
});
|
|
1066
|
+
return {
|
|
1067
|
+
...urls,
|
|
1068
|
+
local: [...new Set(local)]
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* The same URL through plain `localhost`: what a non-browser HTTP client can
|
|
1073
|
+
* reach. Browsers and curl resolve `*.localhost` themselves, but Node, Python
|
|
1074
|
+
* and other clients ask the OS, and not every resolver (glibc without
|
|
1075
|
+
* systemd-resolved) maps `*.localhost` to loopback. The server answers both
|
|
1076
|
+
* names, so only the hostname changes. Other URLs are returned unchanged.
|
|
1077
|
+
*
|
|
1078
|
+
* Under https the swap also has to survive TLS hostname verification: a
|
|
1079
|
+
* certificate issued for `blog.localhost` alone fails for `localhost`
|
|
1080
|
+
* (`ERR_TLS_CERT_ALTNAME_INVALID`), so the named URL is kept unless the
|
|
1081
|
+
* certificate covers `localhost` too. `https` is Vite's `server.https`.
|
|
1082
|
+
*/
|
|
1083
|
+
function loopbackUrl(href, https) {
|
|
1084
|
+
const url = new URL(href);
|
|
1085
|
+
if (!url.hostname.endsWith(LOCALHOST_SUFFIX)) return href;
|
|
1086
|
+
if (url.protocol === "https:" && !certCoversHostname(https?.cert, LOCALHOST)) return href;
|
|
1087
|
+
url.hostname = LOCALHOST;
|
|
1088
|
+
return url.href;
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* The URL a server is opened at, after the rename: Vite's own choice, as its
|
|
1092
|
+
* `getServerUrlByHost` makes it for `server.open` — the first URL containing
|
|
1093
|
+
* a string `server.host`, else `local[0]`, else `network[0]`. The discovery
|
|
1094
|
+
* record stores this, so `timber dev status` reports the URL Vite opens.
|
|
1095
|
+
*/
|
|
1096
|
+
function primaryServerUrl(urls, hostname, serverHost) {
|
|
1097
|
+
if (!urls) return void 0;
|
|
1098
|
+
const named = withDevHostname(urls, hostname);
|
|
1099
|
+
const all = [...named.local, ...named.network];
|
|
1100
|
+
return (typeof serverHost === "string" ? all.find((url) => url.includes(serverHost)) : void 0) ?? named.local[0] ?? named.network[0];
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* The record's URLs, computed by the server, which alone knows its
|
|
1104
|
+
* certificate. `server` is Vite's resolved `server` config.
|
|
1105
|
+
*/
|
|
1106
|
+
function advertisedUrls(urls, hostname, server) {
|
|
1107
|
+
const url = primaryServerUrl(urls, hostname, server?.host);
|
|
1108
|
+
return url === void 0 ? void 0 : {
|
|
1109
|
+
url,
|
|
1110
|
+
loopbackUrl: loopbackUrl(url, server?.https)
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Resolve the app's dev hostname and rename the printed/opened URL once the
|
|
1115
|
+
* server is listening. Returns the hostname so the discovery record can
|
|
1116
|
+
* describe the same URL (`primaryServerUrl`).
|
|
1117
|
+
*
|
|
1118
|
+
* Vite assigns `resolvedUrls` in a `listening` listener it *prepends* in
|
|
1119
|
+
* `listen()`, after every `configureServer` hook has run, so this listener
|
|
1120
|
+
* always sees them; `printUrls()` and `openBrowser()` run after `listen()`
|
|
1121
|
+
* resolves. Middleware mode has no `httpServer` and prints nothing.
|
|
1122
|
+
*/
|
|
1123
|
+
function applyDevHostname(server, appDir, override) {
|
|
1124
|
+
const hostname = effectiveDevHostname(resolveDevHostname(appDir, override), server.config.server?.https);
|
|
1125
|
+
if (server.httpServer && hostname !== LOCALHOST) server.httpServer.on("listening", () => {
|
|
1126
|
+
if (server.resolvedUrls) server.resolvedUrls = withDevHostname(server.resolvedUrls, hostname);
|
|
1127
|
+
});
|
|
1128
|
+
return hostname;
|
|
1129
|
+
}
|
|
1130
|
+
// src/config-validation.ts
|
|
888
1131
|
/**
|
|
889
1132
|
* Config validation — validates timber.config.ts at startup.
|
|
890
1133
|
*
|
|
@@ -904,6 +1147,7 @@ var knownKeys = new Set(Object.keys({
|
|
|
904
1147
|
limits: true,
|
|
905
1148
|
forms: true,
|
|
906
1149
|
pageExtensions: true,
|
|
1150
|
+
optimizePackageImports: true,
|
|
907
1151
|
slowRequestMs: true,
|
|
908
1152
|
renderTimeoutMs: true,
|
|
909
1153
|
devBrowserLogs: true,
|
|
@@ -961,6 +1205,19 @@ function validateConfig(config) {
|
|
|
961
1205
|
}
|
|
962
1206
|
}
|
|
963
1207
|
}
|
|
1208
|
+
if (config.optimizePackageImports !== void 0) {
|
|
1209
|
+
const list = config.optimizePackageImports;
|
|
1210
|
+
const badIndex = Array.isArray(list) ? list.findIndex((entry) => typeof entry !== "string" || entry.trim() === "") : -1;
|
|
1211
|
+
if (!Array.isArray(list) || badIndex !== -1) {
|
|
1212
|
+
const value = Array.isArray(list) ? list[badIndex] : list;
|
|
1213
|
+
errors.push({
|
|
1214
|
+
field: "optimizePackageImports",
|
|
1215
|
+
message: Array.isArray(list) ? `optimizePackageImports contains an invalid entry: ${String(JSON.stringify(value))}` : "optimizePackageImports must be an array of import specifiers.",
|
|
1216
|
+
value,
|
|
1217
|
+
suggestion: "Example: optimizePackageImports: [\"@acme/icons\", \"react-icons/fa\"]"
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
964
1221
|
if (config.allowedOrigins !== void 0) {
|
|
965
1222
|
if (!Array.isArray(config.allowedOrigins)) errors.push({
|
|
966
1223
|
field: "allowedOrigins",
|
|
@@ -1012,6 +1269,15 @@ function validateConfig(config) {
|
|
|
1012
1269
|
suggestion: `Use one of: ${valid.map((v) => `"${v}"`).join(", ")}.`
|
|
1013
1270
|
});
|
|
1014
1271
|
}
|
|
1272
|
+
if (config.dev?.hostname !== void 0) {
|
|
1273
|
+
const problem = devHostnameError(config.dev.hostname);
|
|
1274
|
+
if (problem) errors.push({
|
|
1275
|
+
field: "dev.hostname",
|
|
1276
|
+
message: `dev.hostname ${problem}`,
|
|
1277
|
+
value: config.dev.hostname,
|
|
1278
|
+
suggestion: "Use DNS labels separated by dots, e.g. dev: { hostname: \"blog\" } for blog.localhost, or false to keep plain localhost."
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1015
1281
|
if (config.sitemap != null && typeof config.sitemap === "object") {
|
|
1016
1282
|
if (config.sitemap.enabled && !config.sitemap.baseUrl) errors.push({
|
|
1017
1283
|
field: "sitemap.baseUrl",
|
|
@@ -1301,7 +1567,8 @@ function reflectCors(res, origin) {
|
|
|
1301
1567
|
res.setHeader("Vary", "Origin");
|
|
1302
1568
|
}
|
|
1303
1569
|
/**
|
|
1304
|
-
* Create the Connect middleware handling GET /__timber/graph
|
|
1570
|
+
* Create the Connect middleware handling GET /__timber/graph and the
|
|
1571
|
+
* GET /__timber/status identity probe.
|
|
1305
1572
|
*
|
|
1306
1573
|
* Query surface: `?file=<path>` (absolute or project-root-relative) or
|
|
1307
1574
|
* `?all=1`. Anything else is a 400 — fail loudly, like the CLI.
|
|
@@ -1315,7 +1582,8 @@ function createGraphEndpointMiddleware(server, ctx) {
|
|
|
1315
1582
|
return;
|
|
1316
1583
|
}
|
|
1317
1584
|
const url = new URL(rawUrl, "http://placeholder.invalid");
|
|
1318
|
-
|
|
1585
|
+
const isStatus = url.pathname === STATUS_ENDPOINT_PATH;
|
|
1586
|
+
if (!isStatus && url.pathname !== "/__timber/graph") {
|
|
1319
1587
|
sendJson(res, 404, { error: `unknown /__timber/ endpoint: ${url.pathname}` });
|
|
1320
1588
|
return;
|
|
1321
1589
|
}
|
|
@@ -1335,8 +1603,12 @@ function createGraphEndpointMiddleware(server, ctx) {
|
|
|
1335
1603
|
return;
|
|
1336
1604
|
}
|
|
1337
1605
|
reflectCors(res, origin);
|
|
1606
|
+
if (isStatus) {
|
|
1607
|
+
sendJson(res, 200, { pid: process.pid });
|
|
1608
|
+
return;
|
|
1609
|
+
}
|
|
1338
1610
|
try {
|
|
1339
|
-
const { classifyLiveFile, classifyLiveProject } = await import("./live-graph-
|
|
1611
|
+
const { classifyLiveFile, classifyLiveProject } = await import("./live-graph-BcVjQ1Te.js");
|
|
1340
1612
|
const preserveSymlinks = server.config.resolve.preserveSymlinks;
|
|
1341
1613
|
const root = normalizePath(preserveSymlinks ? ctx.root : await realpath(ctx.root));
|
|
1342
1614
|
const appDir = normalizePath(preserveSymlinks ? ctx.appDir : await realpath(ctx.appDir).catch(() => join(root, relative(ctx.root, ctx.appDir))));
|
|
@@ -1528,8 +1800,7 @@ function makeGraphUpdateChannel(ctx, send, isTransformed, canonicalize = (file)
|
|
|
1528
1800
|
}
|
|
1529
1801
|
};
|
|
1530
1802
|
}
|
|
1531
|
-
|
|
1532
|
-
//#region src/server/compress.ts
|
|
1803
|
+
// src/server/compress.ts
|
|
1533
1804
|
/**
|
|
1534
1805
|
* MIME types that benefit from compression.
|
|
1535
1806
|
* text/* is handled via prefix matching; these are the specific
|
|
@@ -1662,8 +1933,7 @@ function compressWithGzip(body) {
|
|
|
1662
1933
|
pipeline(nodeInput, gzip, () => {});
|
|
1663
1934
|
return Readable.toWeb(gzip);
|
|
1664
1935
|
}
|
|
1665
|
-
|
|
1666
|
-
//#region src/plugins/dev-store-clear.ts
|
|
1936
|
+
// src/plugins/dev-store-clear.ts
|
|
1667
1937
|
/**
|
|
1668
1938
|
* Comfortably past the throttle window. Both are timers started in the same
|
|
1669
1939
|
* synchronous emit, so this one always fires after the throttle has expired,
|
|
@@ -1672,15 +1942,50 @@ function compressWithGzip(body) {
|
|
|
1672
1942
|
var TRAILING_CLEAR_DELAY_MS = 100;
|
|
1673
1943
|
function clearDevStoreOnWatcherEvents(watcher, clear) {
|
|
1674
1944
|
let trailing;
|
|
1675
|
-
|
|
1676
|
-
|
|
1945
|
+
let burst = /* @__PURE__ */ new Set();
|
|
1946
|
+
watcher.on("all", (event, path) => {
|
|
1947
|
+
const changed = event === "change" ? /* @__PURE__ */ new Set([path]) : null;
|
|
1948
|
+
clear(changed);
|
|
1949
|
+
if (changed === null) burst = null;
|
|
1950
|
+
else burst?.add(path);
|
|
1677
1951
|
clearTimeout(trailing);
|
|
1678
|
-
trailing = setTimeout(
|
|
1952
|
+
trailing = setTimeout(() => {
|
|
1953
|
+
const covered = burst;
|
|
1954
|
+
burst = /* @__PURE__ */ new Set();
|
|
1955
|
+
clear(covered);
|
|
1956
|
+
}, TRAILING_CLEAR_DELAY_MS);
|
|
1679
1957
|
trailing.unref?.();
|
|
1680
1958
|
});
|
|
1681
1959
|
}
|
|
1682
|
-
|
|
1683
|
-
|
|
1960
|
+
/**
|
|
1961
|
+
* The cache.component IDs whose output the changed paths could have
|
|
1962
|
+
* changed: those declared in each changed module and its transitive
|
|
1963
|
+
* importers. Null means every component — a path the graph does not know.
|
|
1964
|
+
*
|
|
1965
|
+
* `componentIds` maps a module ID to the IDs its last transform declared
|
|
1966
|
+
* (`PluginContext.devPrebuiltComponentIds`). `toGraphPath` puts a watcher
|
|
1967
|
+
* path in the graph's path space (symlinks resolved, `/` separators).
|
|
1968
|
+
*/
|
|
1969
|
+
function componentsChangedBy(changed, graph, componentIds, toGraphPath) {
|
|
1970
|
+
if (changed === null) return null;
|
|
1971
|
+
const affected = /* @__PURE__ */ new Set();
|
|
1972
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1973
|
+
const pending = [];
|
|
1974
|
+
for (const path of changed) {
|
|
1975
|
+
const nodes = [...graph.getModulesByFile(toGraphPath(path)) ?? []];
|
|
1976
|
+
if (!nodes.some((node) => node.id !== null)) return null;
|
|
1977
|
+
pending.push(...nodes);
|
|
1978
|
+
}
|
|
1979
|
+
while (pending.length > 0) {
|
|
1980
|
+
const module = pending.pop();
|
|
1981
|
+
if (visited.has(module)) continue;
|
|
1982
|
+
visited.add(module);
|
|
1983
|
+
if (module.id !== null) for (const id of componentIds.get(module.id) ?? []) affected.add(id);
|
|
1984
|
+
pending.push(...module.importers);
|
|
1985
|
+
}
|
|
1986
|
+
return [...affected];
|
|
1987
|
+
}
|
|
1988
|
+
// src/plugins/dev-server.ts
|
|
1684
1989
|
/**
|
|
1685
1990
|
* timber-dev-server — Vite sub-plugin for dev server request handling.
|
|
1686
1991
|
*
|
|
@@ -1798,12 +2103,35 @@ function timberDevServer(ctx) {
|
|
|
1798
2103
|
process.exit(75);
|
|
1799
2104
|
};
|
|
1800
2105
|
listenForClientErrors(server, ctx.root);
|
|
2106
|
+
server.middlewares.use((req, _res, next) => {
|
|
2107
|
+
if (req.url && !req.url.startsWith("/")) {
|
|
2108
|
+
const url = requestTargetUrl("http://localhost", req.url);
|
|
2109
|
+
if (url) req.url = url.pathname + url.search;
|
|
2110
|
+
}
|
|
2111
|
+
next();
|
|
2112
|
+
});
|
|
1801
2113
|
server.middlewares.use(createGraphEndpointMiddleware(server, ctx));
|
|
1802
|
-
const
|
|
1803
|
-
|
|
1804
|
-
|
|
2114
|
+
const toGraphPath = (file) => {
|
|
2115
|
+
if (server.config?.resolve?.preserveSymlinks || file.includes("virtual:")) return file;
|
|
2116
|
+
try {
|
|
2117
|
+
return realpathSync(file);
|
|
2118
|
+
} catch {
|
|
2119
|
+
try {
|
|
2120
|
+
return join(realpathSync(dirname(file)), basename(file));
|
|
2121
|
+
} catch {
|
|
2122
|
+
return file;
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
};
|
|
2126
|
+
const rsc = server.environments.rsc;
|
|
2127
|
+
clearDevStoreOnWatcherEvents(server.watcher, (changed) => {
|
|
2128
|
+
if (!rsc) return;
|
|
2129
|
+
const componentIds = componentsChangedBy(changed, rsc.moduleGraph, ctx.devPrebuiltComponentIds ?? /* @__PURE__ */ new Map(), (path) => normalizePath(toGraphPath(path)));
|
|
2130
|
+
const data = componentIds === null ? {} : { componentIds };
|
|
2131
|
+
rsc.hot.send({
|
|
1805
2132
|
type: "custom",
|
|
1806
|
-
event: PREBUILT_DEV_CLEAR_EVENT
|
|
2133
|
+
event: PREBUILT_DEV_CLEAR_EVENT,
|
|
2134
|
+
data
|
|
1807
2135
|
});
|
|
1808
2136
|
});
|
|
1809
2137
|
graphChannel = makeGraphUpdateChannel(ctx, (payload) => server.hot.send(payload), (file, environment) => {
|
|
@@ -1815,20 +2143,10 @@ function timberDevServer(ctx) {
|
|
|
1815
2143
|
return false;
|
|
1816
2144
|
}
|
|
1817
2145
|
return graph.getModuleById(file)?.transformResult != null;
|
|
1818
|
-
},
|
|
1819
|
-
if (server.config?.resolve?.preserveSymlinks || file.includes("virtual:")) return file;
|
|
1820
|
-
try {
|
|
1821
|
-
return realpathSync(file);
|
|
1822
|
-
} catch {
|
|
1823
|
-
try {
|
|
1824
|
-
return join(realpathSync(dirname(file)), basename(file));
|
|
1825
|
-
} catch {
|
|
1826
|
-
return file;
|
|
1827
|
-
}
|
|
1828
|
-
}
|
|
1829
|
-
});
|
|
2146
|
+
}, toGraphPath);
|
|
1830
2147
|
server.middlewares.use(createTimberMiddleware(server, ctx));
|
|
1831
|
-
|
|
2148
|
+
const hostname = applyDevHostname(server, devRecordRoot(ctx.root, server.config.configFile), ctx.config.dev?.hostname);
|
|
2149
|
+
registerDevDiscovery(server.httpServer, ctx.root, () => advertisedUrls(server.resolvedUrls, hostname, server.config.server), server.config);
|
|
1832
2150
|
if (ctx.holdingServer) {
|
|
1833
2151
|
await ctx.holdingServer.close().catch(() => {});
|
|
1834
2152
|
ctx.holdingServer = null;
|
|
@@ -1900,6 +2218,11 @@ function createTimberMiddleware(server, ctx) {
|
|
|
1900
2218
|
}
|
|
1901
2219
|
try {
|
|
1902
2220
|
const webRequest = toWebRequest(req);
|
|
2221
|
+
if (!webRequest) {
|
|
2222
|
+
res.writeHead(400, { "content-type": "text/plain; charset=utf-8" });
|
|
2223
|
+
res.end("Bad Request");
|
|
2224
|
+
return;
|
|
2225
|
+
}
|
|
1903
2226
|
const wrapper = server[Symbol.for("timber:dev-request-wrapper")];
|
|
1904
2227
|
const finalResponse = compressResponse(webRequest, wrapper ? await wrapper(() => handler(webRequest)) : await handler(webRequest));
|
|
1905
2228
|
res.writeHead(finalResponse.status, [...finalResponse.headers].flat());
|
|
@@ -1959,12 +2282,18 @@ function addTimberContext(error) {
|
|
|
1959
2282
|
* consulted: dev connections are direct, so the header would be
|
|
1960
2283
|
* attacker-controlled. (TIM-1067, B32)
|
|
1961
2284
|
*
|
|
2285
|
+
* Returns null for a request that names no URL — a Host that is not a bare
|
|
2286
|
+
* host[:port], or a request target that does not parse — which the caller
|
|
2287
|
+
* answers with 400. (TIM-1600)
|
|
2288
|
+
*
|
|
1962
2289
|
* Exported for tests.
|
|
1963
2290
|
*/
|
|
1964
2291
|
function toWebRequest(nodeReq) {
|
|
1965
2292
|
const protocol = nodeReq.socket?.encrypted ? "https" : "http";
|
|
1966
2293
|
const host = nodeReq.headers.host ?? nodeReq.headers[":authority"] ?? "localhost";
|
|
1967
|
-
const
|
|
2294
|
+
const origin = /[/?#@\\]/.test(host) ? null : URL.parse(`${protocol}://${host}`)?.origin;
|
|
2295
|
+
const url = origin ? requestTargetUrl(origin, nodeReq.url || "/") : null;
|
|
2296
|
+
if (!url) return null;
|
|
1968
2297
|
const headers = new Headers();
|
|
1969
2298
|
for (const [key, value] of Object.entries(nodeReq.headers)) {
|
|
1970
2299
|
if (value === void 0) continue;
|
|
@@ -2099,7 +2428,6 @@ function listenForClientErrors(server, projectRoot) {
|
|
|
2099
2428
|
}
|
|
2100
2429
|
});
|
|
2101
2430
|
}
|
|
2102
|
-
//#endregion
|
|
2103
2431
|
export { formatMissingPeers as a, checkPeerDependencies as i, timberDevServer as n, reportConfigErrors as o, toWebRequest as r, validateConfig as s, RESTART_EXIT_CODE as t };
|
|
2104
2432
|
|
|
2105
|
-
//# sourceMappingURL=dev-server-
|
|
2433
|
+
//# sourceMappingURL=dev-server-B7o4As0l.js.map
|