@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/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { a as formatMissingPeers, i as checkPeerDependencies, n as timberDevServer, o as reportConfigErrors, s as validateConfig } from "./_chunks/dev-server-
|
|
2
|
-
import { i as resolveRenderTimeoutMs } from "./_chunks/render-timeout-
|
|
3
|
-
import { t as writeFileAtomic } from "./_chunks/write-file-atomic-
|
|
4
|
-
import { d as collectInterceptionRewrites, l as getPrerenderExport, n as scanRoutes } from "./_chunks/scanner-
|
|
5
|
-
import {
|
|
6
|
-
import { c as buildDirToRouteMap, n as formatConventionWarnings, o as flushCodegenWrites, r as lintConventions, s as writeRouteCodegen, t as checkAppDirExists } from "./_chunks/convention-lint-
|
|
7
|
-
import { a as contextAdapter, c as loadTimberConfigFile, d as resolveBuildDir, f as resolveClientJavascript, l as mergeFileConfig, m as createNoopTimer, o as createPluginContext, r as adapterConfig, u as resolveAppDir } from "./_chunks/plugin-context-
|
|
8
|
-
import { i as withBasePath, n as normalizeBasePath, t as isRelativeBase } from "./_chunks/base-path-
|
|
9
|
-
import { r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "./_chunks/walkers-
|
|
10
|
-
import { i as poisonPillSource, r as markerFor, t as EXPLICIT_MARKERS } from "./_chunks/poison-rules-
|
|
11
|
-
import { n as rscPayloadPath, t as RSC_PAYLOAD_DIR } from "./_chunks/rsc-payload-path-
|
|
12
|
-
import { a as REDIRECTS_FILE, n as detectFsIdentity, o as RESERVED_OUTPUT_PATHS, r as fsKey, t as EXACT_FS_IDENTITY } from "./_chunks/fs-identity-
|
|
13
|
-
import { t as EMPTY_BUILD_MANIFEST } from "./_chunks/build-manifest-
|
|
14
|
-
import { t as fnv1aHash } from "./_chunks/fast-hash-
|
|
15
|
-
import { t as formatSize } from "./_chunks/format-
|
|
1
|
+
import { a as formatMissingPeers, i as checkPeerDependencies, n as timberDevServer, o as reportConfigErrors, s as validateConfig } from "./_chunks/dev-server-C61GWpGg.js";
|
|
2
|
+
import { i as resolveRenderTimeoutMs } from "./_chunks/render-timeout-MrrqD1wd.js";
|
|
3
|
+
import { t as writeFileAtomic } from "./_chunks/write-file-atomic-DW8m_Atv.js";
|
|
4
|
+
import { d as collectInterceptionRewrites, l as getPrerenderExport, n as scanRoutes } from "./_chunks/scanner-CJC-ScJU.js";
|
|
5
|
+
import { b as swallow } from "./_chunks/logger-CWk44DLp.js";
|
|
6
|
+
import { c as buildDirToRouteMap, n as formatConventionWarnings, o as flushCodegenWrites, r as lintConventions, s as writeRouteCodegen, t as checkAppDirExists } from "./_chunks/convention-lint-hZwz5wd4.js";
|
|
7
|
+
import { a as contextAdapter, c as loadTimberConfigFile, d as resolveBuildDir, f as resolveClientJavascript, l as mergeFileConfig, m as createNoopTimer, o as createPluginContext, r as adapterConfig, u as resolveAppDir } from "./_chunks/plugin-context-FCkaNLUB.js";
|
|
8
|
+
import { i as withBasePath, n as normalizeBasePath, t as isRelativeBase } from "./_chunks/base-path-DDIx0FXe.js";
|
|
9
|
+
import { r as validateSchemaAgainstRoutes, t as collectLeafRoutes } from "./_chunks/walkers-DIE203ir.js";
|
|
10
|
+
import { i as poisonPillSource, r as markerFor, t as EXPLICIT_MARKERS } from "./_chunks/poison-rules-Bmz-lCPi.js";
|
|
11
|
+
import { n as rscPayloadPath, t as RSC_PAYLOAD_DIR } from "./_chunks/rsc-payload-path-EphpDB-J.js";
|
|
12
|
+
import { a as REDIRECTS_FILE, n as detectFsIdentity, o as RESERVED_OUTPUT_PATHS, r as fsKey, t as EXACT_FS_IDENTITY } from "./_chunks/fs-identity-BmQ_Agg-.js";
|
|
13
|
+
import { t as EMPTY_BUILD_MANIFEST } from "./_chunks/build-manifest-Y4jl7nwU.js";
|
|
14
|
+
import { t as fnv1aHash } from "./_chunks/fast-hash-DddxkU5Y.js";
|
|
15
|
+
import { t as formatSize } from "./_chunks/format-DuPOoXUP.js";
|
|
16
16
|
import { createLogger, esmExternalRequirePlugin, isRunnableDevEnvironment, parseAst } from "vite";
|
|
17
17
|
import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve, win32 } from "node:path";
|
|
18
18
|
import { builtinModules, createRequire } from "node:module";
|
|
@@ -23,7 +23,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
23
23
|
import { createHash, randomUUID } from "node:crypto";
|
|
24
24
|
import { copyFile, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
25
25
|
import { gzipSync } from "node:zlib";
|
|
26
|
-
|
|
26
|
+
// src/plugins/content.ts
|
|
27
27
|
var CONFIG_FILE_NAMES = [
|
|
28
28
|
"content-collections.ts",
|
|
29
29
|
"content-collections.js",
|
|
@@ -126,8 +126,7 @@ function timberContent(ctx) {
|
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
//#region src/plugins/entries.ts
|
|
129
|
+
// src/plugins/entries.ts
|
|
131
130
|
var __dirname$1 = dirname(fileURLToPath(import.meta.url));
|
|
132
131
|
var SRC_DIR = existsSync(resolve(__dirname$1, "..", "server", "rsc-entry", "index.ts")) ? resolve(__dirname$1, "..") : resolve(__dirname$1, "..", "src");
|
|
133
132
|
var VIRTUAL_IDS = {
|
|
@@ -394,8 +393,7 @@ function timberEntries(ctx) {
|
|
|
394
393
|
}
|
|
395
394
|
};
|
|
396
395
|
}
|
|
397
|
-
|
|
398
|
-
//#region src/plugins/mdx.ts
|
|
396
|
+
// src/plugins/mdx.ts
|
|
399
397
|
var MDX_EXTENSIONS_UNDOTTED = [.../* @__PURE__ */ new Set([".mdx", ".md"])].map((ext) => ext.slice(1));
|
|
400
398
|
/**
|
|
401
399
|
* Check if mdx-components.tsx (or .ts, .jsx, .js) exists at the project root
|
|
@@ -533,8 +531,7 @@ function timberMdx(ctx) {
|
|
|
533
531
|
}
|
|
534
532
|
};
|
|
535
533
|
}
|
|
536
|
-
|
|
537
|
-
//#region src/routing/manifest-codegen.ts
|
|
534
|
+
// src/routing/manifest-codegen.ts
|
|
538
535
|
/**
|
|
539
536
|
* Route manifest codegen — generates virtual module source for the route
|
|
540
537
|
* manifest and the global schema loader.
|
|
@@ -683,8 +680,7 @@ function generateSchemaModule(appDir) {
|
|
|
683
680
|
"export default globalCodecs;"
|
|
684
681
|
].join("\n");
|
|
685
682
|
}
|
|
686
|
-
|
|
687
|
-
//#region src/plugins/orphaned-modules.ts
|
|
683
|
+
// src/plugins/orphaned-modules.ts
|
|
688
684
|
/**
|
|
689
685
|
* The update's modules with each orphan replaced by the RSC entry (whose
|
|
690
686
|
* file is `entryFile`). `undefined` when there are no orphans, so Vite keeps
|
|
@@ -704,8 +700,7 @@ function redirectOrphanedModules(environment, modules, entryFile) {
|
|
|
704
700
|
if (entry && !rest.includes(entry)) rest.push(entry);
|
|
705
701
|
return rest;
|
|
706
702
|
}
|
|
707
|
-
|
|
708
|
-
//#region src/plugins/routing.ts
|
|
703
|
+
// src/plugins/routing.ts
|
|
709
704
|
/**
|
|
710
705
|
* timber-routing — Vite sub-plugin for route manifest generation.
|
|
711
706
|
*
|
|
@@ -996,8 +991,7 @@ function invalidateManifest(server) {
|
|
|
996
991
|
}
|
|
997
992
|
server.hot.send({ type: "full-reload" });
|
|
998
993
|
}
|
|
999
|
-
|
|
1000
|
-
//#region src/plugins/shims.ts
|
|
994
|
+
// src/plugins/shims.ts
|
|
1001
995
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1002
996
|
var PKG_ROOT = __dirname.endsWith("plugins") ? resolve(__dirname, "..", "..") : resolve(__dirname, "..");
|
|
1003
997
|
var SHIMS_DIR = resolve(PKG_ROOT, "src", "shims");
|
|
@@ -1199,8 +1193,7 @@ ${SERVER_STUB_EXPORTS.map((name) => name === "RedirectType" ? `export const Redi
|
|
|
1199
1193
|
}
|
|
1200
1194
|
};
|
|
1201
1195
|
}
|
|
1202
|
-
|
|
1203
|
-
//#region src/fonts/paths.ts
|
|
1196
|
+
// src/fonts/paths.ts
|
|
1204
1197
|
/**
|
|
1205
1198
|
* Shared path/URL helpers for the timber-fonts pipeline.
|
|
1206
1199
|
*
|
|
@@ -1251,8 +1244,7 @@ function hashedFontBasename(srcPath, hash) {
|
|
|
1251
1244
|
const ext = win32.extname(basename);
|
|
1252
1245
|
return `${ext ? basename.slice(0, -ext.length) : basename}-${hash}${ext}`;
|
|
1253
1246
|
}
|
|
1254
|
-
|
|
1255
|
-
//#region src/fonts/google.ts
|
|
1247
|
+
// src/fonts/google.ts
|
|
1256
1248
|
/**
|
|
1257
1249
|
* Google Fonts download, caching, and dev CDN fallback.
|
|
1258
1250
|
*
|
|
@@ -1542,8 +1534,7 @@ function generateDevFontFaces(faces, display) {
|
|
|
1542
1534
|
async function resolveDevFontFaces(font) {
|
|
1543
1535
|
return generateDevFontFaces(filterBySubsets(await fetchGoogleFontsCss(buildGoogleFontsUrl(font)), font.subsets), font.display);
|
|
1544
1536
|
}
|
|
1545
|
-
|
|
1546
|
-
//#region src/fonts/css.ts
|
|
1537
|
+
// src/fonts/css.ts
|
|
1547
1538
|
/**
|
|
1548
1539
|
* Generate a single `@font-face` CSS rule from a descriptor.
|
|
1549
1540
|
*/
|
|
@@ -1595,8 +1586,7 @@ function generateVariableClass(className, variable, fontFamily) {
|
|
|
1595
1586
|
function generateFontFamilyClass(className, fontFamily) {
|
|
1596
1587
|
return `.${className} {\n font-family: ${fontFamily};\n}`;
|
|
1597
1588
|
}
|
|
1598
|
-
|
|
1599
|
-
//#region src/fonts/fallbacks.ts
|
|
1589
|
+
// src/fonts/fallbacks.ts
|
|
1600
1590
|
/**
|
|
1601
1591
|
* Lookup table for commonly used Google Fonts.
|
|
1602
1592
|
*
|
|
@@ -1775,8 +1765,7 @@ function buildFontStack(family) {
|
|
|
1775
1765
|
parts.push(generic);
|
|
1776
1766
|
return parts.join(", ");
|
|
1777
1767
|
}
|
|
1778
|
-
|
|
1779
|
-
//#region src/fonts/ast-walk.ts
|
|
1768
|
+
// src/fonts/ast-walk.ts
|
|
1780
1769
|
/** Convert a 0-based byte offset into a 1-based line and 0-based column. */
|
|
1781
1770
|
function offsetToLineColumn(source, offset) {
|
|
1782
1771
|
let line = 1;
|
|
@@ -1895,8 +1884,7 @@ function walkForUnconsumedReferences(node, bindingNames, consumedCallStarts, sou
|
|
|
1895
1884
|
}
|
|
1896
1885
|
walkChildNodes(node, (child) => walkForUnconsumedReferences(child, bindingNames, consumedCallStarts, source, out));
|
|
1897
1886
|
}
|
|
1898
|
-
|
|
1899
|
-
//#region src/fonts/ast.ts
|
|
1887
|
+
// src/fonts/ast.ts
|
|
1900
1888
|
/**
|
|
1901
1889
|
* AST utilities for extracting static font configs from source code.
|
|
1902
1890
|
* Uses OXC via Vite's `parseAst` — handles JS/JSX/TS/TSX natively.
|
|
@@ -2264,8 +2252,7 @@ function matchCallExpression(call, bindings, _source) {
|
|
|
2264
2252
|
configNode: args[0]
|
|
2265
2253
|
};
|
|
2266
2254
|
}
|
|
2267
|
-
|
|
2268
|
-
//#region src/fonts/local.ts
|
|
2255
|
+
// src/fonts/local.ts
|
|
2269
2256
|
/**
|
|
2270
2257
|
* Local font processing for the timber-fonts pipeline.
|
|
2271
2258
|
*
|
|
@@ -2518,8 +2505,7 @@ function generateLocalVirtualModule() {
|
|
|
2518
2505
|
"}"
|
|
2519
2506
|
].join("\n");
|
|
2520
2507
|
}
|
|
2521
|
-
|
|
2522
|
-
//#region src/fonts/pipeline.ts
|
|
2508
|
+
// src/fonts/pipeline.ts
|
|
2523
2509
|
/**
|
|
2524
2510
|
* FontPipeline — owns all per-font state for the timber-fonts plugin.
|
|
2525
2511
|
*
|
|
@@ -2782,8 +2768,7 @@ function renderEntryCss(entry, urlPrefix) {
|
|
|
2782
2768
|
else cssParts.push(generateFontFamilyClass(entry.className, entry.fontFamily));
|
|
2783
2769
|
return cssParts.join("\n\n");
|
|
2784
2770
|
}
|
|
2785
|
-
|
|
2786
|
-
//#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.6.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
2771
|
+
// ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.6.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
2787
2772
|
var comma = ",".charCodeAt(0);
|
|
2788
2773
|
var semicolon = ";".charCodeAt(0);
|
|
2789
2774
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -2877,8 +2862,7 @@ function encode(decoded) {
|
|
|
2877
2862
|
}
|
|
2878
2863
|
return writer.flush();
|
|
2879
2864
|
}
|
|
2880
|
-
|
|
2881
|
-
//#region ../../node_modules/.pnpm/magic-string@1.4.3/node_modules/magic-string/dist/index.mjs
|
|
2865
|
+
// ../../node_modules/.pnpm/magic-string@1.4.5/node_modules/magic-string/dist/index.mjs
|
|
2882
2866
|
var BitSet = class BitSet {
|
|
2883
2867
|
constructor(arg) {
|
|
2884
2868
|
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
@@ -2889,6 +2873,17 @@ var BitSet = class BitSet {
|
|
|
2889
2873
|
has(n) {
|
|
2890
2874
|
return !!(this.bits[n >> 5] & 1 << (n & 31));
|
|
2891
2875
|
}
|
|
2876
|
+
forEach(fn) {
|
|
2877
|
+
const bits = this.bits;
|
|
2878
|
+
for (let w = 0; w < bits.length; w++) {
|
|
2879
|
+
let word = bits[w];
|
|
2880
|
+
while (word) {
|
|
2881
|
+
const lowest = word & -word;
|
|
2882
|
+
fn((w << 5) + 31 - Math.clz32(lowest));
|
|
2883
|
+
word ^= lowest;
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2892
2887
|
};
|
|
2893
2888
|
var Chunk = class Chunk {
|
|
2894
2889
|
constructor(start, end, content) {
|
|
@@ -2900,6 +2895,8 @@ var Chunk = class Chunk {
|
|
|
2900
2895
|
this.content = content;
|
|
2901
2896
|
this.storeName = false;
|
|
2902
2897
|
this.edited = false;
|
|
2898
|
+
this.replacesUntil = -1;
|
|
2899
|
+
this.replacedFrom = -1;
|
|
2903
2900
|
this.previous = null;
|
|
2904
2901
|
this.next = null;
|
|
2905
2902
|
}
|
|
@@ -2916,6 +2913,8 @@ var Chunk = class Chunk {
|
|
|
2916
2913
|
chunk.content = this.content;
|
|
2917
2914
|
chunk.storeName = this.storeName;
|
|
2918
2915
|
chunk.edited = this.edited;
|
|
2916
|
+
chunk.replacesUntil = this.replacesUntil;
|
|
2917
|
+
chunk.replacedFrom = this.replacedFrom;
|
|
2919
2918
|
return chunk;
|
|
2920
2919
|
}
|
|
2921
2920
|
contains(index) {
|
|
@@ -2956,6 +2955,8 @@ var Chunk = class Chunk {
|
|
|
2956
2955
|
reset() {
|
|
2957
2956
|
this.intro = "";
|
|
2958
2957
|
this.outro = "";
|
|
2958
|
+
this.replacesUntil = -1;
|
|
2959
|
+
this.replacedFrom = -1;
|
|
2959
2960
|
if (this.edited) {
|
|
2960
2961
|
this.content = this.original;
|
|
2961
2962
|
this.storeName = false;
|
|
@@ -2973,7 +2974,7 @@ var Chunk = class Chunk {
|
|
|
2973
2974
|
this.end = index;
|
|
2974
2975
|
if (this.edited) {
|
|
2975
2976
|
newChunk.edit("", false, true);
|
|
2976
|
-
|
|
2977
|
+
newChunk.replacedFrom = this.replacedFrom;
|
|
2977
2978
|
} else this.content = originalBefore;
|
|
2978
2979
|
newChunk.next = this.next;
|
|
2979
2980
|
if (newChunk.next) newChunk.next.previous = newChunk;
|
|
@@ -3223,8 +3224,8 @@ var Mappings = class {
|
|
|
3223
3224
|
this.generatedCodeColumn = 0;
|
|
3224
3225
|
this.raw = [];
|
|
3225
3226
|
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
3226
|
-
this.
|
|
3227
|
-
this.
|
|
3227
|
+
this.rawRangeMappingsIndices = [];
|
|
3228
|
+
this.rawRangeMappings = hires === "experimental-range" ? [this.rawRangeMappingsIndices] : void 0;
|
|
3228
3229
|
this.encoder = encoder;
|
|
3229
3230
|
}
|
|
3230
3231
|
nextLine() {
|
|
@@ -3237,7 +3238,28 @@ var Mappings = class {
|
|
|
3237
3238
|
this.generatedCodeLine += 1;
|
|
3238
3239
|
}
|
|
3239
3240
|
this.generatedCodeColumn = 0;
|
|
3240
|
-
this.rawRangeMappings[this.generatedCodeLine] = this.rawRangeMappingsIndices = [];
|
|
3241
|
+
if (this.rawRangeMappings) this.rawRangeMappings[this.generatedCodeLine] = this.rawRangeMappingsIndices = [];
|
|
3242
|
+
}
|
|
3243
|
+
/**
|
|
3244
|
+
* Emits the mappings for one MagicString: its intro, every chunk (with the
|
|
3245
|
+
* chunk's own intro/outro) and its outro. `sourceIndex === -1` means the
|
|
3246
|
+
* string has no source of its own, so its content only advances the
|
|
3247
|
+
* generated position without mapping anything.
|
|
3248
|
+
*/
|
|
3249
|
+
addMagicString(magicString, sourceIndex, nameIndex) {
|
|
3250
|
+
const { original } = magicString;
|
|
3251
|
+
const locate = getLocator(original);
|
|
3252
|
+
if (magicString.intro) this.advance(magicString.intro);
|
|
3253
|
+
magicString.firstChunk.eachNext((chunk) => {
|
|
3254
|
+
if (chunk.intro.length) this.advance(chunk.intro);
|
|
3255
|
+
if (sourceIndex === -1) this.advance(chunk.content);
|
|
3256
|
+
else if (chunk.edited) {
|
|
3257
|
+
const name = chunk.storeName ? nameIndex.get(original.slice(chunk.start, chunk.replacesUntil)) : void 0;
|
|
3258
|
+
this.addEdit(sourceIndex, chunk.content, locate(chunk.start), name ?? -1);
|
|
3259
|
+
} else this.addUneditedChunk(sourceIndex, chunk, original, locate(chunk.start), magicString.sourcemapLocations);
|
|
3260
|
+
if (chunk.outro.length) this.advance(chunk.outro);
|
|
3261
|
+
});
|
|
3262
|
+
if (magicString.outro) this.advance(magicString.outro);
|
|
3241
3263
|
}
|
|
3242
3264
|
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
3243
3265
|
if (content.length) {
|
|
@@ -3450,6 +3472,9 @@ function expandReplacement(replacement, matched, position, str, captures, namedC
|
|
|
3450
3472
|
return result;
|
|
3451
3473
|
}
|
|
3452
3474
|
var MagicString = class MagicString {
|
|
3475
|
+
/**
|
|
3476
|
+
* Wraps `string` for editing; every index passed to the editing methods refers to this original string.
|
|
3477
|
+
*/
|
|
3453
3478
|
constructor(string, options = {}) {
|
|
3454
3479
|
const chunk = new Chunk(0, string.length, string);
|
|
3455
3480
|
Object.defineProperties(this, {
|
|
@@ -3499,7 +3524,7 @@ var MagicString = class MagicString {
|
|
|
3499
3524
|
},
|
|
3500
3525
|
storedNames: {
|
|
3501
3526
|
writable: true,
|
|
3502
|
-
value:
|
|
3527
|
+
value: /* @__PURE__ */ new Set()
|
|
3503
3528
|
},
|
|
3504
3529
|
indentStr: {
|
|
3505
3530
|
writable: true,
|
|
@@ -3539,7 +3564,8 @@ var MagicString = class MagicString {
|
|
|
3539
3564
|
* See also `s.prependLeft(...)`.
|
|
3540
3565
|
*/
|
|
3541
3566
|
appendLeft(index, content) {
|
|
3542
|
-
index =
|
|
3567
|
+
index = this._resolveIndex(index);
|
|
3568
|
+
if (index < 0 || index > this.original.length) throw new MagicStringError(`index ${index} is out of bounds`);
|
|
3543
3569
|
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
3544
3570
|
this._split(index);
|
|
3545
3571
|
const chunk = this.byEnd.get(index);
|
|
@@ -3553,7 +3579,8 @@ var MagicString = class MagicString {
|
|
|
3553
3579
|
* See also `s.prependRight(...)`.
|
|
3554
3580
|
*/
|
|
3555
3581
|
appendRight(index, content) {
|
|
3556
|
-
index =
|
|
3582
|
+
index = this._resolveIndex(index);
|
|
3583
|
+
if (index < 0 || index > this.original.length) throw new MagicStringError(`index ${index} is out of bounds`);
|
|
3557
3584
|
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
3558
3585
|
this._split(index);
|
|
3559
3586
|
const chunk = this.byStart.get(index);
|
|
@@ -3562,7 +3589,10 @@ var MagicString = class MagicString {
|
|
|
3562
3589
|
return this;
|
|
3563
3590
|
}
|
|
3564
3591
|
/**
|
|
3565
|
-
*
|
|
3592
|
+
* Returns an independent copy: the chunk list, string-level intro/outro,
|
|
3593
|
+
* sourcemap locations, stored names, indent exclusion ranges, `offset`,
|
|
3594
|
+
* `filename` and `ignoreList` are all copied; later edits to either string
|
|
3595
|
+
* do not affect the other.
|
|
3566
3596
|
*/
|
|
3567
3597
|
clone() {
|
|
3568
3598
|
const cloned = new MagicString(this.original, {
|
|
@@ -3587,7 +3617,7 @@ var MagicString = class MagicString {
|
|
|
3587
3617
|
cloned.lastChunk = clonedChunk;
|
|
3588
3618
|
if (this.indentExclusionRanges) cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
|
|
3589
3619
|
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
|
|
3590
|
-
cloned.storedNames =
|
|
3620
|
+
cloned.storedNames = new Set(this.storedNames);
|
|
3591
3621
|
cloned.intro = this.intro;
|
|
3592
3622
|
cloned.outro = this.outro;
|
|
3593
3623
|
cloned.hasMovedChunks = this.hasMovedChunks;
|
|
@@ -3623,18 +3653,8 @@ var MagicString = class MagicString {
|
|
|
3623
3653
|
}
|
|
3624
3654
|
/** @internal */
|
|
3625
3655
|
_generateMappings(mappings) {
|
|
3626
|
-
const
|
|
3627
|
-
|
|
3628
|
-
const locate = getLocator(this.original);
|
|
3629
|
-
if (this.intro) mappings.advance(this.intro);
|
|
3630
|
-
this.firstChunk.eachNext((chunk) => {
|
|
3631
|
-
const loc = locate(chunk.start);
|
|
3632
|
-
if (chunk.intro.length) mappings.advance(chunk.intro);
|
|
3633
|
-
if (chunk.edited) mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);
|
|
3634
|
-
else mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
|
|
3635
|
-
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
3636
|
-
});
|
|
3637
|
-
if (this.outro) mappings.advance(this.outro);
|
|
3656
|
+
const names = [...this.storedNames];
|
|
3657
|
+
mappings.addMagicString(this, 0, new Map(names.map((name, i) => [name, i])));
|
|
3638
3658
|
return names;
|
|
3639
3659
|
}
|
|
3640
3660
|
/** @internal */
|
|
@@ -3656,9 +3676,13 @@ var MagicString = class MagicString {
|
|
|
3656
3676
|
this._ensureindentStr();
|
|
3657
3677
|
return this.indentStr;
|
|
3658
3678
|
}
|
|
3679
|
+
/**
|
|
3680
|
+
* Returns the indentation string guessed from the original content, falling back to a single tab character.
|
|
3681
|
+
* This is the value `s.indent()` uses when no prefix is supplied.
|
|
3682
|
+
*/
|
|
3659
3683
|
getIndentString() {
|
|
3660
3684
|
this._ensureindentStr();
|
|
3661
|
-
return this.indentStr
|
|
3685
|
+
return this.indentStr ?? " ";
|
|
3662
3686
|
}
|
|
3663
3687
|
indent(indentStr, options) {
|
|
3664
3688
|
const pattern = /^[^\r\n]/gm;
|
|
@@ -3673,9 +3697,9 @@ var MagicString = class MagicString {
|
|
|
3673
3697
|
if (indentStr === "") return this;
|
|
3674
3698
|
const resolvedIndentStr = indentStr;
|
|
3675
3699
|
options = options || {};
|
|
3676
|
-
const isExcluded =
|
|
3700
|
+
const isExcluded = new BitSet();
|
|
3677
3701
|
if (options.exclude) (typeof options.exclude[0] === "number" ? [options.exclude] : options.exclude).forEach((exclusion) => {
|
|
3678
|
-
for (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded
|
|
3702
|
+
for (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded.add(i);
|
|
3679
3703
|
});
|
|
3680
3704
|
let shouldIndentNextCharacter = options.indentStart !== false;
|
|
3681
3705
|
const indentPiece = (str) => {
|
|
@@ -3698,13 +3722,14 @@ var MagicString = class MagicString {
|
|
|
3698
3722
|
};
|
|
3699
3723
|
while (chunk) {
|
|
3700
3724
|
const end = chunk.end;
|
|
3701
|
-
if (!isExcluded
|
|
3725
|
+
if (!isExcluded.has(chunk.start)) chunk.intro = indentPiece(chunk.intro);
|
|
3702
3726
|
if (chunk.edited) {
|
|
3703
|
-
if (!isExcluded
|
|
3727
|
+
if (!isExcluded.has(chunk.start)) chunk.content = indentPiece(chunk.content);
|
|
3728
|
+
else if (chunk.content) shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === "\n";
|
|
3704
3729
|
} else if (options.exclude) {
|
|
3705
3730
|
charIndex = chunk.start;
|
|
3706
3731
|
while (charIndex < end) {
|
|
3707
|
-
if (!isExcluded
|
|
3732
|
+
if (!isExcluded.has(charIndex)) {
|
|
3708
3733
|
const char = this.original.charCodeAt(charIndex);
|
|
3709
3734
|
if (char === NEWLINE_CHAR) shouldIndentNextCharacter = true;
|
|
3710
3735
|
else if (char !== CR_CHAR && shouldIndentNextCharacter) indentAt(charIndex);
|
|
@@ -3730,7 +3755,7 @@ var MagicString = class MagicString {
|
|
|
3730
3755
|
charIndex += 1;
|
|
3731
3756
|
}
|
|
3732
3757
|
}
|
|
3733
|
-
if (!isExcluded
|
|
3758
|
+
if (!isExcluded.has(chunk.end - 1)) chunk.outro = indentPiece(chunk.outro);
|
|
3734
3759
|
charIndex = chunk.end;
|
|
3735
3760
|
chunk = chunk.next;
|
|
3736
3761
|
}
|
|
@@ -3767,16 +3792,19 @@ var MagicString = class MagicString {
|
|
|
3767
3792
|
* mirroring the `appendLeft`/`appendRight` distinction.
|
|
3768
3793
|
*/
|
|
3769
3794
|
move(start, end, index, affinity = "right") {
|
|
3770
|
-
start =
|
|
3771
|
-
end =
|
|
3772
|
-
index =
|
|
3795
|
+
start = this._resolveIndex(start);
|
|
3796
|
+
end = this._resolveIndex(end);
|
|
3797
|
+
index = this._resolveIndex(index);
|
|
3773
3798
|
if (start === end) return this;
|
|
3799
|
+
if (start < 0 || end > this.original.length || index < 0 || index > this.original.length) throw new MagicStringError(`range ${start}–${end} is out of bounds`);
|
|
3800
|
+
if (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);
|
|
3774
3801
|
if (index >= start && index <= end) throw new MagicStringError("cannot move a selection inside itself");
|
|
3775
3802
|
this._split(start);
|
|
3776
3803
|
this._split(end);
|
|
3777
3804
|
this._split(index);
|
|
3778
3805
|
const first = this.byStart.get(start);
|
|
3779
3806
|
const last = this.byEnd.get(end);
|
|
3807
|
+
if (!first || !last) throw new MagicStringError(`range ${start}–${end} is out of bounds`);
|
|
3780
3808
|
if (this.hasMovedChunks) {
|
|
3781
3809
|
let cursor = first;
|
|
3782
3810
|
while (cursor !== last) {
|
|
@@ -3811,9 +3839,9 @@ var MagicString = class MagicString {
|
|
|
3811
3839
|
if (oldRight) oldRight.previous = oldLeft;
|
|
3812
3840
|
if (newLeft) newLeft.next = first;
|
|
3813
3841
|
if (newRight) newRight.previous = last;
|
|
3814
|
-
if (!
|
|
3815
|
-
if (!
|
|
3816
|
-
this.lastChunk =
|
|
3842
|
+
if (!oldLeft) this.firstChunk = oldRight;
|
|
3843
|
+
if (!oldRight) {
|
|
3844
|
+
this.lastChunk = oldLeft;
|
|
3817
3845
|
this.lastChunk.next = null;
|
|
3818
3846
|
}
|
|
3819
3847
|
first.previous = newLeft;
|
|
@@ -3834,6 +3862,16 @@ var MagicString = class MagicString {
|
|
|
3834
3862
|
* It may be preferred to use `s.update(...)` instead if you wish to avoid overwriting the appended/prepended content.
|
|
3835
3863
|
*/
|
|
3836
3864
|
overwrite(start, end, content, options) {
|
|
3865
|
+
if (options === true) {
|
|
3866
|
+
if (!warned.storeName) {
|
|
3867
|
+
console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string");
|
|
3868
|
+
warned.storeName = true;
|
|
3869
|
+
}
|
|
3870
|
+
return this.update(start, end, content, {
|
|
3871
|
+
storeName: true,
|
|
3872
|
+
overwrite: true
|
|
3873
|
+
});
|
|
3874
|
+
}
|
|
3837
3875
|
const optionObject = typeof options === "object" && options ? options : {};
|
|
3838
3876
|
return this.update(start, end, content, {
|
|
3839
3877
|
...optionObject,
|
|
@@ -3848,13 +3886,9 @@ var MagicString = class MagicString {
|
|
|
3848
3886
|
* the content is overwritten, or anything that was appended/prepended to the range as well.
|
|
3849
3887
|
*/
|
|
3850
3888
|
update(start, end, content, options) {
|
|
3851
|
-
start =
|
|
3852
|
-
end =
|
|
3889
|
+
start = this._resolveIndex(start);
|
|
3890
|
+
end = this._resolveIndex(end);
|
|
3853
3891
|
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
3854
|
-
if (this.original.length !== 0) {
|
|
3855
|
-
if (start < 0) start = Math.max(0, start + this.original.length);
|
|
3856
|
-
if (end < 0) end = Math.max(0, end + this.original.length);
|
|
3857
|
-
}
|
|
3858
3892
|
if (start < 0) throw new MagicStringError(`start ${start} is out of bounds`);
|
|
3859
3893
|
if (end > this.original.length) throw new MagicStringError(`end ${end} is out of bounds`);
|
|
3860
3894
|
if (start === end) throw new MagicStringError(`cannot overwrite a zero-length range at ${start}, use appendLeft() or prependRight()`);
|
|
@@ -3871,30 +3905,21 @@ var MagicString = class MagicString {
|
|
|
3871
3905
|
const optionObject = typeof options === "object" && options ? options : {};
|
|
3872
3906
|
const storeName = optionObject.storeName || false;
|
|
3873
3907
|
const overwrite = optionObject.overwrite || false;
|
|
3874
|
-
if (storeName)
|
|
3875
|
-
const original = this.original.slice(start, end);
|
|
3876
|
-
Object.defineProperty(this.storedNames, original, {
|
|
3877
|
-
writable: true,
|
|
3878
|
-
value: true,
|
|
3879
|
-
enumerable: true
|
|
3880
|
-
});
|
|
3881
|
-
}
|
|
3908
|
+
if (storeName) this.storedNames.add(this.original.slice(start, end));
|
|
3882
3909
|
const first = this.byStart.get(start);
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
newChunk.previous = last;
|
|
3897
|
-
}
|
|
3910
|
+
for (let chunk = first; chunk.end < end;) {
|
|
3911
|
+
const next = chunk.next;
|
|
3912
|
+
if (next === null || next !== this.byStart.get(chunk.end)) throw new MagicStringError("cannot overwrite across a split point");
|
|
3913
|
+
chunk = next;
|
|
3914
|
+
}
|
|
3915
|
+
for (let chunk = first.next; chunk !== null && chunk.start < end; chunk = chunk.next) {
|
|
3916
|
+
chunk.edit("", false, !overwrite);
|
|
3917
|
+
chunk.replacesUntil = -1;
|
|
3918
|
+
chunk.replacedFrom = start;
|
|
3919
|
+
}
|
|
3920
|
+
first.edit(content, storeName, !overwrite);
|
|
3921
|
+
first.replacesUntil = end;
|
|
3922
|
+
first.replacedFrom = -1;
|
|
3898
3923
|
return this;
|
|
3899
3924
|
}
|
|
3900
3925
|
/**
|
|
@@ -3909,7 +3934,8 @@ var MagicString = class MagicString {
|
|
|
3909
3934
|
* Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index
|
|
3910
3935
|
*/
|
|
3911
3936
|
prependLeft(index, content) {
|
|
3912
|
-
index =
|
|
3937
|
+
index = this._resolveIndex(index);
|
|
3938
|
+
if (index < 0 || index > this.original.length) throw new MagicStringError(`index ${index} is out of bounds`);
|
|
3913
3939
|
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
3914
3940
|
this._split(index);
|
|
3915
3941
|
const chunk = this.byEnd.get(index);
|
|
@@ -3921,7 +3947,8 @@ var MagicString = class MagicString {
|
|
|
3921
3947
|
* Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index`
|
|
3922
3948
|
*/
|
|
3923
3949
|
prependRight(index, content) {
|
|
3924
|
-
index =
|
|
3950
|
+
index = this._resolveIndex(index);
|
|
3951
|
+
if (index < 0 || index > this.original.length) throw new MagicStringError(`index ${index} is out of bounds`);
|
|
3925
3952
|
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
3926
3953
|
this._split(index);
|
|
3927
3954
|
const chunk = this.byStart.get(index);
|
|
@@ -3937,12 +3964,8 @@ var MagicString = class MagicString {
|
|
|
3937
3964
|
* Repeated removals and removals with partially overlapping ranges are allowed.
|
|
3938
3965
|
*/
|
|
3939
3966
|
remove(start, end) {
|
|
3940
|
-
start =
|
|
3941
|
-
end =
|
|
3942
|
-
if (this.original.length !== 0) {
|
|
3943
|
-
if (start < 0) start = Math.max(0, start + this.original.length);
|
|
3944
|
-
if (end < 0) end = Math.max(0, end + this.original.length);
|
|
3945
|
-
}
|
|
3967
|
+
start = this._resolveIndex(start);
|
|
3968
|
+
end = this._resolveIndex(end);
|
|
3946
3969
|
if (start === end) return this;
|
|
3947
3970
|
if (start < 0 || end > this.original.length) throw new MagicStringError(`range ${start}–${end} is out of bounds`);
|
|
3948
3971
|
if (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);
|
|
@@ -3953,7 +3976,9 @@ var MagicString = class MagicString {
|
|
|
3953
3976
|
if (chunk.start > start) chunk.intro = "";
|
|
3954
3977
|
if (chunk.end < end) chunk.outro = "";
|
|
3955
3978
|
chunk.edit("", false, true);
|
|
3956
|
-
chunk =
|
|
3979
|
+
chunk.replacesUntil = -1;
|
|
3980
|
+
chunk.replacedFrom = -1;
|
|
3981
|
+
chunk = end > chunk.end ? this.byStart.get(chunk.end) : void 0;
|
|
3957
3982
|
}
|
|
3958
3983
|
return this;
|
|
3959
3984
|
}
|
|
@@ -3961,12 +3986,8 @@ var MagicString = class MagicString {
|
|
|
3961
3986
|
* Reset the modified characters from `start` to `end` (of the original string, **not** the generated string).
|
|
3962
3987
|
*/
|
|
3963
3988
|
reset(start, end) {
|
|
3964
|
-
start =
|
|
3965
|
-
end =
|
|
3966
|
-
if (this.original.length !== 0) {
|
|
3967
|
-
if (start < 0) start = Math.max(0, start + this.original.length);
|
|
3968
|
-
if (end < 0) end = Math.max(0, end + this.original.length);
|
|
3969
|
-
}
|
|
3989
|
+
start = this._resolveIndex(start);
|
|
3990
|
+
end = this._resolveIndex(end);
|
|
3970
3991
|
if (start === end) return this;
|
|
3971
3992
|
if (start < 0 || end > this.original.length) throw new MagicStringError(`range ${start}–${end} is out of bounds`);
|
|
3972
3993
|
if (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);
|
|
@@ -3975,10 +3996,13 @@ var MagicString = class MagicString {
|
|
|
3975
3996
|
let chunk = this.byStart.get(start);
|
|
3976
3997
|
while (chunk) {
|
|
3977
3998
|
chunk.reset();
|
|
3978
|
-
chunk = end > chunk.end ? this.byStart.get(chunk.end) :
|
|
3999
|
+
chunk = end > chunk.end ? this.byStart.get(chunk.end) : void 0;
|
|
3979
4000
|
}
|
|
3980
4001
|
return this;
|
|
3981
4002
|
}
|
|
4003
|
+
/**
|
|
4004
|
+
* Returns the last character of the generated string, or `''` if it is empty.
|
|
4005
|
+
*/
|
|
3982
4006
|
lastChar() {
|
|
3983
4007
|
if (this.outro.length) return this.outro[this.outro.length - 1];
|
|
3984
4008
|
let chunk = this.lastChunk;
|
|
@@ -3991,49 +4015,57 @@ var MagicString = class MagicString {
|
|
|
3991
4015
|
if (this.intro.length) return this.intro[this.intro.length - 1];
|
|
3992
4016
|
return "";
|
|
3993
4017
|
}
|
|
4018
|
+
/**
|
|
4019
|
+
* Returns everything after the last newline in the generated string, or the whole string if there is no newline.
|
|
4020
|
+
*/
|
|
3994
4021
|
lastLine() {
|
|
3995
4022
|
let lineIndex = this.outro.lastIndexOf(n);
|
|
3996
|
-
if (lineIndex !== -1) return this.outro.
|
|
4023
|
+
if (lineIndex !== -1) return this.outro.slice(lineIndex + 1);
|
|
3997
4024
|
let lineStr = this.outro;
|
|
3998
4025
|
let chunk = this.lastChunk;
|
|
3999
4026
|
while (chunk) {
|
|
4000
4027
|
if (chunk.outro.length > 0) {
|
|
4001
4028
|
lineIndex = chunk.outro.lastIndexOf(n);
|
|
4002
|
-
if (lineIndex !== -1) return chunk.outro.
|
|
4029
|
+
if (lineIndex !== -1) return chunk.outro.slice(lineIndex + 1) + lineStr;
|
|
4003
4030
|
lineStr = chunk.outro + lineStr;
|
|
4004
4031
|
}
|
|
4005
4032
|
if (chunk.content.length > 0) {
|
|
4006
4033
|
lineIndex = chunk.content.lastIndexOf(n);
|
|
4007
|
-
if (lineIndex !== -1) return chunk.content.
|
|
4034
|
+
if (lineIndex !== -1) return chunk.content.slice(lineIndex + 1) + lineStr;
|
|
4008
4035
|
lineStr = chunk.content + lineStr;
|
|
4009
4036
|
}
|
|
4010
4037
|
if (chunk.intro.length > 0) {
|
|
4011
4038
|
lineIndex = chunk.intro.lastIndexOf(n);
|
|
4012
|
-
if (lineIndex !== -1) return chunk.intro.
|
|
4039
|
+
if (lineIndex !== -1) return chunk.intro.slice(lineIndex + 1) + lineStr;
|
|
4013
4040
|
lineStr = chunk.intro + lineStr;
|
|
4014
4041
|
}
|
|
4015
4042
|
chunk = chunk.previous;
|
|
4016
4043
|
}
|
|
4017
4044
|
lineIndex = this.intro.lastIndexOf(n);
|
|
4018
|
-
if (lineIndex !== -1) return this.intro.
|
|
4045
|
+
if (lineIndex !== -1) return this.intro.slice(lineIndex + 1) + lineStr;
|
|
4019
4046
|
return this.intro + lineStr;
|
|
4020
4047
|
}
|
|
4021
4048
|
/**
|
|
4022
|
-
* Returns the content of the generated string that corresponds to the slice
|
|
4023
|
-
*
|
|
4049
|
+
* Returns the content of the generated string that corresponds to the slice
|
|
4050
|
+
* between `start` and `end` of the original string, walking the generated
|
|
4051
|
+
* string from the chunk holding `start` to the chunk holding `end`. Throws
|
|
4052
|
+
* if either index falls inside replaced content. After `move()`, a range
|
|
4053
|
+
* whose end now comes before its start in the output yields `''`.
|
|
4024
4054
|
*/
|
|
4025
4055
|
slice(start = 0, end = this.original.length - this.offset) {
|
|
4026
|
-
start =
|
|
4027
|
-
end =
|
|
4028
|
-
if (this.original.length !== 0) {
|
|
4029
|
-
if (start < 0) start = Math.max(0, start + this.original.length);
|
|
4030
|
-
if (end < 0) end = Math.max(0, end + this.original.length);
|
|
4031
|
-
}
|
|
4056
|
+
start = this._resolveIndex(start);
|
|
4057
|
+
end = this._resolveIndex(end);
|
|
4032
4058
|
let result = "";
|
|
4033
|
-
let chunk
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
chunk
|
|
4059
|
+
let chunk;
|
|
4060
|
+
if (this.hasMovedChunks) {
|
|
4061
|
+
chunk = this.firstChunk;
|
|
4062
|
+
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
4063
|
+
if (chunk.start < end && chunk.end >= end || end === 0 && chunk.start === 0) return result;
|
|
4064
|
+
chunk = chunk.next;
|
|
4065
|
+
}
|
|
4066
|
+
} else {
|
|
4067
|
+
if (start >= end) return result;
|
|
4068
|
+
chunk = this._chunkAt(start);
|
|
4037
4069
|
}
|
|
4038
4070
|
if (chunk && chunk.edited && chunk.start !== start) throw new MagicStringError(`cannot use edited character ${start} as slice start anchor`);
|
|
4039
4071
|
const startChunk = chunk;
|
|
@@ -4056,10 +4088,39 @@ var MagicString = class MagicString {
|
|
|
4056
4088
|
*/
|
|
4057
4089
|
snip(start, end) {
|
|
4058
4090
|
const clone = this.clone();
|
|
4059
|
-
clone.remove(
|
|
4060
|
-
clone.remove(end, clone.original.length);
|
|
4091
|
+
clone.remove(-clone.offset, start);
|
|
4092
|
+
clone.remove(end, clone.original.length - clone.offset);
|
|
4061
4093
|
return clone;
|
|
4062
4094
|
}
|
|
4095
|
+
/**
|
|
4096
|
+
* Applies `offset`, resolves a negative index from the end of `original` as
|
|
4097
|
+
* `update`/`remove` always have, and rejects anything that is not an integer.
|
|
4098
|
+
* Bounds are checked by the caller, because the methods report them differently.
|
|
4099
|
+
*
|
|
4100
|
+
* @internal
|
|
4101
|
+
*/
|
|
4102
|
+
_resolveIndex(index) {
|
|
4103
|
+
const resolved = index + this.offset;
|
|
4104
|
+
if (!Number.isInteger(resolved)) throw new MagicStringError(`index must be an integer, got ${index}`);
|
|
4105
|
+
if (resolved < 0 && this.original.length !== 0) return Math.max(0, resolved + this.original.length);
|
|
4106
|
+
return resolved;
|
|
4107
|
+
}
|
|
4108
|
+
/**
|
|
4109
|
+
* The chunk whose original range holds `index` (`chunk.start <= index < chunk.end`),
|
|
4110
|
+
* or `undefined` when `index` is at or past the end. Searches from the last
|
|
4111
|
+
* visited chunk so that scans over nearby indices stay cheap.
|
|
4112
|
+
*
|
|
4113
|
+
* @internal
|
|
4114
|
+
*/
|
|
4115
|
+
_chunkAt(index) {
|
|
4116
|
+
let chunk = this.byStart.get(index);
|
|
4117
|
+
if (chunk) return chunk;
|
|
4118
|
+
chunk = this.lastSearchedChunk;
|
|
4119
|
+
const searchForward = index >= chunk.end;
|
|
4120
|
+
while (chunk && !chunk.contains(index)) chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start);
|
|
4121
|
+
if (chunk) this.lastSearchedChunk = chunk;
|
|
4122
|
+
return chunk;
|
|
4123
|
+
}
|
|
4063
4124
|
/** @internal */
|
|
4064
4125
|
_split(index) {
|
|
4065
4126
|
if (this.byStart.get(index) || this.byEnd.get(index)) return;
|
|
@@ -4112,6 +4173,11 @@ var MagicString = class MagicString {
|
|
|
4112
4173
|
if (this.outro.length && this.outro.trim()) return false;
|
|
4113
4174
|
return true;
|
|
4114
4175
|
}
|
|
4176
|
+
/**
|
|
4177
|
+
* Returns the length of the generated string, counting only content attached to the original characters.
|
|
4178
|
+
* Content outside the string body (`s.prepend()`/`s.append()`, and inserts before the first or after the last
|
|
4179
|
+
* character) is not counted, so this can differ from `s.toString().length`.
|
|
4180
|
+
*/
|
|
4115
4181
|
length() {
|
|
4116
4182
|
let chunk = this.firstChunk;
|
|
4117
4183
|
let length = 0;
|
|
@@ -4143,10 +4209,11 @@ var MagicString = class MagicString {
|
|
|
4143
4209
|
const end = chunk.end;
|
|
4144
4210
|
const aborted = chunk.trimEnd(rx);
|
|
4145
4211
|
if (chunk.end !== end) {
|
|
4146
|
-
|
|
4212
|
+
const next = chunk.next;
|
|
4213
|
+
if (this.lastChunk === chunk) this.lastChunk = next;
|
|
4147
4214
|
this.byEnd.set(chunk.end, chunk);
|
|
4148
|
-
this.byStart.set(
|
|
4149
|
-
this.byEnd.set(
|
|
4215
|
+
this.byStart.set(next.start, next);
|
|
4216
|
+
this.byEnd.set(next.end, next);
|
|
4150
4217
|
}
|
|
4151
4218
|
if (aborted) return true;
|
|
4152
4219
|
chunk = chunk.previous;
|
|
@@ -4171,10 +4238,11 @@ var MagicString = class MagicString {
|
|
|
4171
4238
|
const end = chunk.end;
|
|
4172
4239
|
const aborted = chunk.trimStart(rx);
|
|
4173
4240
|
if (chunk.end !== end) {
|
|
4174
|
-
|
|
4241
|
+
const next = chunk.next;
|
|
4242
|
+
if (chunk === this.lastChunk) this.lastChunk = next;
|
|
4175
4243
|
this.byEnd.set(chunk.end, chunk);
|
|
4176
|
-
this.byStart.set(
|
|
4177
|
-
this.byEnd.set(
|
|
4244
|
+
this.byStart.set(next.start, next);
|
|
4245
|
+
this.byEnd.set(next.end, next);
|
|
4178
4246
|
}
|
|
4179
4247
|
if (aborted) return true;
|
|
4180
4248
|
chunk = chunk.next;
|
|
@@ -4216,30 +4284,29 @@ var MagicString = class MagicString {
|
|
|
4216
4284
|
* @internal
|
|
4217
4285
|
*/
|
|
4218
4286
|
_hasRemovedContent(start, end) {
|
|
4219
|
-
|
|
4220
|
-
if (
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
while (chunk && !chunk.contains(start)) chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start);
|
|
4224
|
-
if (chunk) this.lastSearchedChunk = chunk;
|
|
4287
|
+
const atBoundary = this.byStart.get(start);
|
|
4288
|
+
if (atBoundary && start === end) {
|
|
4289
|
+
const previous = this.byEnd.get(start);
|
|
4290
|
+
return !!previous && previous.content === "" && atBoundary.content === "";
|
|
4225
4291
|
}
|
|
4292
|
+
let chunk = this._chunkAt(start);
|
|
4226
4293
|
while (chunk && chunk.start < end) {
|
|
4227
|
-
if (chunk.content === "") return true;
|
|
4294
|
+
if (chunk.content === "" && (chunk.replacedFrom < start || this.byStart.get(chunk.replacedFrom).replacesUntil < chunk.end)) return true;
|
|
4228
4295
|
chunk = this.byStart.get(chunk.end);
|
|
4229
4296
|
}
|
|
4230
4297
|
return false;
|
|
4231
4298
|
}
|
|
4232
4299
|
/** @internal */
|
|
4233
4300
|
_replaceRegexp(searchValue, replacement) {
|
|
4234
|
-
function getReplacement(match, str) {
|
|
4235
|
-
if (typeof replacement === "string") return expandReplacement(replacement, match[0],
|
|
4236
|
-
else return match.groups === void 0 ? replacement(match[0], ...match.slice(1),
|
|
4301
|
+
function getReplacement(match, index, str) {
|
|
4302
|
+
if (typeof replacement === "string") return expandReplacement(replacement, match[0], index, str, match.slice(1), match.groups);
|
|
4303
|
+
else return match.groups === void 0 ? replacement(match[0], ...match.slice(1), index, str) : replacement(match[0], ...match.slice(1), index, str, match.groups);
|
|
4237
4304
|
}
|
|
4238
4305
|
const replaceMatch = (match) => {
|
|
4239
4306
|
/* v8 ignore next 2 -- `match.index` is always defined for matches from `matchAll` */
|
|
4240
4307
|
if (match.index == null) return false;
|
|
4241
4308
|
if (this._hasRemovedContent(match.index, match.index + match[0].length)) return false;
|
|
4242
|
-
const replacement = getReplacement(match, this.original);
|
|
4309
|
+
const replacement = getReplacement(match, match.index, this.original);
|
|
4243
4310
|
if (replacement === match[0]) return true;
|
|
4244
4311
|
if (match[0].length === 0) this.appendRight(match.index - this.offset, replacement);
|
|
4245
4312
|
else this.overwrite(match.index - this.offset, match.index + match[0].length - this.offset, replacement);
|
|
@@ -4312,8 +4379,7 @@ var MagicString = class MagicString {
|
|
|
4312
4379
|
return this._replaceRegexp(searchValue, replacement);
|
|
4313
4380
|
}
|
|
4314
4381
|
};
|
|
4315
|
-
|
|
4316
|
-
//#region src/fonts/transform.ts
|
|
4382
|
+
// src/fonts/transform.ts
|
|
4317
4383
|
/**
|
|
4318
4384
|
* Transform-hook logic for the timber-fonts plugin.
|
|
4319
4385
|
*
|
|
@@ -4459,8 +4525,7 @@ function runFontsTransform(code, id, pipeline, emitError) {
|
|
|
4459
4525
|
map: s.generateMap({ hires: true })
|
|
4460
4526
|
};
|
|
4461
4527
|
}
|
|
4462
|
-
|
|
4463
|
-
//#region src/fonts/dev-middleware.ts
|
|
4528
|
+
// src/fonts/dev-middleware.ts
|
|
4464
4529
|
var FONT_MIME_TYPES = {
|
|
4465
4530
|
woff2: "font/woff2",
|
|
4466
4531
|
woff: "font/woff",
|
|
@@ -4508,8 +4573,7 @@ function installFontDevMiddleware(server, pipeline, base = "/") {
|
|
|
4508
4573
|
next();
|
|
4509
4574
|
});
|
|
4510
4575
|
}
|
|
4511
|
-
|
|
4512
|
-
//#region src/fonts/bundle.ts
|
|
4576
|
+
// src/fonts/bundle.ts
|
|
4513
4577
|
/**
|
|
4514
4578
|
* Build-output emission for the timber-fonts plugin.
|
|
4515
4579
|
*
|
|
@@ -4597,8 +4661,7 @@ function writeFontManifest(pipeline, buildManifest, base = "/") {
|
|
|
4597
4661
|
}
|
|
4598
4662
|
for (const [importer, entries] of fontsByImporter) buildManifest.fonts[importer] = entries;
|
|
4599
4663
|
}
|
|
4600
|
-
|
|
4601
|
-
//#region src/plugins/fonts.ts
|
|
4664
|
+
// src/plugins/fonts.ts
|
|
4602
4665
|
/**
|
|
4603
4666
|
* timber-fonts — Vite sub-plugin shell for build-time font processing.
|
|
4604
4667
|
*
|
|
@@ -4827,8 +4890,7 @@ function timberFonts(ctx) {
|
|
|
4827
4890
|
}
|
|
4828
4891
|
};
|
|
4829
4892
|
}
|
|
4830
|
-
|
|
4831
|
-
//#region src/server/flight-scripts.ts
|
|
4893
|
+
// src/server/flight-scripts.ts
|
|
4832
4894
|
/**
|
|
4833
4895
|
* Escape a JSON string for safe embedding inside an HTML `<script>` tag.
|
|
4834
4896
|
*
|
|
@@ -4838,8 +4900,7 @@ function timberFonts(ctx) {
|
|
|
4838
4900
|
function htmlEscapeJsonString(str) {
|
|
4839
4901
|
return str.replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
4840
4902
|
}
|
|
4841
|
-
|
|
4842
|
-
//#region src/plugins/static-build.ts
|
|
4903
|
+
// src/plugins/static-build.ts
|
|
4843
4904
|
/**
|
|
4844
4905
|
* Patterns that indicate dynamic per-request API usage.
|
|
4845
4906
|
* These are build errors in static mode because there is no request at build time.
|
|
@@ -5331,8 +5392,7 @@ function timberStaticBuild(ctx) {
|
|
|
5331
5392
|
}
|
|
5332
5393
|
};
|
|
5333
5394
|
}
|
|
5334
|
-
|
|
5335
|
-
//#region src/plugins/build-manifest.ts
|
|
5395
|
+
// src/plugins/build-manifest.ts
|
|
5336
5396
|
/**
|
|
5337
5397
|
* timber-build-manifest — Vite sub-plugin for build asset manifest generation.
|
|
5338
5398
|
*
|
|
@@ -5540,8 +5600,7 @@ function timberBuildManifest(ctx) {
|
|
|
5540
5600
|
}
|
|
5541
5601
|
};
|
|
5542
5602
|
}
|
|
5543
|
-
|
|
5544
|
-
//#region src/dev-tools/logs.ts
|
|
5603
|
+
// src/dev-tools/logs.ts
|
|
5545
5604
|
/**
|
|
5546
5605
|
* Snapshot of the original console methods, captured at module load time
|
|
5547
5606
|
* (before any patching). Used as Vite's `customLogger` console so that
|
|
@@ -5810,8 +5869,7 @@ function timberDevLogs(_ctx) {
|
|
|
5810
5869
|
}
|
|
5811
5870
|
};
|
|
5812
5871
|
}
|
|
5813
|
-
|
|
5814
|
-
//#region src/dev-tools/browser-logs.ts
|
|
5872
|
+
// src/dev-tools/browser-logs.ts
|
|
5815
5873
|
/**
|
|
5816
5874
|
* Map timber's devBrowserLogs threshold to Vite 8's server.forwardConsole.
|
|
5817
5875
|
*
|
|
@@ -5840,8 +5898,7 @@ function resolveForwardConsole(threshold) {
|
|
|
5840
5898
|
logLevels
|
|
5841
5899
|
};
|
|
5842
5900
|
}
|
|
5843
|
-
|
|
5844
|
-
//#region src/plugins/react-prod.ts
|
|
5901
|
+
// src/plugins/react-prod.ts
|
|
5845
5902
|
/**
|
|
5846
5903
|
* Redirect React's CJS development bundles to production bundles.
|
|
5847
5904
|
*
|
|
@@ -5885,8 +5942,7 @@ function timberReactProd() {
|
|
|
5885
5942
|
}
|
|
5886
5943
|
};
|
|
5887
5944
|
}
|
|
5888
|
-
|
|
5889
|
-
//#region src/plugins/react-resolve.ts
|
|
5945
|
+
// src/plugins/react-resolve.ts
|
|
5890
5946
|
/**
|
|
5891
5947
|
* timber-react-resolve — Deduplicate React across timber and user project.
|
|
5892
5948
|
*
|
|
@@ -5985,8 +6041,7 @@ function timberReactResolve() {
|
|
|
5985
6041
|
}
|
|
5986
6042
|
};
|
|
5987
6043
|
}
|
|
5988
|
-
|
|
5989
|
-
//#region src/plugins/chunks.ts
|
|
6044
|
+
// src/plugins/chunks.ts
|
|
5990
6045
|
/**
|
|
5991
6046
|
* Build a map from absolute module IDs in non-facade RSC chunks to the
|
|
5992
6047
|
* absolute facade module paths that transitively import them.
|
|
@@ -6052,8 +6107,7 @@ function timberChunks(ctx) {
|
|
|
6052
6107
|
}
|
|
6053
6108
|
};
|
|
6054
6109
|
}
|
|
6055
|
-
|
|
6056
|
-
//#region src/plugins/client-chunks.ts
|
|
6110
|
+
// src/plugins/client-chunks.ts
|
|
6057
6111
|
/**
|
|
6058
6112
|
* Client chunk grouping strategy for @vitejs/plugin-rsc.
|
|
6059
6113
|
*
|
|
@@ -6185,8 +6239,7 @@ function clientChunkGroup(meta, appDir, root, sharedModuleFacades) {
|
|
|
6185
6239
|
}
|
|
6186
6240
|
return "client-shared";
|
|
6187
6241
|
}
|
|
6188
|
-
|
|
6189
|
-
//#region src/plugins/server-bundle.ts
|
|
6242
|
+
// src/plugins/server-bundle.ts
|
|
6190
6243
|
/**
|
|
6191
6244
|
* timber-server-bundle — Bundle all dependencies for server environments.
|
|
6192
6245
|
*
|
|
@@ -6296,8 +6349,7 @@ function timberServerBundle() {
|
|
|
6296
6349
|
}
|
|
6297
6350
|
];
|
|
6298
6351
|
}
|
|
6299
|
-
|
|
6300
|
-
//#region src/plugins/encryption-runtime.ts
|
|
6352
|
+
// src/plugins/encryption-runtime.ts
|
|
6301
6353
|
/**
|
|
6302
6354
|
* timber-encryption-runtime — route plugin-rsc's server-action encryption
|
|
6303
6355
|
* runtime to timber's (`rsc-runtime/encryption-runtime.ts`), which serializes
|
|
@@ -6323,8 +6375,7 @@ function timberEncryptionRuntime() {
|
|
|
6323
6375
|
}
|
|
6324
6376
|
};
|
|
6325
6377
|
}
|
|
6326
|
-
|
|
6327
|
-
//#region src/plugins/callsite-ast.ts
|
|
6378
|
+
// src/plugins/callsite-ast.ts
|
|
6328
6379
|
/**
|
|
6329
6380
|
* Shared AST helpers for callsite-ID transforms.
|
|
6330
6381
|
*
|
|
@@ -6619,8 +6670,7 @@ function findCallSites(node, matches, results) {
|
|
|
6619
6670
|
function generateStableCallsiteId(relativeModulePath, kind, statementText, callSpanText, occurrence) {
|
|
6620
6671
|
return fnv1aHash(`${relativeModulePath}:${kind}:${fnv1aHash(statementText)}:${fnv1aHash(callSpanText)}:${occurrence}`);
|
|
6621
6672
|
}
|
|
6622
|
-
|
|
6623
|
-
//#region src/plugins/cache.ts
|
|
6673
|
+
// src/plugins/cache.ts
|
|
6624
6674
|
/**
|
|
6625
6675
|
* timber-cache-transform — Vite plugin that injects stable callsite IDs
|
|
6626
6676
|
* into `cache.data()` calls imported from `@timber-js/app/cache`.
|
|
@@ -6776,8 +6826,7 @@ function timberCacheTransform(ctx) {
|
|
|
6776
6826
|
}
|
|
6777
6827
|
};
|
|
6778
6828
|
}
|
|
6779
|
-
|
|
6780
|
-
//#region src/plugins/request-dep/analysis.ts
|
|
6829
|
+
// src/plugins/request-dep/analysis.ts
|
|
6781
6830
|
/** `export default` has no local name of its own; this stands in for one. */
|
|
6782
6831
|
var DEFAULT_EXPORT = "default";
|
|
6783
6832
|
function createModuleFacts() {
|
|
@@ -7086,8 +7135,7 @@ function analyzeModule(program) {
|
|
|
7086
7135
|
walk(program, facts);
|
|
7087
7136
|
return facts;
|
|
7088
7137
|
}
|
|
7089
|
-
|
|
7090
|
-
//#region src/plugins/request-dep/origin.ts
|
|
7138
|
+
// src/plugins/request-dep/origin.ts
|
|
7091
7139
|
var ACCESSOR_SOURCES = /* @__PURE__ */ new Set([
|
|
7092
7140
|
"@timber-js/app/server",
|
|
7093
7141
|
"next/headers",
|
|
@@ -7294,8 +7342,7 @@ function createOriginResolver(factsMap) {
|
|
|
7294
7342
|
}
|
|
7295
7343
|
};
|
|
7296
7344
|
}
|
|
7297
|
-
|
|
7298
|
-
//#region src/plugins/request-dep/index.ts
|
|
7345
|
+
// src/plugins/request-dep/index.ts
|
|
7299
7346
|
function isFrameworkModule(id) {
|
|
7300
7347
|
return /[\\/]node_modules[\\/]@timber-js[\\/]app[\\/]/.test(id) || /[\\/]packages[\\/]timber-app[\\/]src[\\/]/.test(id);
|
|
7301
7348
|
}
|
|
@@ -7499,8 +7546,7 @@ function walkSegmentTree(node, fn) {
|
|
|
7499
7546
|
if (node.children) for (const child of node.children) walkSegmentTree(child, fn);
|
|
7500
7547
|
if (node.slots) for (const slot of Object.values(node.slots)) walkSegmentTree(slot, fn);
|
|
7501
7548
|
}
|
|
7502
|
-
|
|
7503
|
-
//#region src/plugins/callsite-jsx.ts
|
|
7549
|
+
// src/plugins/callsite-jsx.ts
|
|
7504
7550
|
/**
|
|
7505
7551
|
* Try to extract a static JSON-safe value from an AST expression node.
|
|
7506
7552
|
* Returns `undefined` (not null — null is a valid JSON value) when the
|
|
@@ -7647,8 +7693,7 @@ function recordCallSiteProps(ctx, componentId, props) {
|
|
|
7647
7693
|
ctx.prebuiltCallSiteProps.set(componentId, existing);
|
|
7648
7694
|
}
|
|
7649
7695
|
}
|
|
7650
|
-
|
|
7651
|
-
//#region src/plugins/prebuilt-options-analysis.ts
|
|
7696
|
+
// src/plugins/prebuilt-options-analysis.ts
|
|
7652
7697
|
var EXPRESSION_WRAPPER_TYPES = /* @__PURE__ */ new Set([
|
|
7653
7698
|
"TSAsExpression",
|
|
7654
7699
|
"TSSatisfiesExpression",
|
|
@@ -7763,8 +7808,7 @@ function mayPrerender(call) {
|
|
|
7763
7808
|
if (slotsActive === "yes" && (ttl === "yes" || tags === "yes")) return false;
|
|
7764
7809
|
return true;
|
|
7765
7810
|
}
|
|
7766
|
-
|
|
7767
|
-
//#region src/plugins/prebuilt-capture.ts
|
|
7811
|
+
// src/plugins/prebuilt-capture.ts
|
|
7768
7812
|
/**
|
|
7769
7813
|
* Post-build prebuilt capture — Node-side orchestration (TIM-1119).
|
|
7770
7814
|
*
|
|
@@ -7899,8 +7943,7 @@ async function runPrebuiltCapture(ctx, rscDir) {
|
|
|
7899
7943
|
artifact: { path: prebuiltDir }
|
|
7900
7944
|
} : { summary };
|
|
7901
7945
|
}
|
|
7902
|
-
|
|
7903
|
-
//#region src/plugins/prebuilt.ts
|
|
7946
|
+
// src/plugins/prebuilt.ts
|
|
7904
7947
|
/**
|
|
7905
7948
|
* timber-prebuilt — Vite plugin that detects `cache.component(...)` call
|
|
7906
7949
|
* sites and rewrites them to `__prebuilt(stableId, component, options)`.
|
|
@@ -8167,6 +8210,8 @@ function timberPrebuilt(ctx) {
|
|
|
8167
8210
|
moduleComponents.delete(id);
|
|
8168
8211
|
bindingNames.delete(id);
|
|
8169
8212
|
}
|
|
8213
|
+
const devIds = ctx.dev && this?.environment?.name === "rsc" ? ctx.devPrebuiltComponentIds ??= /* @__PURE__ */ new Map() : null;
|
|
8214
|
+
devIds?.delete(id);
|
|
8170
8215
|
if (!code.includes("@timber-js/app/cache") && !code.includes("timber/cache")) return;
|
|
8171
8216
|
if (id.includes("node_modules")) return;
|
|
8172
8217
|
if (this?.environment?.name === "client") return;
|
|
@@ -8193,6 +8238,7 @@ function timberPrebuilt(ctx) {
|
|
|
8193
8238
|
occurrences.set(dupKey, occurrence + 1);
|
|
8194
8239
|
const componentId = generatePrebuiltId(relPath, stmtText, spanText, occurrence, displayName);
|
|
8195
8240
|
if (!ctx.dev && mayPrerender(call)) componentIds.push(componentId);
|
|
8241
|
+
if (devIds) devIds.set(id, [...devIds.get(id) ?? [], componentId]);
|
|
8196
8242
|
s.overwrite(call.callee.start, call.callee.end, "__prebuilt");
|
|
8197
8243
|
s.appendLeft(call.arguments[0].start, `${JSON.stringify(componentId)}, `);
|
|
8198
8244
|
}
|
|
@@ -8301,8 +8347,7 @@ function timberPrebuilt(ctx) {
|
|
|
8301
8347
|
}
|
|
8302
8348
|
};
|
|
8303
8349
|
}
|
|
8304
|
-
|
|
8305
|
-
//#region src/plugins/prerender-sugar.ts
|
|
8350
|
+
// src/plugins/prerender-sugar.ts
|
|
8306
8351
|
/**
|
|
8307
8352
|
* timber-prerender-sugar — Vite plugin that desugars `export const prerender`
|
|
8308
8353
|
* on page and layout files into `cache.component(...)` wrappers.
|
|
@@ -8519,8 +8564,7 @@ function timberPrerenderSugar(ctx) {
|
|
|
8519
8564
|
}
|
|
8520
8565
|
};
|
|
8521
8566
|
}
|
|
8522
|
-
|
|
8523
|
-
//#region src/plugins/cloudflare-wasm.ts
|
|
8567
|
+
// src/plugins/cloudflare-wasm.ts
|
|
8524
8568
|
/**
|
|
8525
8569
|
* timber-cloudflare-wasm — Handle WASM modules for Cloudflare Workers builds.
|
|
8526
8570
|
*
|
|
@@ -8608,8 +8652,7 @@ function timberCloudflareWasm(ctx) {
|
|
|
8608
8652
|
}
|
|
8609
8653
|
}];
|
|
8610
8654
|
}
|
|
8611
|
-
|
|
8612
|
-
//#region src/plugins/rsc-assets-manifest.ts
|
|
8655
|
+
// src/plugins/rsc-assets-manifest.ts
|
|
8613
8656
|
/**
|
|
8614
8657
|
* The RSC plugin's assets manifest (`__vite_rsc_assets_manifest.js`) — read
|
|
8615
8658
|
* into the build manifest, and stripped of JavaScript when client JS is off.
|
|
@@ -8776,8 +8819,7 @@ async function stripJsFromRscAssetsManifests(serverDirs) {
|
|
|
8776
8819
|
await writeFile(path, `export default ${JSON.stringify(manifest, null, 2)};\n`);
|
|
8777
8820
|
}
|
|
8778
8821
|
}
|
|
8779
|
-
|
|
8780
|
-
//#region src/plugins/post-build.ts
|
|
8822
|
+
// src/plugins/post-build.ts
|
|
8781
8823
|
/** The Vite environments whose output adapters consume. */
|
|
8782
8824
|
var ARTIFACT_ENVIRONMENTS = [
|
|
8783
8825
|
"client",
|
|
@@ -8980,8 +9022,7 @@ function assembleBuildArtifacts(input) {
|
|
|
8980
9022
|
manifestInit: input.manifestInit
|
|
8981
9023
|
};
|
|
8982
9024
|
}
|
|
8983
|
-
|
|
8984
|
-
//#region src/plugins/build-report.ts
|
|
9025
|
+
// src/plugins/build-report.ts
|
|
8985
9026
|
/**
|
|
8986
9027
|
* timber-build-report — Post-build route summary table.
|
|
8987
9028
|
*
|
|
@@ -9351,8 +9392,7 @@ function timberBuildReport(ctx) {
|
|
|
9351
9392
|
}
|
|
9352
9393
|
};
|
|
9353
9394
|
}
|
|
9354
|
-
|
|
9355
|
-
//#region src/server/action-encryption.ts
|
|
9395
|
+
// src/server/action-encryption.ts
|
|
9356
9396
|
/**
|
|
9357
9397
|
* Regex for safe `defineEncryptionKey` expressions.
|
|
9358
9398
|
*
|
|
@@ -9410,8 +9450,7 @@ function validateKeyFormat(key) {
|
|
|
9410
9450
|
throw new Error("TIMBER_ACTIONS_ENCRYPTION_KEY is not valid base64. Generate a key with: node -e \"console.log(require('crypto').randomBytes(32).toString('base64'))\"");
|
|
9411
9451
|
}
|
|
9412
9452
|
}
|
|
9413
|
-
|
|
9414
|
-
//#region src/dev-tools/holding-server.ts
|
|
9453
|
+
// src/dev-tools/holding-server.ts
|
|
9415
9454
|
/**
|
|
9416
9455
|
* Dev holding server — serves a loading page while Vite initializes.
|
|
9417
9456
|
*
|
|
@@ -9574,8 +9613,7 @@ function resolveStartPort(input) {
|
|
|
9574
9613
|
}
|
|
9575
9614
|
return defaultPort;
|
|
9576
9615
|
}
|
|
9577
|
-
|
|
9578
|
-
//#region src/index.ts
|
|
9616
|
+
// src/index.ts
|
|
9579
9617
|
/**
|
|
9580
9618
|
* Type-safe helper for timber.config.ts files.
|
|
9581
9619
|
*
|
|
@@ -9737,7 +9775,7 @@ function timber(config) {
|
|
|
9737
9775
|
console: originalConsole
|
|
9738
9776
|
});
|
|
9739
9777
|
ctx.timer.start("client-deps-scan");
|
|
9740
|
-
const { clientOptimizeDepsEntries, skipUseServerScanPlugin } = await import("./_chunks/client-dep-entries-
|
|
9778
|
+
const { clientOptimizeDepsEntries, skipUseServerScanPlugin } = await import("./_chunks/client-dep-entries-CP7AkMCM.js");
|
|
9741
9779
|
const entries = await clientOptimizeDepsEntries(resolvedRoot, BROWSER_ENTRY_FILE, buildDir);
|
|
9742
9780
|
ctx.timer.end("client-deps-scan");
|
|
9743
9781
|
return {
|
|
@@ -9808,7 +9846,6 @@ function timber(config) {
|
|
|
9808
9846
|
timberDevServer(ctx)
|
|
9809
9847
|
];
|
|
9810
9848
|
}
|
|
9811
|
-
//#endregion
|
|
9812
9849
|
export { timber as default, timber, defineConfig };
|
|
9813
9850
|
|
|
9814
9851
|
//# sourceMappingURL=index.js.map
|