@velastack/patterns 0.13.0 → 0.13.1
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/dist/chunks/{_layout-DQhSAhfF.js → _layout-Dju9EYqa.js} +6 -8
- package/dist/chunks/{_layout-DQhSAhfF.js.map → _layout-Dju9EYqa.js.map} +1 -1
- package/dist/chunks/{_page-C7kGoW7_.js → _page-44USwLXO.js} +2 -3
- package/dist/chunks/{_page-C7kGoW7_.js.map → _page-44USwLXO.js.map} +1 -1
- package/dist/chunks/{_page-DoPdZgZv.js → _page-Bt37d4uo.js} +2 -3
- package/dist/chunks/_page-Bt37d4uo.js.map +1 -0
- package/dist/chunks/{_page-B6yd6_Vl.js → _page-DcbEFpyw.js} +2 -3
- package/dist/chunks/_page-DcbEFpyw.js.map +1 -0
- package/dist/chunks/{auth-pages-jsyDV1GR.js → auth-pages-BW3_yluN.js} +6 -9
- package/dist/chunks/{auth-pages-jsyDV1GR.js.map → auth-pages-BW3_yluN.js.map} +1 -1
- package/dist/chunks/{collections-DZOuRpvS.js → collections-CFW9ZqUE.js} +5 -7
- package/dist/chunks/{collections-DZOuRpvS.js.map → collections-CFW9ZqUE.js.map} +1 -1
- package/dist/chunks/{collections-zEoRuILr.js → collections-D-xbHi4M.js} +39 -45
- package/dist/chunks/{collections-zEoRuILr.js.map → collections-D-xbHi4M.js.map} +1 -1
- package/dist/chunks/{compose-handle-BBlamPfx.js → compose-handle-Da7m6lV_.js} +3 -4
- package/dist/chunks/{compose-handle-BBlamPfx.js.map → compose-handle-Da7m6lV_.js.map} +1 -1
- package/dist/chunks/{config-target-BgyFkbFL.js → config-target-DJbVHwHl.js} +3 -4
- package/dist/chunks/{config-target-BgyFkbFL.js.map → config-target-DJbVHwHl.js.map} +1 -1
- package/dist/chunks/{constants-CUv536Rj.js → constants-DpK-r_m5.js} +2 -4
- package/dist/chunks/{constants-CUv536Rj.js.map → constants-DpK-r_m5.js.map} +1 -1
- package/dist/chunks/{currency.server-DygAf6a1.js → currency.server-BwuXG0a9.js} +9 -11
- package/dist/chunks/{currency.server-DygAf6a1.js.map → currency.server-BwuXG0a9.js.map} +1 -1
- package/dist/chunks/{dedent-Gq6Krl4n.js → dedent-CCUOcPFW.js} +2 -3
- package/dist/chunks/{dedent-Gq6Krl4n.js.map → dedent-CCUOcPFW.js.map} +1 -1
- package/dist/chunks/{dispatch-BIvOwbKN.js → dispatch-BxlKS_5v.js} +2 -3
- package/dist/chunks/{dispatch-BIvOwbKN.js.map → dispatch-BxlKS_5v.js.map} +1 -1
- package/dist/chunks/{env-BugddEjd.js → env-AxyRWcC_.js} +2 -3
- package/dist/chunks/{env-BugddEjd.js.map → env-AxyRWcC_.js.map} +1 -1
- package/dist/chunks/{env-vars-mnRA0hOe.js → env-vars-CUh4mLM_.js} +2 -3
- package/dist/chunks/{env-vars-mnRA0hOe.js.map → env-vars-CUh4mLM_.js.map} +1 -1
- package/dist/chunks/{env-vars-XvAeH6u5.js → env-vars-CVn2076k.js} +58 -59
- package/dist/chunks/{env-vars-XvAeH6u5.js.map → env-vars-CVn2076k.js.map} +1 -1
- package/dist/chunks/{env-vars-Cr4lbMD_.js → env-vars-T3_7JNSg.js} +3 -4
- package/dist/chunks/{env-vars-Cr4lbMD_.js.map → env-vars-T3_7JNSg.js.map} +1 -1
- package/dist/chunks/{env-vars-file-B_6esJW3.js → env-vars-file-B2zHQZqO.js} +2 -3
- package/dist/chunks/{env-vars-file-B_6esJW3.js.map → env-vars-file-B2zHQZqO.js.map} +1 -1
- package/dist/chunks/{env.preview-uMRKT5Pc.js → env.preview-C676UTOP.js} +2 -3
- package/dist/chunks/{env.preview-uMRKT5Pc.js.map → env.preview-C676UTOP.js.map} +1 -1
- package/dist/chunks/{errors-DR3gF_7a.js → errors-DdSUZI8f.js} +2 -3
- package/dist/chunks/{errors-DR3gF_7a.js.map → errors-DdSUZI8f.js.map} +1 -1
- package/dist/chunks/{format-result-BVoLVknk.js → format-result-CojavkIZ.js} +2 -3
- package/dist/chunks/{format-result-BVoLVknk.js.map → format-result-CojavkIZ.js.map} +1 -1
- package/dist/chunks/{generate-Cbg-Z3sA.js → generate-BCYvhyF9.js} +62 -63
- package/dist/chunks/{generate-Cbg-Z3sA.js.map → generate-BCYvhyF9.js.map} +1 -1
- package/dist/chunks/{generate-DyV5R8NP.js → generate-CKuUg3p-.js} +3 -4
- package/dist/chunks/{generate-DyV5R8NP.js.map → generate-CKuUg3p-.js.map} +1 -1
- package/dist/chunks/{generate-DjuhSibA.js → generate-CY_Ii_bz.js} +61 -64
- package/dist/chunks/{generate-DjuhSibA.js.map → generate-CY_Ii_bz.js.map} +1 -1
- package/dist/chunks/generate-CuOm66dn.js +57 -0
- package/dist/chunks/{generate-BtWZCvuO.js.map → generate-CuOm66dn.js.map} +1 -1
- package/dist/chunks/{generate-BrOPb9tW.js → generate-DYq5Oj58.js} +3 -4
- package/dist/chunks/{generate-BrOPb9tW.js.map → generate-DYq5Oj58.js.map} +1 -1
- package/dist/chunks/{generate-Crdzw45a.js → generate-F4FDWvFo.js} +13 -14
- package/dist/chunks/{generate-Crdzw45a.js.map → generate-F4FDWvFo.js.map} +1 -1
- package/dist/chunks/{generate-DgZhFNjO.js → generate-oZ1QeqPr.js} +17 -19
- package/dist/chunks/{generate-DgZhFNjO.js.map → generate-oZ1QeqPr.js.map} +1 -1
- package/dist/chunks/{generate.runtime-ByC9kOl2.js → generate.runtime-22jW8aVT.js} +37 -41
- package/dist/chunks/{generate.runtime-ByC9kOl2.js.map → generate.runtime-22jW8aVT.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BfQlxsWK.js → generate.runtime-B06rPt_j.js} +103 -108
- package/dist/chunks/{generate.runtime-BfQlxsWK.js.map → generate.runtime-B06rPt_j.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CEd3qCtW.js → generate.runtime-BEmSIAop.js} +44 -47
- package/dist/chunks/generate.runtime-BEmSIAop.js.map +1 -0
- package/dist/chunks/{generate.runtime-DzCVGruq.js → generate.runtime-BgGeOqYG.js} +19 -21
- package/dist/chunks/{generate.runtime-DzCVGruq.js.map → generate.runtime-BgGeOqYG.js.map} +1 -1
- package/dist/chunks/generate.runtime-Bz9z0VPR.js +108 -0
- package/dist/chunks/{generate.runtime-DVUj1LJK.js.map → generate.runtime-Bz9z0VPR.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CHaE6Mm9.js → generate.runtime-C37djibw.js} +25 -27
- package/dist/chunks/{generate.runtime-CHaE6Mm9.js.map → generate.runtime-C37djibw.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BsjcGBme.js → generate.runtime-CM3bj0nP.js} +12 -14
- package/dist/chunks/{generate.runtime-BsjcGBme.js.map → generate.runtime-CM3bj0nP.js.map} +1 -1
- package/dist/chunks/generate.runtime-CMuxVUIY.js +46 -0
- package/dist/chunks/{generate.runtime-BfM3dX_R.js.map → generate.runtime-CMuxVUIY.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DRZDjZqw.js → generate.runtime-CVqPHddZ.js} +44 -46
- package/dist/chunks/generate.runtime-CVqPHddZ.js.map +1 -0
- package/dist/chunks/generate.runtime-Cco2mFW2.js +63 -0
- package/dist/chunks/{generate.runtime-taYl9Tg5.js.map → generate.runtime-Cco2mFW2.js.map} +1 -1
- package/dist/chunks/generate.runtime-Cg-dfN9B.js +48 -0
- package/dist/chunks/{generate.runtime-TKR-qAJM.js.map → generate.runtime-Cg-dfN9B.js.map} +1 -1
- package/dist/chunks/{generate.runtime-C2pIioyZ.js → generate.runtime-Cgam_XCc.js} +47 -50
- package/dist/chunks/{generate.runtime-C2pIioyZ.js.map → generate.runtime-Cgam_XCc.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DqYYJXAz.js → generate.runtime-CjqX4tDg.js} +5 -6
- package/dist/chunks/{generate.runtime-DqYYJXAz.js.map → generate.runtime-CjqX4tDg.js.map} +1 -1
- package/dist/chunks/generate.runtime-Cry-DBNl.js +111 -0
- package/dist/chunks/{generate.runtime-2GD2E1NK.js.map → generate.runtime-Cry-DBNl.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DGmpjkRe.js → generate.runtime-Ct7cG8va.js} +76 -79
- package/dist/chunks/generate.runtime-Ct7cG8va.js.map +1 -0
- package/dist/chunks/generate.runtime-Cxg1b_BK.js +63 -0
- package/dist/chunks/{generate.runtime-CXGiQWDK.js.map → generate.runtime-Cxg1b_BK.js.map} +1 -1
- package/dist/chunks/{generate.runtime-4TxcYKld.js → generate.runtime-CyWuhV6m.js} +16 -18
- package/dist/chunks/{generate.runtime-4TxcYKld.js.map → generate.runtime-CyWuhV6m.js.map} +1 -1
- package/dist/chunks/{generate.runtime-C_5Ghjri.js → generate.runtime-D769VJFt.js} +3 -4
- package/dist/chunks/{generate.runtime-C_5Ghjri.js.map → generate.runtime-D769VJFt.js.map} +1 -1
- package/dist/chunks/{generate.runtime-s9ai7PxV.js → generate.runtime-DGnXHELM.js} +84 -89
- package/dist/chunks/{generate.runtime-s9ai7PxV.js.map → generate.runtime-DGnXHELM.js.map} +1 -1
- package/dist/chunks/{generate.runtime-USnFqTbU.js → generate.runtime-DHJqOJTr.js} +93 -98
- package/dist/chunks/{generate.runtime-USnFqTbU.js.map → generate.runtime-DHJqOJTr.js.map} +1 -1
- package/dist/chunks/{generate.runtime-C9yduilW.js → generate.runtime-DICcLOts.js} +19 -22
- package/dist/chunks/{generate.runtime-C9yduilW.js.map → generate.runtime-DICcLOts.js.map} +1 -1
- package/dist/chunks/generate.runtime-DWHoDisZ.js +42 -0
- package/dist/chunks/{generate.runtime-g6qaIY3k.js.map → generate.runtime-DWHoDisZ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B2DI0x05.js → generate.runtime-DfHFd8xs.js} +36 -44
- package/dist/chunks/{generate.runtime-B2DI0x05.js.map → generate.runtime-DfHFd8xs.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BO1KyRcJ.js → generate.runtime-DhNspd-h.js} +64 -76
- package/dist/chunks/generate.runtime-DhNspd-h.js.map +1 -0
- package/dist/chunks/{generate.runtime-BPVZsAL0.js → generate.runtime-DkS7CBmK.js} +8 -10
- package/dist/chunks/{generate.runtime-BPVZsAL0.js.map → generate.runtime-DkS7CBmK.js.map} +1 -1
- package/dist/chunks/generate.runtime-Dtae524O.js +34 -0
- package/dist/chunks/{generate.runtime-Du8puIJQ.js.map → generate.runtime-Dtae524O.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DIkM5xIB.js → generate.runtime-Dtf3tF3-.js} +82 -92
- package/dist/chunks/generate.runtime-Dtf3tF3-.js.map +1 -0
- package/dist/chunks/{generate.runtime-7sU7RzIA.js → generate.runtime-DvTbN-no.js} +88 -145
- package/dist/chunks/{generate.runtime-7sU7RzIA.js.map → generate.runtime-DvTbN-no.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CvtSK0E1.js → generate.runtime-EB8vpc7D.js} +57 -66
- package/dist/chunks/{generate.runtime-CvtSK0E1.js.map → generate.runtime-EB8vpc7D.js.map} +1 -1
- package/dist/chunks/{generate.runtime-UrLaWKvN.js → generate.runtime-TCVlsBbJ.js} +7 -8
- package/dist/chunks/{generate.runtime-UrLaWKvN.js.map → generate.runtime-TCVlsBbJ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B8y_l-6N.js → generate.runtime-YFyuyFhh.js} +108 -132
- package/dist/chunks/generate.runtime-YFyuyFhh.js.map +1 -0
- package/dist/chunks/{generate.runtime-bWGwyz2U.js → generate.runtime-cYh0CQ5d.js} +36 -41
- package/dist/chunks/{generate.runtime-bWGwyz2U.js.map → generate.runtime-cYh0CQ5d.js.map} +1 -1
- package/dist/chunks/generate.runtime-erWI6j7m.js +64 -0
- package/dist/chunks/{generate.runtime-B-WOQsda.js.map → generate.runtime-erWI6j7m.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DI73x08q.js → generate.runtime-hq8xt0m_.js} +21 -23
- package/dist/chunks/generate.runtime-hq8xt0m_.js.map +1 -0
- package/dist/chunks/{generate.runtime-C4hyve9h.js → generate.runtime-i3tMIA1A.js} +85 -108
- package/dist/chunks/{generate.runtime-C4hyve9h.js.map → generate.runtime-i3tMIA1A.js.map} +1 -1
- package/dist/chunks/generate.runtime-j_5K3Uue.js +120 -0
- package/dist/chunks/generate.runtime-j_5K3Uue.js.map +1 -0
- package/dist/chunks/{generate.runtime-BEvi6bml.js → generate.runtime-mE0knt2T.js} +34 -38
- package/dist/chunks/{generate.runtime-BEvi6bml.js.map → generate.runtime-mE0knt2T.js.map} +1 -1
- package/dist/chunks/{layout.svelte-Cb12mxua.js → layout.svelte-B6wOQ7SM.js} +10 -11
- package/dist/chunks/{layout.svelte-Cb12mxua.js.map → layout.svelte-B6wOQ7SM.js.map} +1 -1
- package/dist/chunks/{lib-specifier-Cngo1zF_.js → lib-specifier-C3M0WTev.js} +2 -3
- package/dist/chunks/{lib-specifier-Cngo1zF_.js.map → lib-specifier-C3M0WTev.js.map} +1 -1
- package/dist/chunks/{load-function-Dmkhg1pQ.js → load-function-BFvIVsh7.js} +3 -4
- package/dist/chunks/{load-function-Dmkhg1pQ.js.map → load-function-BFvIVsh7.js.map} +1 -1
- package/dist/chunks/{logger-CQONztPm.js → logger-t1HxmpG2.js} +2 -3
- package/dist/chunks/{logger-CQONztPm.js.map → logger-t1HxmpG2.js.map} +1 -1
- package/dist/chunks/{modify-file-D9U2LXEa.js → modify-file-CRZ_gMg0.js} +7 -10
- package/dist/chunks/{modify-file-D9U2LXEa.js.map → modify-file-CRZ_gMg0.js.map} +1 -1
- package/dist/chunks/{modify-nav-user-CJ1LevSU.js → modify-nav-user--7OwY9fI.js} +7 -16
- package/dist/chunks/{modify-nav-user-CJ1LevSU.js.map → modify-nav-user--7OwY9fI.js.map} +1 -1
- package/dist/chunks/{modify-nav-user-iUpv2lm-.js → modify-nav-user-D42kWyU6.js} +8 -14
- package/dist/chunks/{modify-nav-user-iUpv2lm-.js.map → modify-nav-user-D42kWyU6.js.map} +1 -1
- package/dist/chunks/modify-svelte-config-remote-wE5K2bU_.js +20 -0
- package/dist/chunks/{modify-svelte-config-remote-CEyYydL7.js.map → modify-svelte-config-remote-wE5K2bU_.js.map} +1 -1
- package/dist/chunks/{modify-user-signup-DLtopazD.js → modify-user-signup-ENhadGKH.js} +5 -6
- package/dist/chunks/{modify-user-signup-DLtopazD.js.map → modify-user-signup-ENhadGKH.js.map} +1 -1
- package/dist/chunks/{modify-utils-Cw-on_cL.js → modify-utils--zro3IGe.js} +3 -4
- package/dist/chunks/{modify-utils-Cw-on_cL.js.map → modify-utils--zro3IGe.js.map} +1 -1
- package/dist/chunks/{package-imports-B9Asv3ZH.js → package-imports-CcIIHbp5.js} +3 -4
- package/dist/chunks/{package-imports-B9Asv3ZH.js.map → package-imports-CcIIHbp5.js.map} +1 -1
- package/dist/chunks/{pocketbase-C5GS-Dh5.js → pocketbase-CvsJYXj-.js} +2 -3
- package/dist/chunks/{pocketbase-C5GS-Dh5.js.map → pocketbase-CvsJYXj-.js.map} +1 -1
- package/dist/chunks/{pocketbase-DpudAAmd.js → pocketbase-YG9yht8R.js} +2 -3
- package/dist/chunks/{pocketbase-DpudAAmd.js.map → pocketbase-YG9yht8R.js.map} +1 -1
- package/dist/chunks/{pocketbase-BTR3gI8o.js → pocketbase-gUn2UrDd.js} +6 -14
- package/dist/chunks/{pocketbase-BTR3gI8o.js.map → pocketbase-gUn2UrDd.js.map} +1 -1
- package/dist/chunks/{providers-CpRRQdMg.js → providers-BB3Z2TrN.js} +4 -5
- package/dist/chunks/{providers-CpRRQdMg.js.map → providers-BB3Z2TrN.js.map} +1 -1
- package/dist/chunks/{providers-CL9kQ4hp.js → providers-tjlFH5di.js} +4 -5
- package/dist/chunks/{providers-CL9kQ4hp.js.map → providers-tjlFH5di.js.map} +1 -1
- package/dist/chunks/{rolldown-runtime-5HNE8Q1r.js → rolldown-runtime-CwxnZyOB.js} +1 -2
- package/dist/chunks/{root-layout.svelte-CUVbnlX-.js → root-layout.svelte-DE0c_y-T.js} +12 -16
- package/dist/chunks/{root-layout.svelte-CUVbnlX-.js.map → root-layout.svelte-DE0c_y-T.js.map} +1 -1
- package/dist/chunks/{shared-CAjLx_8Z.js → shared-DE-J_b1j.js} +4 -5
- package/dist/chunks/{shared-CAjLx_8Z.js.map → shared-DE-J_b1j.js.map} +1 -1
- package/dist/chunks/{site-D0IuWkAR.js → site-B9hDxucR.js} +11 -12
- package/dist/chunks/{site-D0IuWkAR.js.map → site-B9hDxucR.js.map} +1 -1
- package/dist/chunks/{stripe-customer-B3tP8gtD.js → stripe-customer-5S-nOXP1.js} +2 -3
- package/dist/chunks/stripe-customer-5S-nOXP1.js.map +1 -0
- package/dist/chunks/{svelte-file-Dv5-bl79.js → svelte-file-DfplF3BU.js} +2 -3
- package/dist/chunks/{svelte-file-Dv5-bl79.js.map → svelte-file-DfplF3BU.js.map} +1 -1
- package/dist/chunks/{table-core-BKBoEStB.js → table-core-BXmnfjln.js} +26 -33
- package/dist/chunks/{table-core-BKBoEStB.js.map → table-core-BXmnfjln.js.map} +1 -1
- package/dist/chunks/{taggedTemplateLiteral-KSUnuvOk.js → taggedTemplateLiteral-CLenToGE.js} +1 -2
- package/dist/chunks/{test-setup-CbCXmPkE.js → test-setup-CbwhAJT4.js} +8 -11
- package/dist/chunks/{test-setup-CbCXmPkE.js.map → test-setup-CbwhAJT4.js.map} +1 -1
- package/dist/chunks/{ts-morph-helpers-CHI9wAil.js → ts-morph-helpers-B4KZXP44.js} +2 -3
- package/dist/chunks/{ts-morph-helpers-CHI9wAil.js.map → ts-morph-helpers-B4KZXP44.js.map} +1 -1
- package/dist/chunks/{ui-B3Db8cQg.js → ui-Ct6YQuPw.js} +53 -55
- package/dist/chunks/{ui-B3Db8cQg.js.map → ui-Ct6YQuPw.js.map} +1 -1
- package/dist/chunks/{ui-DD4NltyN.js → ui-D5xgIDR_.js} +3 -4
- package/dist/chunks/{ui-DD4NltyN.js.map → ui-D5xgIDR_.js.map} +1 -1
- package/dist/chunks/{unmodify-load-Buak-r1f.js → unmodify-load-CdWXJ_Ac.js} +3 -4
- package/dist/chunks/{unmodify-load-Buak-r1f.js.map → unmodify-load-CdWXJ_Ac.js.map} +1 -1
- package/dist/chunks/{util-BLYliuUK.js → util-ILWdjRAd.js} +2 -3
- package/dist/chunks/{util-BLYliuUK.js.map → util-ILWdjRAd.js.map} +1 -1
- package/dist/chunks/{whatsapp-Pya8Zi07.js → whatsapp-Bt4o4_q2.js} +3 -4
- package/dist/chunks/{whatsapp-Pya8Zi07.js.map → whatsapp-Bt4o4_q2.js.map} +1 -1
- package/dist/chunks/write-result-B5KFCqxw.js +487 -0
- package/dist/chunks/{write-result-BWXq9RRn.js.map → write-result-B5KFCqxw.js.map} +1 -1
- package/dist/chunks/{wuchale-config-c3Q4JVSF.js → wuchale-config-CNXoq4rc.js} +2 -3
- package/dist/chunks/{wuchale-config-c3Q4JVSF.js.map → wuchale-config-CNXoq4rc.js.map} +1 -1
- package/dist/index.js +1375 -1456
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/_page-B6yd6_Vl.js.map +0 -1
- package/dist/chunks/_page-DoPdZgZv.js.map +0 -1
- package/dist/chunks/generate-BtWZCvuO.js +0 -58
- package/dist/chunks/generate.runtime-2GD2E1NK.js +0 -114
- package/dist/chunks/generate.runtime-B-WOQsda.js +0 -67
- package/dist/chunks/generate.runtime-B8y_l-6N.js.map +0 -1
- package/dist/chunks/generate.runtime-BO1KyRcJ.js.map +0 -1
- package/dist/chunks/generate.runtime-BfM3dX_R.js +0 -48
- package/dist/chunks/generate.runtime-CEd3qCtW.js.map +0 -1
- package/dist/chunks/generate.runtime-CXGiQWDK.js +0 -64
- package/dist/chunks/generate.runtime-DGmpjkRe.js.map +0 -1
- package/dist/chunks/generate.runtime-DI73x08q.js.map +0 -1
- package/dist/chunks/generate.runtime-DIkM5xIB.js.map +0 -1
- package/dist/chunks/generate.runtime-DRZDjZqw.js.map +0 -1
- package/dist/chunks/generate.runtime-DVUj1LJK.js +0 -112
- package/dist/chunks/generate.runtime-Deg1Tz9u.js +0 -124
- package/dist/chunks/generate.runtime-Deg1Tz9u.js.map +0 -1
- package/dist/chunks/generate.runtime-Du8puIJQ.js +0 -35
- package/dist/chunks/generate.runtime-TKR-qAJM.js +0 -50
- package/dist/chunks/generate.runtime-g6qaIY3k.js +0 -43
- package/dist/chunks/generate.runtime-taYl9Tg5.js +0 -65
- package/dist/chunks/modify-svelte-config-remote-CEyYydL7.js +0 -42
- package/dist/chunks/stripe-customer-B3tP8gtD.js.map +0 -1
- package/dist/chunks/write-result-BWXq9RRn.js +0 -499
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as s } from "./shared-
|
|
4
|
-
|
|
1
|
+
import { a as e, c as t, n, o as r, r as i, s as a } from "./generate-CKuUg3p-.js";
|
|
2
|
+
import { t as o } from "./providers-tjlFH5di.js";
|
|
3
|
+
import { n as s } from "./shared-DE-J_b1j.js";
|
|
4
|
+
// src/patterns/disable/analytics/generate.ts
|
|
5
5
|
var c = /* #__PURE__ */ Object.assign({
|
|
6
|
-
"../../enable/analytics/providers/google/src/lib/components/analytics/analytics.svelte":
|
|
7
|
-
"../../enable/analytics/providers/google/src/lib/components/analytics/gtag.ts":
|
|
8
|
-
"../../enable/analytics/providers/plausible/src/lib/components/analytics/analytics.svelte":
|
|
9
|
-
"../../enable/analytics/providers/posthog/src/lib/components/analytics/analytics.svelte":
|
|
6
|
+
"../../enable/analytics/providers/google/src/lib/components/analytics/analytics.svelte": t,
|
|
7
|
+
"../../enable/analytics/providers/google/src/lib/components/analytics/gtag.ts": a,
|
|
8
|
+
"../../enable/analytics/providers/plausible/src/lib/components/analytics/analytics.svelte": r,
|
|
9
|
+
"../../enable/analytics/providers/posthog/src/lib/components/analytics/analytics.svelte": e
|
|
10
10
|
});
|
|
11
11
|
function l() {
|
|
12
|
-
return
|
|
12
|
+
return n.flatMap((e) => i(e));
|
|
13
13
|
}
|
|
14
14
|
function u() {
|
|
15
|
-
return
|
|
15
|
+
return n.flatMap((e) => (e.env ?? []).map((e) => e.key));
|
|
16
16
|
}
|
|
17
|
-
async function d(
|
|
17
|
+
async function d(e) {
|
|
18
18
|
return {
|
|
19
19
|
creates: [],
|
|
20
20
|
modifies: [],
|
|
21
|
-
deletes:
|
|
21
|
+
deletes: o(c).map(s),
|
|
22
22
|
components: [],
|
|
23
23
|
packages: [],
|
|
24
24
|
uninstalls: ["posthog-js"],
|
|
@@ -27,7 +27,6 @@ async function d(t) {
|
|
|
27
27
|
collectionDrops: []
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
//#endregion
|
|
31
30
|
export { u as n, d as r, l as t };
|
|
32
31
|
|
|
33
|
-
//# sourceMappingURL=generate-
|
|
32
|
+
//# sourceMappingURL=generate-F4FDWvFo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-
|
|
1
|
+
{"version":3,"file":"generate-F4FDWvFo.js","names":["__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","analytics_default$2","analytics_default","analytics_default$1","envEditsFor","gtag_default","allProviderPaths","toDeleteEntry","providersRaw","allEnvEdits","PROVIDERS","provider","allEnvNames","variable","generate"],"sources":["../../src/patterns/disable/analytics/generate.ts"],"sourcesContent":["import type { Options, Result } from \"../../../core/types\";\nimport type { EnvEdit } from \"../../../runtime/env\";\nimport { allProviderPaths } from \"../../../core/providers\";\nimport { toDeleteEntry } from \"../../destroy/shared\";\nimport { envEditsFor, PROVIDERS } from \"../../enable/analytics/generate\";\n\nconst providersRaw = import.meta.glob<string>(\n \"../../enable/analytics/providers/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\n/**\n * The `.env` lines every provider writes. The project only has one set, but\n * which one is not recorded anywhere, so all are removed; keys that are not\n * there are skipped.\n */\nexport function allEnvEdits(): EnvEdit[] {\n return PROVIDERS.flatMap((provider) => envEditsFor(provider));\n}\n\n/** Every provider's env var names, as `src/env.ts` declares them. */\nexport function allEnvNames(): string[] {\n return PROVIDERS.flatMap((provider) =>\n (provider.env ?? []).map((variable) => variable.key),\n );\n}\n\nexport async function generate(_options: Options) {\n return {\n creates: [],\n modifies: [],\n // Every provider's files: missing ones are skipped, and the emptied\n // components/analytics directory goes with them.\n deletes: allProviderPaths(providersRaw).map(toDeleteEntry),\n components: [],\n packages: [],\n // PostHog's SDK; the other providers load a script and install nothing.\n uninstalls: [\"posthog-js\"],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;AAMA,IAAMW,IAAe,uBAAA,OAAA;CAAA,yFAAAX;CAAA,gFAAAC;CAAA,4FAAAC;CAAA,0FAAAC;AAGrB,CAAA;AAOA,SAAgBS,IAAyB;CACvC,OAAOC,EAAU,SAAS,MAAaN,EAAYO,CAAQ,CAAC;AAC9D;AAGA,SAAgBC,IAAwB;CACtC,OAAOF,EAAU,SAAS,OACvBC,EAAS,OAAO,CAAC,EAAA,CAAG,KAAK,MAAaE,EAAS,GAAG,CACrD;AACF;AAEA,eAAsBC,EAAS,GAAmB;CAChD,OAAO;EACL,SAAS,CAAC;EACV,UAAU,CAAC;EAGX,SAASR,EAAiBE,CAAY,CAAC,CAAC,IAAID,CAAa;EACzD,YAAY,CAAC;EACb,UAAU,CAAC;EAEX,YAAY,CAAC,YAAY;EACzB,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as i } from "./util-
|
|
4
|
-
|
|
5
|
-
//#region src/patterns/enable/cms/generate.ts
|
|
1
|
+
import { E as e, g as t, h as n } from "./constants-DpK-r_m5.js";
|
|
2
|
+
import { t as r } from "./errors-DdSUZI8f.js";
|
|
3
|
+
import { r as i } from "./util-ILWdjRAd.js";
|
|
4
|
+
// src/patterns/enable/cms/generate.ts
|
|
6
5
|
var a = /* #__PURE__ */ Object.assign({
|
|
7
6
|
"./creates-backend/src/lib/server/cms.ts": "import { dataPath } from '@velastack/kit/server';\nimport { createCmsBackend } from '@velastack/cms/backend';\n\n/**\n * The CMS HTTP backend, mounted single-tenant at `/api/cms` by\n * `src/routes/api/cms/[...path]/+server.ts`.\n *\n * Same origin as the site, so there is no CORS to configure and the session\n * cookie is first-party. Editors sign in against the backend's own\n * `cms_editors` table — add one with `vela cms editor add <email>`.\n *\n * `dataPath` reads `VELA_DATA_DIR`, which `vela` sets wherever it runs the\n * app, so the database and uploads live in the data directory that outlives\n * a release rather than inside the build.\n */\nexport const cms = createCmsBackend({\n dbPath: dataPath('cms.sqlite'),\n uploadDir: dataPath('uploads')\n});\n",
|
|
8
7
|
"./creates-backend/src/routes/api/cms/[...path]/+server.ts": "import { cms } from '#lib/server/cms.js';\n\n// `fallback` catches every method, including OPTIONS. The backend does its own\n// sub-routing off `params.path`, so a new endpoint never touches this file.\nexport const prerender = false;\nexport const fallback = cms.handler;\n",
|
|
@@ -15,16 +14,16 @@ function l(e) {
|
|
|
15
14
|
if (n.startsWith("--endpoint=")) return n.slice(11);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
|
-
function u(
|
|
19
|
-
let
|
|
20
|
-
if (
|
|
21
|
-
if (!/^https?:\/\/\S+$/.test(
|
|
17
|
+
function u(e) {
|
|
18
|
+
let t = (typeof e.input.endpoint == "string" ? e.input.endpoint : l(e.argv))?.trim().replace(/\/+$/, "");
|
|
19
|
+
if (t) {
|
|
20
|
+
if (!/^https?:\/\/\S+$/.test(t)) throw new r(`--endpoint must be the absolute URL of a hosted CMS, like ${c}; got ${t}`);
|
|
22
21
|
return {
|
|
23
|
-
endpoint:
|
|
22
|
+
endpoint: t,
|
|
24
23
|
local: !1
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
|
-
if (!(
|
|
26
|
+
if (!(e.input.server ?? e.features.backend)) throw new r(`This site has no server to host the CMS backend. Point it at a hosted CMS instead: vela enable cms --endpoint ${c}`);
|
|
28
27
|
return {
|
|
29
28
|
endpoint: s,
|
|
30
29
|
local: !0
|
|
@@ -63,12 +62,12 @@ function d(e, t) {
|
|
|
63
62
|
""
|
|
64
63
|
].join("\n");
|
|
65
64
|
}
|
|
66
|
-
async function f(
|
|
67
|
-
let s = u(
|
|
65
|
+
async function f(r) {
|
|
66
|
+
let s = u(r), c = {};
|
|
68
67
|
return s.local && Object.assign(c, i(a, o)), c["src/lib/cms.ts"] = {
|
|
69
68
|
path: "src/lib/cms.ts",
|
|
70
69
|
language: "ts",
|
|
71
|
-
content: d(s,
|
|
70
|
+
content: d(s, r.features.i18n),
|
|
72
71
|
status: "success"
|
|
73
72
|
}, {
|
|
74
73
|
creates: Object.values(c).sort((e, t) => e.path.localeCompare(t.path)),
|
|
@@ -76,17 +75,16 @@ async function f(e) {
|
|
|
76
75
|
deletes: [],
|
|
77
76
|
components: [],
|
|
78
77
|
packages: s.local ? [
|
|
79
|
-
r,
|
|
80
78
|
n,
|
|
79
|
+
t,
|
|
81
80
|
"better-sqlite3",
|
|
82
|
-
|
|
83
|
-
] : [
|
|
81
|
+
e("marked")
|
|
82
|
+
] : [n, e("marked")],
|
|
84
83
|
collections: [],
|
|
85
84
|
collectionPatches: [],
|
|
86
85
|
collectionDrops: []
|
|
87
86
|
};
|
|
88
87
|
}
|
|
89
|
-
//#endregion
|
|
90
88
|
export { u as n, f as t };
|
|
91
89
|
|
|
92
|
-
//# sourceMappingURL=generate-
|
|
90
|
+
//# sourceMappingURL=generate-oZ1QeqPr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-
|
|
1
|
+
{"version":3,"file":"generate-oZ1QeqPr.js","names":["__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","spec","VELASTACK_KIT","VELASTACK_CMS","InvalidArgumentError","filesFromGlob","backendRaw","BACKEND_PREFIX","LOCAL_ENDPOINT","ENDPOINT_EXAMPLE","endpointFromArgv","i","argv","arg","resolveMode","endpoint","options","cmsLibSource","imports","i18n","where","mode","which","generate","creates","a","b"],"sources":["../../src/patterns/enable/cms/generate.ts"],"sourcesContent":["import type { File, Options, Result } from \"../../../core/types\";\nimport { VELASTACK_CMS, VELASTACK_KIT } from \"../../../core/constants\";\nimport { spec } from \"../../../core/versions\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { filesFromGlob } from \"../../../core/util\";\n\n// The backend, for an app that hosts the CMS itself: the SQLite-backed HTTP\n// API and the two routes that mount it and serve uploads.\nconst backendRaw = import.meta.glob<string>(\"./creates-backend/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst BACKEND_PREFIX = \"./creates-backend/\";\n\n/** Where an app that hosts the backend itself mounts it. Also the admin bar's default. */\nexport const LOCAL_ENDPOINT = \"/api/cms\";\n\nexport const ENDPOINT_EXAMPLE =\n \"https://velastack.dev/v1/projects/<project>/cms\";\n\nexport interface CmsMode {\n /** What the read path and the admin bar talk to. */\n endpoint: string;\n /** Whether this app hosts the backend at `endpoint` itself. */\n local: boolean;\n}\n\n/** `--endpoint <url>` or `--endpoint=<url>`, for callers that hand flags through in argv. */\nfunction endpointFromArgv(argv: string[]): string | undefined {\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg === \"--endpoint\") return argv[i + 1];\n if (arg.startsWith(\"--endpoint=\")) return arg.slice(\"--endpoint=\".length);\n }\n return undefined;\n}\n\n/**\n * Which of the two shapes to produce.\n *\n * An explicit `--endpoint` means a hosted CMS: the app only reads from it and\n * the admin bar signs in there, so no backend is installed. Without one, an\n * app with a server hosts the backend itself at `/api/cms`. A static site has\n * no server to host it, so there the endpoint is required.\n */\nexport function resolveMode(options: Options): CmsMode {\n const raw =\n typeof options.input.endpoint === \"string\"\n ? options.input.endpoint\n : endpointFromArgv(options.argv);\n const endpoint = raw?.trim().replace(/\\/+$/, \"\");\n\n if (endpoint) {\n if (!/^https?:\\/\\/\\S+$/.test(endpoint)) {\n throw new InvalidArgumentError(\n `--endpoint must be the absolute URL of a hosted CMS, like ${ENDPOINT_EXAMPLE}; got ${endpoint}`,\n );\n }\n return { endpoint, local: false };\n }\n\n // A PocketBase backend implies a Node server, but it is not the only way to\n // have one: a project on adapter-node alone can host the SQLite backend too.\n // The caller detects that and says so with `input.server`.\n if (!(options.input.server ?? options.features.backend)) {\n throw new InvalidArgumentError(\n \"This site has no server to host the CMS backend. \" +\n `Point it at a hosted CMS instead: vela enable cms --endpoint ${ENDPOINT_EXAMPLE}`,\n );\n }\n\n return { endpoint: LOCAL_ENDPOINT, local: true };\n}\n\n/** `src/lib/cms.ts`: the read path, with the endpoint and locales bound. */\nfunction cmsLibSource(mode: CmsMode, i18n: boolean): string {\n const imports = [\n \"import { apiAdapter, createCms } from '@velastack/cms/server';\",\n ];\n if (i18n) imports.push(\"import { locales } from '#locales/data.js';\");\n\n const where = mode.local\n ? [\n \" * `/api/cms` is where `src/routes/api/cms/[...path]/+server.ts` mounts the\",\n \" * backend. It is also the admin bar's default, so the endpoint is named here\",\n \" * and nowhere else.\",\n ]\n : [\n \" * The CMS is hosted at this endpoint: the app reads published content from\",\n \" * it and the admin bar signs in there. The same URL is given to the `cms()`\",\n \" * plugin in vite.config.ts, which downloads media into the build.\",\n ];\n\n const which = i18n\n ? [\n \" * The locales are the site's own, from wuchale, so the CMS supports exactly\",\n \" * the languages the UI does; the first is the default that a missing\",\n \" * translation falls back to.\",\n ]\n : [\n \" * `locales` lists every locale the site supports; the first is the default\",\n \" * that a missing translation falls back to.\",\n ];\n\n return [\n ...imports,\n \"\",\n \"/**\",\n \" * The CMS read path, called from the root `+layout.server.ts`.\",\n \" *\",\n ...where,\n \" *\",\n ...which,\n \" */\",\n \"export const { load: loadCms, generateEntries } = createCms({\",\n `\\tadapter: apiAdapter({ endpoint: '${mode.endpoint}' }),`,\n `\\tlocales: ${i18n ? \"[...locales]\" : \"['en']\"}`,\n \"});\",\n \"\",\n ].join(\"\\n\");\n}\n\nexport async function generate(options: Options) {\n const mode = resolveMode(options);\n const creates: Record<string, File> = {};\n\n if (mode.local) {\n Object.assign(creates, filesFromGlob(backendRaw, BACKEND_PREFIX));\n }\n\n creates[\"src/lib/cms.ts\"] = {\n path: \"src/lib/cms.ts\",\n language: \"ts\",\n content: cmsLibSource(mode, options.features.i18n),\n status: \"success\",\n };\n\n const sortedCreates = Object.values(creates).sort((a, b) =>\n a.path.localeCompare(b.path),\n );\n\n // better-sqlite3 and marked are the package's optional peers, which npm\n // skips on install precisely because they are optional — so they have to be\n // named here. The backend needs the first; the root entry imports the\n // second statically, so <AdminBar /> cannot render without it.\n // @velastack/cms 0.6 is the SvelteKit 3 line; 0.5 and older peer on Kit 2.\n // The backend's cms.ts resolves its database with `dataPath` from\n // @velastack/kit, which a backend template has and a project on adapter-node\n // alone does not.\n const packages = mode.local\n ? [VELASTACK_CMS, VELASTACK_KIT, \"better-sqlite3\", spec(\"marked\")]\n : [VELASTACK_CMS, spec(\"marked\")];\n\n return {\n creates: sortedCreates,\n modifies: [],\n deletes: [],\n components: [],\n packages,\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;AAQA,IAAMQ,IAAa,uBAAA,OAAA;CAAA,2CAAAR;CAAA,6DAAAC;CAAA,8DAAAC;AAIlB,CAAA,GAEKO,IAAiB,sBAGVC,IAAiB,YAEjBC,IACX;AAUF,SAASC,EAAiB,GAAoC;CAC5D,KAAK,IAAIC,IAAI,GAAGA,IAAIC,EAAK,QAAQ,KAAK;EACpC,IAAMC,IAAMD,EAAKD;EACjB,IAAIE,MAAQ,cAAc,OAAOD,EAAKD,IAAI;EAC1C,IAAIE,EAAI,WAAW,aAAa,GAAG,OAAOA,EAAI,MAAM,EAAoB;CAC1E;AAEF;AAUA,SAAgBC,EAAY,GAA2B;CAKrD,IAAMC,KAHJ,OAAOC,EAAQ,MAAM,YAAa,WAC9BA,EAAQ,MAAM,WACdN,EAAiBM,EAAQ,IAAI,EAAA,EACb,KAAK,CAAC,CAAC,QAAQ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EAAC,IAC/D,CAACE,GAAeF,EAAK,QAAQ,CAAC;EAQhC,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as s } from "./
|
|
1
|
+
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
+
import { r as t } from "./modify-file-CRZ_gMg0.js";
|
|
3
|
+
import { t as n } from "./dedent-CCUOcPFW.js";
|
|
4
|
+
import { t as r } from "./compose-handle-Da7m6lV_.js";
|
|
5
|
+
import { _ as i, o as a, r as o } from "./ts-morph-helpers-B4KZXP44.js";
|
|
6
|
+
import { t as s } from "./svelte-file-DfplF3BU.js";
|
|
7
7
|
import c from "node:fs";
|
|
8
8
|
import l from "node:path";
|
|
9
9
|
import { Project as u, QuoteKind as d, SyntaxKind as f } from "ts-morph";
|
|
10
|
-
|
|
11
|
-
var p =
|
|
10
|
+
// src/patterns/enable/content-negotiation/modifies/hooks.server.ts
|
|
11
|
+
var p = n`
|
|
12
12
|
Wrap your exported handle with the negotiation handler:
|
|
13
13
|
|
|
14
14
|
import { sequence } from '@sveltejs/kit/hooks';
|
|
15
15
|
import { handle as handleNegotiate } from '#lib/negotiate.js';
|
|
16
16
|
|
|
17
17
|
export const handle = sequence(handleNegotiate, /* your existing handle */);
|
|
18
|
-
`, m =
|
|
18
|
+
`, m = n`
|
|
19
19
|
import { handle as handleNegotiate } from '#lib/negotiate.js';
|
|
20
20
|
|
|
21
21
|
export const handle = handleNegotiate;
|
|
@@ -50,21 +50,20 @@ function g(e) {
|
|
|
50
50
|
compilerOptions: { allowJs: !0 },
|
|
51
51
|
manipulationSettings: { quoteKind: d.Single }
|
|
52
52
|
}).addSourceFileAtPath(e);
|
|
53
|
-
return
|
|
53
|
+
return r(n, { expression: "handleNegotiate" }).status === "unsupported" ? {
|
|
54
54
|
status: "failed",
|
|
55
55
|
message: p
|
|
56
|
-
} : (h(n),
|
|
56
|
+
} : (h(n), a(n), n.saveSync(), {
|
|
57
57
|
status: "success",
|
|
58
58
|
changed: n.getFullText() !== t
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var _ = e`
|
|
61
|
+
// src/patterns/enable/content-negotiation/modifies/hooks.ts
|
|
62
|
+
var _ = n`
|
|
64
63
|
import { reroute as negotiateReroute } from '#lib/negotiate.js';
|
|
65
64
|
|
|
66
65
|
export const reroute = ({ url }) => negotiateReroute(url.pathname);
|
|
67
|
-
`, v =
|
|
66
|
+
`, v = n`
|
|
68
67
|
Compose your existing reroute in src/hooks.ts with the negotiation reroute:
|
|
69
68
|
|
|
70
69
|
import { reroute as negotiateReroute } from '#lib/negotiate.js';
|
|
@@ -97,7 +96,7 @@ function b(e) {
|
|
|
97
96
|
compilerOptions: { allowJs: !0 },
|
|
98
97
|
manipulationSettings: { quoteKind: d.Single }
|
|
99
98
|
}).addSourceFileAtPath(e), n = t.getVariableDeclaration("reroute");
|
|
100
|
-
if (!n) return y(t), t.addStatements("\nexport const reroute = ({ url }) => negotiateReroute(url.pathname);\n"),
|
|
99
|
+
if (!n) return y(t), t.addStatements("\nexport const reroute = ({ url }) => negotiateReroute(url.pathname);\n"), a(t), t.saveSync(), {
|
|
101
100
|
status: "success",
|
|
102
101
|
changed: !0
|
|
103
102
|
};
|
|
@@ -105,13 +104,13 @@ function b(e) {
|
|
|
105
104
|
status: "failed",
|
|
106
105
|
message: v
|
|
107
106
|
};
|
|
108
|
-
let
|
|
109
|
-
if (!
|
|
107
|
+
let r = n.getInitializer();
|
|
108
|
+
if (!r) return {
|
|
110
109
|
status: "failed",
|
|
111
110
|
message: v
|
|
112
111
|
};
|
|
113
|
-
let
|
|
114
|
-
return
|
|
112
|
+
let i = t.getVariableDeclarations().some((e) => e.getName() === "rerouteDeLocalize"), o = r.getText();
|
|
113
|
+
return i && o.includes("rerouteDeLocalize") ? (y(t), n.setInitializer("({ url }) => rerouteDeLocalize(negotiateReroute(url.pathname))"), a(t), t.saveSync(), {
|
|
115
114
|
status: "success",
|
|
116
115
|
changed: !0
|
|
117
116
|
}) : {
|
|
@@ -119,9 +118,8 @@ function b(e) {
|
|
|
119
118
|
message: v
|
|
120
119
|
};
|
|
121
120
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
var x = e`
|
|
121
|
+
// src/patterns/enable/content-negotiation/modifies/root-layout.svelte.ts
|
|
122
|
+
var x = n`
|
|
125
123
|
import { Negotiate } from '#lib/negotiate.js';
|
|
126
124
|
`, S = "\n<Negotiate />\n", C = [
|
|
127
125
|
"Create the root +layout.svelte and mount <Negotiate /> inside it.",
|
|
@@ -138,13 +136,13 @@ function w(e) {
|
|
|
138
136
|
status: "not-found",
|
|
139
137
|
message: C
|
|
140
138
|
};
|
|
141
|
-
let t =
|
|
139
|
+
let t = s.fromPath(e);
|
|
142
140
|
return t.hasElement("Negotiate") ? {
|
|
143
141
|
status: "success",
|
|
144
142
|
changed: !1
|
|
145
143
|
} : (t.modifyScript((e) => {
|
|
146
|
-
let { source: t } =
|
|
147
|
-
|
|
144
|
+
let { source: t } = i(e, (e) => {
|
|
145
|
+
o(e, [{
|
|
148
146
|
namedImports: ["Negotiate"],
|
|
149
147
|
moduleSpecifier: "#lib/negotiate.js"
|
|
150
148
|
}]);
|
|
@@ -155,21 +153,20 @@ function w(e) {
|
|
|
155
153
|
changed: t.hasChanged()
|
|
156
154
|
});
|
|
157
155
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
e && r.push(e);
|
|
156
|
+
// src/patterns/enable/content-negotiation/generate.runtime.ts
|
|
157
|
+
async function T(n) {
|
|
158
|
+
let r = e(n), i = [], a = (e) => {
|
|
159
|
+
e && i.push(e);
|
|
163
160
|
};
|
|
164
|
-
|
|
165
|
-
let o = l.join(
|
|
166
|
-
|
|
167
|
-
let s = l.join(
|
|
168
|
-
|
|
169
|
-
let c = l.join(
|
|
170
|
-
return
|
|
161
|
+
r.info("Modifying hooks.server.ts");
|
|
162
|
+
let o = l.join(n.root, "src", "hooks.server.ts");
|
|
163
|
+
a(t(o, g(o))), r.info("Modifying hooks.ts");
|
|
164
|
+
let s = l.join(n.root, "src", "hooks.ts");
|
|
165
|
+
a(t(s, b(s))), r.info("Modifying src/routes/+layout.svelte");
|
|
166
|
+
let c = l.join(n.root, "src", "routes", "+layout.svelte");
|
|
167
|
+
return a(t(c, w(c))), {
|
|
171
168
|
creates: [],
|
|
172
|
-
modifies:
|
|
169
|
+
modifies: i,
|
|
173
170
|
deletes: [],
|
|
174
171
|
components: [],
|
|
175
172
|
packages: [],
|
|
@@ -178,7 +175,6 @@ async function T(e) {
|
|
|
178
175
|
collectionDrops: []
|
|
179
176
|
};
|
|
180
177
|
}
|
|
181
|
-
//#endregion
|
|
182
178
|
export { T as generate };
|
|
183
179
|
|
|
184
|
-
//# sourceMappingURL=generate.runtime-
|
|
180
|
+
//# sourceMappingURL=generate.runtime-22jW8aVT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-ByC9kOl2.js","names":["FAILURE_HINT","dedent","getLogger","withInMemoryScript","formatLikeSource","ensureImports","modifyOutcomeToFile","SvelteFile","addHandle","fs","path","FAILURE_HINT$1","HOOKS_SERVER_SNIPPET","ensureNegotiateHandleImport","existing","sourceFile","d","ni","modifyHooksServerNegotiate","hooksServerPath","original","Project","QuoteKind","NEGOTIATE_ONLY_SNIPPET","FAILURE_HINT","ensureNegotiateImport","modifyHooksNegotiate","hooksPath","rerouteDecl","SyntaxKind","init","hasI18nHelper","initText","IMPORT_SNIPPET","MARKUP_SNIPPET","NOT_FOUND_HINT","modifyRootLayoutNegotiate","layoutPath","file","out","source","sf","generate","logger","options","modifies","pushResult","rootLayoutPath"],"sources":["../../src/patterns/enable/content-negotiation/modifies/hooks.server.ts","../../src/patterns/enable/content-negotiation/modifies/hooks.ts","../../src/patterns/enable/content-negotiation/modifies/root-layout.svelte.ts","../../src/patterns/enable/content-negotiation/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { addHandle } from \"../../../../runtime/compose-handle\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst FAILURE_HINT = dedent`\n Wrap your exported handle with the negotiation handler:\n\n import { sequence } from '@sveltejs/kit/hooks';\n import { handle as handleNegotiate } from '#lib/negotiate.js';\n\n export const handle = sequence(handleNegotiate, /* your existing handle */);\n`;\n\nconst HOOKS_SERVER_SNIPPET = dedent`\n import { handle as handleNegotiate } from '#lib/negotiate.js';\n\n export const handle = handleNegotiate;\n`;\n\nfunction ensureNegotiateHandleImport(sourceFile: SourceFile) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === \"#lib/negotiate.js\");\n if (existing) {\n const has = existing.getNamedImports().some((ni) => {\n return (\n ni.getName() === \"handle\" &&\n ni.getAliasNode()?.getText() === \"handleNegotiate\"\n );\n });\n if (!has)\n existing.addNamedImport({ name: \"handle\", alias: \"handleNegotiate\" });\n return;\n }\n sourceFile.addImportDeclaration({\n namedImports: [{ name: \"handle\", alias: \"handleNegotiate\" }],\n moduleSpecifier: \"#lib/negotiate.js\",\n });\n}\n\nexport function modifyHooksServerNegotiate(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n // SvelteKit loads the first `hooks.server.*` it finds, and `.js` sorts\n // first, so a new `.ts` beside it would never run.\n if (fs.existsSync(hooksServerPath.replace(/\\.ts$/, \".js\"))) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n fs.mkdirSync(path.dirname(hooksServerPath), { recursive: true });\n fs.writeFileSync(hooksServerPath, HOOKS_SERVER_SNIPPET + \"\\n\");\n return { status: \"success\", changed: true };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (original.includes(\"handleNegotiate\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const composed = addHandle(sourceFile, { expression: \"handleNegotiate\" });\n if (composed.status === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n ensureNegotiateHandleImport(sourceFile);\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst NEGOTIATE_ONLY_SNIPPET = dedent`\n import { reroute as negotiateReroute } from '#lib/negotiate.js';\n\n export const reroute = ({ url }) => negotiateReroute(url.pathname);\n`;\n\nconst FAILURE_HINT = dedent`\n Compose your existing reroute in src/hooks.ts with the negotiation reroute:\n\n import { reroute as negotiateReroute } from '#lib/negotiate.js';\n\n export const reroute = ({ url }) => existingReroute(negotiateReroute(url.pathname));\n`;\n\nfunction ensureNegotiateImport(sourceFile: SourceFile) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === \"#lib/negotiate.js\");\n if (existing) {\n const has = existing.getNamedImports().some((ni) => {\n return (\n ni.getName() === \"reroute\" &&\n ni.getAliasNode()?.getText() === \"negotiateReroute\"\n );\n });\n if (!has) {\n existing.addNamedImport({ name: \"reroute\", alias: \"negotiateReroute\" });\n }\n return;\n }\n sourceFile.addImportDeclaration({\n namedImports: [{ name: \"reroute\", alias: \"negotiateReroute\" }],\n moduleSpecifier: \"#lib/negotiate.js\",\n });\n}\n\nexport function modifyHooksNegotiate(hooksPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksPath)) {\n fs.mkdirSync(path.dirname(hooksPath), { recursive: true });\n fs.writeFileSync(hooksPath, NEGOTIATE_ONLY_SNIPPET + \"\\n\");\n return { status: \"success\", changed: true };\n }\n\n const original = fs.readFileSync(hooksPath, \"utf8\");\n if (original.includes(\"negotiateReroute\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksPath);\n\n const rerouteDecl = sourceFile.getVariableDeclaration(\"reroute\");\n\n if (!rerouteDecl) {\n ensureNegotiateImport(sourceFile);\n sourceFile.addStatements(\n `\\nexport const reroute = ({ url }) => negotiateReroute(url.pathname);\\n`,\n );\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n }\n\n const rerouteStmt = rerouteDecl.getFirstAncestorByKind(\n SyntaxKind.VariableStatement,\n );\n if (!rerouteStmt?.hasExportKeyword()) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const init = rerouteDecl.getInitializer();\n if (!init) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const hasI18nHelper = sourceFile\n .getVariableDeclarations()\n .some((d) => d.getName() === \"rerouteDeLocalize\");\n const initText = init.getText();\n\n if (hasI18nHelper && initText.includes(\"rerouteDeLocalize\")) {\n ensureNegotiateImport(sourceFile);\n rerouteDecl.setInitializer(\n \"({ url }) => rerouteDeLocalize(negotiateReroute(url.pathname))\",\n );\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n }\n\n return { status: \"failed\", message: FAILURE_HINT };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureImports,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst IMPORT_SNIPPET = dedent`\n import { Negotiate } from '#lib/negotiate.js';\n`;\n\nconst MARKUP_SNIPPET = \"\\n<Negotiate />\\n\";\n\nconst NOT_FOUND_HINT = [\n \"Create the root +layout.svelte and mount <Negotiate /> inside it.\",\n \"\",\n \"Import for the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup to add at the top level of the layout:\",\n MARKUP_SNIPPET.trim(),\n].join(\"\\n\");\n\nexport function modifyRootLayoutNegotiate(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n if (file.hasElement(\"Negotiate\")) {\n return { status: \"success\", changed: false };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n {\n namedImports: [\"Negotiate\"],\n moduleSpecifier: \"#lib/negotiate.js\",\n },\n ]);\n });\n return out;\n });\n\n file.appendMarkup(MARKUP_SNIPPET);\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyHooksServerNegotiate } from \"./modifies/hooks.server\";\nimport { modifyHooksNegotiate } from \"./modifies/hooks\";\nimport { modifyRootLayoutNegotiate } from \"./modifies/root-layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Modifying hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n pushResult(\n modifyOutcomeToFile(\n hooksServerPath,\n modifyHooksServerNegotiate(hooksServerPath),\n ),\n );\n\n logger.info(\"Modifying hooks.ts\");\n const hooksPath = path.join(options.root, \"src\", \"hooks.ts\");\n pushResult(modifyOutcomeToFile(hooksPath, modifyHooksNegotiate(hooksPath)));\n\n logger.info(\"Modifying src/routes/+layout.svelte\");\n const rootLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n rootLayoutPath,\n modifyRootLayoutNegotiate(rootLayoutPath),\n ),\n );\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;AAQA,IAAMA,IAAe,CAAM;;;;;;;GASrBY,IAAuB,CAAM;;;;;AAMnC,SAASC,EAA4B,GAAwB;CAC3D,IAAMC,IAAWC,EACd,sBAAsB,CAAC,CACvB,MAAM,MAAMC,EAAE,wBAAwB,MAAM,mBAAmB;CAClE,AAAIF,IACUA,EAAS,gBAAgB,CAAC,CAAC,MAAM,MAEzCG,EAAG,QAAQ,MAAM,YACjBA,EAAG,aAAa,CAAC,EAAE,QAAQ,MAAM,iBAGhC,KACHH,EAAS,eAAe;EAAE,MAAM;EAAU,OAAO;CAAkB,CAAC,IAGxEC,EAAW,qBAAqB;EAC9B,cAAc,CAAC;GAAE,MAAM;GAAU,OAAO;EAAkB,CAAC;EAC3D,iBAAiB;CACnB,CAAC;AACH;AAEA,SAAgBG,EACd,GACe;CACf,IAAI,CAACT,EAAG,WAAWU,CAAe,GAQhC,OALIV,EAAG,WAAWU,EAAgB,QAAQ,SAAS,KAAK,CAAC,IAChD;EAAE,QAAQ;EAAU,SAASnB;CAAa,KAEnDS,EAAG,UAAUC,EAAK,QAAQS,CAAe,GAAG,EAAE,WAAW,GAAK,CAAC,GAC/DV,EAAG,cAAcU,GAAiBP,IAAuB,IAAI,GACtD;EAAE,QAAQ;EAAW,SAAS;CAAK;CAG5C,IAAMQ,IAAWX,EAAG,aAAaU,GAAi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andle","withInMemoryScript","formatLikeSource","ensureImports","SvelteFile","fs","path","FAILURE_HINT$1","HOOKS_SERVER_SNIPPET","ensureNegotiateHandleImport","existing","sourceFile","d","ni","modifyHooksServerNegotiate","hooksServerPath","original","Project","QuoteKind","NEGOTIATE_ONLY_SNIPPET","FAILURE_HINT","ensureNegotiateImport","modifyHooksNegotiate","hooksPath","rerouteDecl","SyntaxKind","init","hasI18nHelper","initText","IMPORT_SNIPPET","MARKUP_SNIPPET","NOT_FOUND_HINT","modifyRootLayoutNegotiate","layoutPath","file","out","source","sf","generate","logger","options","modifies","pushResult","rootLayoutPath"],"sources":["../../src/patterns/enable/content-negotiation/modifies/hooks.server.ts","../../src/patterns/enable/content-negotiation/modifies/hooks.ts","../../src/patterns/enable/content-negotiation/modifies/root-layout.svelte.ts","../../src/patterns/enable/content-negotiation/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { addHandle } from \"../../../../runtime/compose-handle\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst FAILURE_HINT = dedent`\n Wrap your exported handle with the negotiation handler:\n\n import { sequence } from '@sveltejs/kit/hooks';\n import { handle as handleNegotiate } from '#lib/negotiate.js';\n\n export const handle = sequence(handleNegotiate, /* your existing handle */);\n`;\n\nconst HOOKS_SERVER_SNIPPET = dedent`\n import { handle as handleNegotiate } from '#lib/negotiate.js';\n\n export const handle = handleNegotiate;\n`;\n\nfunction ensureNegotiateHandleImport(sourceFile: SourceFile) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === \"#lib/negotiate.js\");\n if (existing) {\n const has = existing.getNamedImports().some((ni) => {\n return (\n ni.getName() === \"handle\" &&\n ni.getAliasNode()?.getText() === \"handleNegotiate\"\n );\n });\n if (!has)\n existing.addNamedImport({ name: \"handle\", alias: \"handleNegotiate\" });\n return;\n }\n sourceFile.addImportDeclaration({\n namedImports: [{ name: \"handle\", alias: \"handleNegotiate\" }],\n moduleSpecifier: \"#lib/negotiate.js\",\n });\n}\n\nexport function modifyHooksServerNegotiate(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n // SvelteKit loads the first `hooks.server.*` it finds, and `.js` sorts\n // first, so a new `.ts` beside it would never run.\n if (fs.existsSync(hooksServerPath.replace(/\\.ts$/, \".js\"))) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n fs.mkdirSync(path.dirname(hooksServerPath), { recursive: true });\n fs.writeFileSync(hooksServerPath, HOOKS_SERVER_SNIPPET + \"\\n\");\n return { status: \"success\", changed: true };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (original.includes(\"handleNegotiate\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const composed = addHandle(sourceFile, { expression: \"handleNegotiate\" });\n if (composed.status === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n ensureNegotiateHandleImport(sourceFile);\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst NEGOTIATE_ONLY_SNIPPET = dedent`\n import { reroute as negotiateReroute } from '#lib/negotiate.js';\n\n export const reroute = ({ url }) => negotiateReroute(url.pathname);\n`;\n\nconst FAILURE_HINT = dedent`\n Compose your existing reroute in src/hooks.ts with the negotiation reroute:\n\n import { reroute as negotiateReroute } from '#lib/negotiate.js';\n\n export const reroute = ({ url }) => existingReroute(negotiateReroute(url.pathname));\n`;\n\nfunction ensureNegotiateImport(sourceFile: SourceFile) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === \"#lib/negotiate.js\");\n if (existing) {\n const has = existing.getNamedImports().some((ni) => {\n return (\n ni.getName() === \"reroute\" &&\n ni.getAliasNode()?.getText() === \"negotiateReroute\"\n );\n });\n if (!has) {\n existing.addNamedImport({ name: \"reroute\", alias: \"negotiateReroute\" });\n }\n return;\n }\n sourceFile.addImportDeclaration({\n namedImports: [{ name: \"reroute\", alias: \"negotiateReroute\" }],\n moduleSpecifier: \"#lib/negotiate.js\",\n });\n}\n\nexport function modifyHooksNegotiate(hooksPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksPath)) {\n fs.mkdirSync(path.dirname(hooksPath), { recursive: true });\n fs.writeFileSync(hooksPath, NEGOTIATE_ONLY_SNIPPET + \"\\n\");\n return { status: \"success\", changed: true };\n }\n\n const original = fs.readFileSync(hooksPath, \"utf8\");\n if (original.includes(\"negotiateReroute\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksPath);\n\n const rerouteDecl = sourceFile.getVariableDeclaration(\"reroute\");\n\n if (!rerouteDecl) {\n ensureNegotiateImport(sourceFile);\n sourceFile.addStatements(\n `\\nexport const reroute = ({ url }) => negotiateReroute(url.pathname);\\n`,\n );\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n }\n\n const rerouteStmt = rerouteDecl.getFirstAncestorByKind(\n SyntaxKind.VariableStatement,\n );\n if (!rerouteStmt?.hasExportKeyword()) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const init = rerouteDecl.getInitializer();\n if (!init) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const hasI18nHelper = sourceFile\n .getVariableDeclarations()\n .some((d) => d.getName() === \"rerouteDeLocalize\");\n const initText = init.getText();\n\n if (hasI18nHelper && initText.includes(\"rerouteDeLocalize\")) {\n ensureNegotiateImport(sourceFile);\n rerouteDecl.setInitializer(\n \"({ url }) => rerouteDeLocalize(negotiateReroute(url.pathname))\",\n );\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n }\n\n return { status: \"failed\", message: FAILURE_HINT };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureImports,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst IMPORT_SNIPPET = dedent`\n import { Negotiate } from '#lib/negotiate.js';\n`;\n\nconst MARKUP_SNIPPET = \"\\n<Negotiate />\\n\";\n\nconst NOT_FOUND_HINT = [\n \"Create the root +layout.svelte and mount <Negotiate /> inside it.\",\n \"\",\n \"Import for the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup to add at the top level of the layout:\",\n MARKUP_SNIPPET.trim(),\n].join(\"\\n\");\n\nexport function modifyRootLayoutNegotiate(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n if (file.hasElement(\"Negotiate\")) {\n return { status: \"success\", changed: false };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n {\n namedImports: [\"Negotiate\"],\n moduleSpecifier: \"#lib/negotiate.js\",\n },\n ]);\n });\n return out;\n });\n\n file.appendMarkup(MARKUP_SNIPPET);\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyHooksServerNegotiate } from \"./modifies/hooks.server\";\nimport { modifyHooksNegotiate } from \"./modifies/hooks\";\nimport { modifyRootLayoutNegotiate } from \"./modifies/root-layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Modifying hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n pushResult(\n modifyOutcomeToFile(\n hooksServerPath,\n modifyHooksServerNegotiate(hooksServerPath),\n ),\n );\n\n logger.info(\"Modifying hooks.ts\");\n const hooksPath = path.join(options.root, \"src\", \"hooks.ts\");\n pushResult(modifyOutcomeToFile(hooksPath, modifyHooksNegotiate(hooksPath)));\n\n logger.info(\"Modifying src/routes/+layout.svelte\");\n const rootLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n rootLayoutPath,\n modifyRootLayoutNegotiate(rootLayoutPath),\n ),\n );\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;AAQA,IAAMA,IAAe,CAAM;;;;;;;GASrBY,IAAuB,CAAM;;;;;AAMnC,SAASC,EAA4B,GAAwB;CAC3D,IAAMC,IAAWC,EACd,sBAAsB,CAAC,CACvB,MAAM,MAAMC,EAAE,wBAAwB,MAAM,mBAAmB;CAClE,AAAIF,IACUA,EAAS,gBAAgB,CAAC,CAAC,MAAM,MAEzCG,EAAG,QAAQ,MAAM,YACjBA,EAAG,aAAa,CAAC,EAAE,QAAQ,MAAM,iBAGhC,KACHH,EAAS,eAAe;EAAE,MAAM;EAAU,OAAO;CAAkB,CAAC,IAGxEC,EAAW,qBAAqB;EAC9B,c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