@velastack/patterns 0.12.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/README.md +21 -2
- 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-DzwWwFUQ.js → collections-D-xbHi4M.js} +39 -45
- package/dist/chunks/{collections-DzwWwFUQ.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-DpK-r_m5.js +85 -0
- package/dist/chunks/constants-DpK-r_m5.js.map +1 -0
- package/dist/chunks/{currency.server-CzHS7Svd.js → currency.server-BwuXG0a9.js} +9 -11
- package/dist/chunks/{currency.server-CzHS7Svd.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-CNH-ItSY.js → env-vars-CVn2076k.js} +58 -59
- package/dist/chunks/{env-vars-CNH-ItSY.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-BEc_h7OI.js → generate-BCYvhyF9.js} +62 -63
- package/dist/chunks/{generate-BEc_h7OI.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-CtQcmjPM.js → generate-CY_Ii_bz.js} +79 -82
- package/dist/chunks/generate-CY_Ii_bz.js.map +1 -0
- package/dist/chunks/generate-CuOm66dn.js +57 -0
- package/dist/chunks/{generate-D21dCU-o.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-DiwvSC9c.js → generate-F4FDWvFo.js} +13 -14
- package/dist/chunks/{generate-DiwvSC9c.js.map → generate-F4FDWvFo.js.map} +1 -1
- package/dist/chunks/{generate-C3OaUggX.js → generate-oZ1QeqPr.js} +25 -27
- package/dist/chunks/generate-oZ1QeqPr.js.map +1 -0
- package/dist/chunks/{generate.runtime-DOv-bhM6.js → generate.runtime-22jW8aVT.js} +37 -41
- package/dist/chunks/{generate.runtime-DOv-bhM6.js.map → generate.runtime-22jW8aVT.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CtFCayo8.js → generate.runtime-B06rPt_j.js} +103 -108
- package/dist/chunks/{generate.runtime-CtFCayo8.js.map → generate.runtime-B06rPt_j.js.map} +1 -1
- package/dist/chunks/{generate.runtime-HkvT9gm6.js → generate.runtime-BEmSIAop.js} +44 -47
- package/dist/chunks/generate.runtime-BEmSIAop.js.map +1 -0
- package/dist/chunks/{generate.runtime-DRuPb-67.js → generate.runtime-BgGeOqYG.js} +19 -21
- package/dist/chunks/{generate.runtime-DRuPb-67.js.map → generate.runtime-BgGeOqYG.js.map} +1 -1
- package/dist/chunks/generate.runtime-Bz9z0VPR.js +108 -0
- package/dist/chunks/{generate.runtime-DUBOC6AA.js.map → generate.runtime-Bz9z0VPR.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D34lCyet.js → generate.runtime-C37djibw.js} +25 -27
- package/dist/chunks/{generate.runtime-D34lCyet.js.map → generate.runtime-C37djibw.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Drpy9sWO.js → generate.runtime-CM3bj0nP.js} +12 -14
- package/dist/chunks/{generate.runtime-Drpy9sWO.js.map → generate.runtime-CM3bj0nP.js.map} +1 -1
- package/dist/chunks/generate.runtime-CMuxVUIY.js +46 -0
- package/dist/chunks/{generate.runtime-DVwha8lZ.js.map → generate.runtime-CMuxVUIY.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DlPeHx19.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-CPDJolef.js.map → generate.runtime-Cco2mFW2.js.map} +1 -1
- package/dist/chunks/generate.runtime-Cg-dfN9B.js +48 -0
- package/dist/chunks/{generate.runtime-CAO_SpsA.js.map → generate.runtime-Cg-dfN9B.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Dy9uuf7M.js → generate.runtime-Cgam_XCc.js} +47 -50
- package/dist/chunks/{generate.runtime-Dy9uuf7M.js.map → generate.runtime-Cgam_XCc.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DOWDoe6B.js → generate.runtime-CjqX4tDg.js} +5 -6
- package/dist/chunks/{generate.runtime-DOWDoe6B.js.map → generate.runtime-CjqX4tDg.js.map} +1 -1
- package/dist/chunks/generate.runtime-Cry-DBNl.js +111 -0
- package/dist/chunks/{generate.runtime-CaOO0281.js.map → generate.runtime-Cry-DBNl.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CeoqgxiO.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-DbMDlglD.js.map → generate.runtime-Cxg1b_BK.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CowdMKQs.js → generate.runtime-CyWuhV6m.js} +16 -18
- package/dist/chunks/{generate.runtime-CowdMKQs.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-DroVnvQz.js → generate.runtime-DGnXHELM.js} +84 -89
- package/dist/chunks/{generate.runtime-DroVnvQz.js.map → generate.runtime-DGnXHELM.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CGJ_4VS_.js → generate.runtime-DHJqOJTr.js} +93 -98
- package/dist/chunks/{generate.runtime-CGJ_4VS_.js.map → generate.runtime-DHJqOJTr.js.map} +1 -1
- package/dist/chunks/{generate.runtime-r9Ouwr5B.js → generate.runtime-DICcLOts.js} +19 -22
- package/dist/chunks/{generate.runtime-r9Ouwr5B.js.map → generate.runtime-DICcLOts.js.map} +1 -1
- package/dist/chunks/generate.runtime-DWHoDisZ.js +42 -0
- package/dist/chunks/{generate.runtime-BL62aRng.js.map → generate.runtime-DWHoDisZ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-kEHEiLBL.js → generate.runtime-DfHFd8xs.js} +36 -44
- package/dist/chunks/{generate.runtime-kEHEiLBL.js.map → generate.runtime-DfHFd8xs.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CCE-9xQV.js → generate.runtime-DhNspd-h.js} +64 -76
- package/dist/chunks/generate.runtime-DhNspd-h.js.map +1 -0
- package/dist/chunks/{generate.runtime-D_HYO-mG.js → generate.runtime-DkS7CBmK.js} +8 -10
- package/dist/chunks/{generate.runtime-D_HYO-mG.js.map → generate.runtime-DkS7CBmK.js.map} +1 -1
- package/dist/chunks/generate.runtime-Dtae524O.js +34 -0
- package/dist/chunks/{generate.runtime-C8-mjcn8.js.map → generate.runtime-Dtae524O.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Bx_CaBZD.js → generate.runtime-Dtf3tF3-.js} +82 -92
- package/dist/chunks/generate.runtime-Dtf3tF3-.js.map +1 -0
- package/dist/chunks/{generate.runtime-B3yuIjJD.js → generate.runtime-DvTbN-no.js} +88 -145
- package/dist/chunks/{generate.runtime-B3yuIjJD.js.map → generate.runtime-DvTbN-no.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BK7x32md.js → generate.runtime-EB8vpc7D.js} +57 -66
- package/dist/chunks/{generate.runtime-BK7x32md.js.map → generate.runtime-EB8vpc7D.js.map} +1 -1
- package/dist/chunks/{generate.runtime-sALBNh1T.js → generate.runtime-TCVlsBbJ.js} +7 -8
- package/dist/chunks/{generate.runtime-sALBNh1T.js.map → generate.runtime-TCVlsBbJ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BTHuPon9.js → generate.runtime-YFyuyFhh.js} +108 -132
- package/dist/chunks/generate.runtime-YFyuyFhh.js.map +1 -0
- package/dist/chunks/{generate.runtime-Ce2O5uWy.js → generate.runtime-cYh0CQ5d.js} +36 -41
- package/dist/chunks/{generate.runtime-Ce2O5uWy.js.map → generate.runtime-cYh0CQ5d.js.map} +1 -1
- package/dist/chunks/generate.runtime-erWI6j7m.js +64 -0
- package/dist/chunks/{generate.runtime-BBfiR_Le.js.map → generate.runtime-erWI6j7m.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Brakd35X.js → generate.runtime-hq8xt0m_.js} +21 -23
- package/dist/chunks/generate.runtime-hq8xt0m_.js.map +1 -0
- package/dist/chunks/{generate.runtime--VeSxyIm.js → generate.runtime-i3tMIA1A.js} +85 -108
- package/dist/chunks/{generate.runtime--VeSxyIm.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-DbSRJF-C.js → generate.runtime-mE0knt2T.js} +34 -38
- package/dist/chunks/{generate.runtime-DbSRJF-C.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-DdXJCMHN.js → modify-file-CRZ_gMg0.js} +7 -10
- package/dist/chunks/{modify-file-DdXJCMHN.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-uOpghyT5.js → pocketbase-gUn2UrDd.js} +6 -14
- package/dist/chunks/{pocketbase-uOpghyT5.js.map → pocketbase-gUn2UrDd.js.map} +1 -1
- package/dist/chunks/{providers-ypCW70Mb.js → providers-BB3Z2TrN.js} +4 -5
- package/dist/chunks/{providers-ypCW70Mb.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-DIDAkVts.js → shared-DE-J_b1j.js} +4 -5
- package/dist/chunks/{shared-DIDAkVts.js.map → shared-DE-J_b1j.js.map} +1 -1
- package/dist/chunks/{site-CVtsbO_S.js → site-B9hDxucR.js} +11 -12
- package/dist/chunks/{site-CVtsbO_S.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-BXmnfjln.js +120 -0
- package/dist/chunks/table-core-BXmnfjln.js.map +1 -0
- package/dist/chunks/{taggedTemplateLiteral-KSUnuvOk.js → taggedTemplateLiteral-CLenToGE.js} +1 -2
- package/dist/chunks/{test-setup-B37g3TRn.js → test-setup-CbwhAJT4.js} +8 -11
- package/dist/chunks/{test-setup-B37g3TRn.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-Ct_9B91R.js → ui-Ct6YQuPw.js} +53 -55
- package/dist/chunks/{ui-Ct_9B91R.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-Dr29ohbb.js → whatsapp-Bt4o4_q2.js} +3 -4
- package/dist/chunks/{whatsapp-Dr29ohbb.js.map → whatsapp-Bt4o4_q2.js.map} +1 -1
- package/dist/chunks/write-result-B5KFCqxw.js +487 -0
- package/dist/chunks/{write-result-mtVbmDyQ.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.d.ts +57 -17
- package/dist/index.js +2272 -2350
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
- package/dist/chunks/_page-B6yd6_Vl.js.map +0 -1
- package/dist/chunks/_page-DoPdZgZv.js.map +0 -1
- package/dist/chunks/constants-8cLxGOB0.js +0 -6
- package/dist/chunks/constants-8cLxGOB0.js.map +0 -1
- package/dist/chunks/generate-C3OaUggX.js.map +0 -1
- package/dist/chunks/generate-CtQcmjPM.js.map +0 -1
- package/dist/chunks/generate-D21dCU-o.js +0 -58
- package/dist/chunks/generate.runtime--yCjGZ6-.js +0 -124
- package/dist/chunks/generate.runtime--yCjGZ6-.js.map +0 -1
- package/dist/chunks/generate.runtime-BBfiR_Le.js +0 -67
- package/dist/chunks/generate.runtime-BL62aRng.js +0 -43
- package/dist/chunks/generate.runtime-BTHuPon9.js.map +0 -1
- package/dist/chunks/generate.runtime-Brakd35X.js.map +0 -1
- package/dist/chunks/generate.runtime-Bx_CaBZD.js.map +0 -1
- package/dist/chunks/generate.runtime-C8-mjcn8.js +0 -35
- package/dist/chunks/generate.runtime-CAO_SpsA.js +0 -50
- package/dist/chunks/generate.runtime-CCE-9xQV.js.map +0 -1
- package/dist/chunks/generate.runtime-CPDJolef.js +0 -65
- package/dist/chunks/generate.runtime-CaOO0281.js +0 -114
- package/dist/chunks/generate.runtime-CeoqgxiO.js.map +0 -1
- package/dist/chunks/generate.runtime-DUBOC6AA.js +0 -112
- package/dist/chunks/generate.runtime-DVwha8lZ.js +0 -48
- package/dist/chunks/generate.runtime-DbMDlglD.js +0 -64
- package/dist/chunks/generate.runtime-DlPeHx19.js.map +0 -1
- package/dist/chunks/generate.runtime-HkvT9gm6.js.map +0 -1
- package/dist/chunks/modify-svelte-config-remote-CEyYydL7.js +0 -42
- package/dist/chunks/stripe-customer-B3tP8gtD.js.map +0 -1
- package/dist/chunks/table-core-CUGp4Rf2.js +0 -127
- package/dist/chunks/table-core-CUGp4Rf2.js.map +0 -1
- package/dist/chunks/write-result-mtVbmDyQ.js +0 -499
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as n } from "./
|
|
3
|
-
import { n as r } from "./
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { a as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
1
|
+
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
+
import { a as t, r as n } from "./modify-file-CRZ_gMg0.js";
|
|
3
|
+
import { n as r } from "./shared-DE-J_b1j.js";
|
|
4
|
+
import { n as i } from "./site-B9hDxucR.js";
|
|
5
|
+
import { t as a } from "./dedent-CCUOcPFW.js";
|
|
6
|
+
import { n as o } from "./compose-handle-Da7m6lV_.js";
|
|
7
|
+
import { c as s, m as c, n as l, o as u } from "./ts-morph-helpers-B4KZXP44.js";
|
|
8
|
+
import { r as d, t as f } from "./lib-specifier-C3M0WTev.js";
|
|
9
|
+
import { a as p, l as m, s as h } from "./test-setup-CbwhAJT4.js";
|
|
10
|
+
import { t as g } from "./env-vars-CUh4mLM_.js";
|
|
11
|
+
import { t as _ } from "./env-vars-T3_7JNSg.js";
|
|
12
|
+
import { unmodifyEnvVarsFiles as v } from "./env-vars-CVn2076k.js";
|
|
13
13
|
import y from "node:fs";
|
|
14
14
|
import b from "node:path";
|
|
15
15
|
import { Node as x, Project as S, QuoteKind as C } from "ts-morph";
|
|
16
|
-
|
|
17
|
-
var w =
|
|
16
|
+
// src/patterns/disable/backend/modifies/hooks.server.ts
|
|
17
|
+
var w = a`
|
|
18
18
|
Take handlePocketbase(...) out of the exported handle in src/hooks.server.ts,
|
|
19
19
|
and its imports from '@velastack/pocketbase' and '$app/env/private'.
|
|
20
|
-
`, T =
|
|
20
|
+
`, T = a`
|
|
21
21
|
The workflows are removed with the backend. Take the startWorker() call out
|
|
22
22
|
of the init hook in src/hooks.server.ts, and its import:
|
|
23
23
|
|
|
@@ -26,7 +26,7 @@ var w = n`
|
|
|
26
26
|
"@velastack/pocketbase",
|
|
27
27
|
"$app/env/private",
|
|
28
28
|
"$env/dynamic/private",
|
|
29
|
-
|
|
29
|
+
d("server/workflows"),
|
|
30
30
|
"@sveltejs/kit",
|
|
31
31
|
"@sveltejs/kit/hooks"
|
|
32
32
|
];
|
|
@@ -63,19 +63,18 @@ function A(e) {
|
|
|
63
63
|
status: "failed",
|
|
64
64
|
message: T
|
|
65
65
|
};
|
|
66
|
-
if (
|
|
66
|
+
if (o(n, "handlePocketbase").status === "unsupported") return {
|
|
67
67
|
status: "failed",
|
|
68
68
|
message: w
|
|
69
69
|
};
|
|
70
70
|
let r = k(n);
|
|
71
|
-
return r && r !== "custom" &&
|
|
71
|
+
return r && r !== "custom" && c(n, r), s(n, E), u(n), l(n), n.saveSync(), {
|
|
72
72
|
status: "success",
|
|
73
73
|
changed: n.getFullText() !== t
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var j = n`
|
|
76
|
+
// src/patterns/disable/backend/modifies/layout-server.ts
|
|
77
|
+
var j = a`
|
|
79
78
|
src/routes/+layout.server.ts still reads locals.meta, which only the
|
|
80
79
|
PocketBase hook provides. Read the values from a static module instead:
|
|
81
80
|
|
|
@@ -90,24 +89,23 @@ function M(e) {
|
|
|
90
89
|
status: "success",
|
|
91
90
|
changed: !1
|
|
92
91
|
};
|
|
93
|
-
let
|
|
94
|
-
if (!
|
|
92
|
+
let t = y.readFileSync(e, "utf8");
|
|
93
|
+
if (!t.includes("locals.meta")) return {
|
|
95
94
|
status: "success",
|
|
96
95
|
changed: !1
|
|
97
96
|
};
|
|
98
|
-
let
|
|
99
|
-
if (
|
|
97
|
+
let n = t.replace(/\blocals\.meta\.appName\b/g, "site.name").replace(/\blocals\.meta\.appURL\b/g, "site.url").replace(/\bmeta:\s*locals\.meta\b/g, "meta: { appName: site.name, appURL: site.url }");
|
|
98
|
+
if (n.includes("locals.meta")) return {
|
|
100
99
|
status: "failed",
|
|
101
100
|
message: j
|
|
102
101
|
};
|
|
103
|
-
let
|
|
104
|
-
return /\blocals\b/.test(
|
|
102
|
+
let r = n.replace(/\(\{\s*locals\s*,\s*/g, "({ ").replace(/,\s*locals\s*\}/g, " }");
|
|
103
|
+
return /\blocals\b/.test(r) || (n = r), [...n.matchAll(/from\s+['"]([^'"]+)['"]/g)].some((e) => f(e[1], "site")) || (n = "import { site } from '#lib/site.js';\n" + n), y.writeFileSync(e, n, "utf8"), {
|
|
105
104
|
status: "success",
|
|
106
105
|
changed: !0
|
|
107
106
|
};
|
|
108
107
|
}
|
|
109
|
-
|
|
110
|
-
//#region src/patterns/disable/backend/generate.runtime.ts
|
|
108
|
+
// src/patterns/disable/backend/generate.runtime.ts
|
|
111
109
|
function N(e) {
|
|
112
110
|
if (!y.existsSync(e)) return [];
|
|
113
111
|
let t = [];
|
|
@@ -117,29 +115,29 @@ function N(e) {
|
|
|
117
115
|
}
|
|
118
116
|
return t;
|
|
119
117
|
}
|
|
120
|
-
async function P(
|
|
121
|
-
let
|
|
122
|
-
|
|
123
|
-
let u =
|
|
124
|
-
d && c.push(d),
|
|
125
|
-
let
|
|
118
|
+
async function P(a) {
|
|
119
|
+
let o = e(a), s = [], c = [], l = [];
|
|
120
|
+
o.info("Reverting adapter config");
|
|
121
|
+
let u = m(a.root), d = n(u.filePath, u.outcome);
|
|
122
|
+
d && c.push(d), o.info("Reverting hooks.server.ts");
|
|
123
|
+
let f = b.join(a.root, "src", "hooks.server.ts"), x = t(f, A(f));
|
|
126
124
|
x.modify && c.push(x.modify), x.delete && l.push(x.delete);
|
|
127
|
-
let S = y.existsSync(b.join(
|
|
128
|
-
|
|
129
|
-
let C =
|
|
130
|
-
C.modify && c.push(C.modify), C.delete && l.push(C.delete),
|
|
131
|
-
let w = b.join(
|
|
132
|
-
T && c.push(T),
|
|
133
|
-
let E = b.join(
|
|
125
|
+
let S = y.existsSync(b.join(a.root, "src", "lib", "server", "workflows.ts"));
|
|
126
|
+
o.info(S ? "Removing the PocketBase and workflow variables from src/env.ts" : "Removing the PocketBase variables from src/env.ts");
|
|
127
|
+
let C = v(a.root, (S ? _ : g).map((e) => e.name));
|
|
128
|
+
C.modify && c.push(C.modify), C.delete && l.push(C.delete), o.info("Reverting .gitignore");
|
|
129
|
+
let w = b.join(a.root, ".gitignore"), T = n(w, h(w));
|
|
130
|
+
T && c.push(T), o.info("Reverting src/routes/+layout.server.ts");
|
|
131
|
+
let E = b.join(a.root, "src", "routes", "+layout.server.ts"), D = n(E, M(E));
|
|
134
132
|
if (D && c.push(D), D?.status === "success") {
|
|
135
|
-
let
|
|
136
|
-
|
|
133
|
+
let e = await i(a);
|
|
134
|
+
e && s.push(e);
|
|
137
135
|
}
|
|
138
|
-
for (let
|
|
139
|
-
|
|
140
|
-
let O = b.join(
|
|
136
|
+
for (let e of N(b.join(a.root, "src"))) o.info(`Removing ${b.relative(a.root, e)}`), l.push(r(e));
|
|
137
|
+
o.info("Reverting test/setup.ts");
|
|
138
|
+
let O = b.join(a.root, "test", "setup.ts"), k = n(O, p(O));
|
|
141
139
|
return k && c.push(k), {
|
|
142
|
-
creates:
|
|
140
|
+
creates: s,
|
|
143
141
|
modifies: c,
|
|
144
142
|
deletes: l,
|
|
145
143
|
components: [],
|
|
@@ -149,7 +147,6 @@ async function P(e) {
|
|
|
149
147
|
collectionDrops: []
|
|
150
148
|
};
|
|
151
149
|
}
|
|
152
|
-
//#endregion
|
|
153
150
|
export { P as generate };
|
|
154
151
|
|
|
155
|
-
//# sourceMappingURL=generate.runtime-
|
|
152
|
+
//# sourceMappingURL=generate.runtime-Cgam_XCc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-Dy9uuf7M.js","names":["libModule","dedent","getLogger","BACKEND_ENV_VARS","ensureSiteFile","WORKFLOWS_ENV_VARS","toDeleteEntry","removeStatementWithComments","ensureBlankLineAfterImports","formatLikeSource","revertOutcomeToFile","modifyOutcomeToFile","removeHandle","unmodifyTestSetup","unmodifySvelteConfig","unmodifyGitignore","fs","path","HANDLE_HINT","INIT_HINT","BACKEND_MODULES","isStartWorkerCall","node","Node","onlyStartsWorker","fn","body","statements","workerInit","sf","decl","target","unmodifyHooksServerBackend","hooksServerPath","original","sourceFile","Project","QuoteKind","init","pruneUnusedImports","FAILURE_HINT","unmodifyLayoutServerMeta","layoutServerPath","updated","withoutParam","isLibSpecifier","m","serverTestFiles","dir","found","entry","full","generate","logger","options","creates","modifies","deletes","revert","svelteConfigFile","hooksServerRevert","hasWorkflows","envVars","unmodifyEnvVarsFiles","spec","gitignorePath","gitignoreFile","layoutServerFile","siteFile","testFile","testSetupPath","testSetupFile"],"sources":["../../src/patterns/disable/backend/modifies/hooks.server.ts","../../src/patterns/disable/backend/modifies/layout-server.ts","../../src/patterns/disable/backend/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport {\n Node,\n Project,\n QuoteKind,\n type SourceFile,\n type Statement,\n} from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { removeHandle } from \"../../../../runtime/compose-handle\";\nimport {\n ensureBlankLineAfterImports,\n pruneUnusedImports,\n removeStatementWithComments,\n formatLikeSource,\n type ModuleMatch,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\n\nconst HANDLE_HINT = dedent`\n Take handlePocketbase(...) out of the exported handle in src/hooks.server.ts,\n and its imports from '@velastack/pocketbase' and '$app/env/private'.\n`;\n\nconst INIT_HINT = dedent`\n The workflows are removed with the backend. Take the startWorker() call out\n of the init hook in src/hooks.server.ts, and its import:\n\n import { startWorker } from '#lib/server/workflows.js';\n`;\n\n/**\n * Modules only the backend's handle and init import from. An import nothing\n * references any more is dropped; a variable other code still reads stays.\n * `$env/dynamic/private` is the `env` object hooks written before SvelteKit 3\n * read the PocketBase variables from.\n */\nconst BACKEND_MODULES: ModuleMatch[] = [\n \"@velastack/pocketbase\",\n \"$app/env/private\",\n \"$env/dynamic/private\",\n libModule(\"server/workflows\"),\n \"@sveltejs/kit\",\n \"@sveltejs/kit/hooks\",\n];\n\n/** `startWorker()`, `await startWorker()` or `return startWorker()`. */\nfunction isStartWorkerCall(node: Node | undefined): boolean {\n if (!node) return false;\n if (Node.isAwaitExpression(node))\n return isStartWorkerCall(node.getExpression());\n if (Node.isExpressionStatement(node) || Node.isReturnStatement(node)) {\n return isStartWorkerCall(node.getExpression());\n }\n return (\n Node.isCallExpression(node) &&\n node.getExpression().getText() === \"startWorker\" &&\n node.getArguments().length === 0\n );\n}\n\n/** A function whose whole body starts the worker. */\nfunction onlyStartsWorker(fn: Node | undefined): boolean {\n if (\n !Node.isArrowFunction(fn) &&\n !Node.isFunctionExpression(fn) &&\n !Node.isFunctionDeclaration(fn)\n ) {\n return false;\n }\n const body = fn.getBody();\n if (!body) return false;\n if (!Node.isBlock(body)) return isStartWorkerCall(body);\n const statements = body.getStatements();\n return statements.length === 1 && isStartWorkerCall(statements[0]);\n}\n\n/**\n * The `init` export when all it does is start the workflow worker, the way\n * the minimal template and enable-workflows write it. `\"custom\"` when an init\n * starts the worker among other things; null when there is nothing to do.\n */\nfunction workerInit(sf: SourceFile): Statement | \"custom\" | null {\n const fn = sf.getFunction(\"init\");\n const decl = sf.getVariableDeclaration(\"init\");\n const target = fn ?? decl?.getVariableStatement();\n if (!target || !target.getText().includes(\"startWorker\")) return null;\n const onlyWorker = fn\n ? onlyStartsWorker(fn)\n : decl?.getVariableStatement()?.getDeclarations().length === 1 &&\n onlyStartsWorker(decl.getInitializer());\n return onlyWorker ? target : \"custom\";\n}\n\n/**\n * Undo what the backend put in `hooks.server.ts`: the PocketBase handle, and\n * the `init` that starts the workflow worker, which is deleted along with the\n * backend. Whatever else the file holds (i18n, content negotiation) stays; a\n * file with nothing else comes out empty, for the caller to delete.\n */\nexport function unmodifyHooksServerBackend(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (\n !original.includes(\"handlePocketbase\") &&\n !original.includes(\"startWorker\")\n ) {\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 // Checked before anything changes, so a failure leaves the file as it was.\n if (workerInit(sourceFile) === \"custom\") {\n return { status: \"failed\", message: INIT_HINT };\n }\n\n const removed = removeHandle(sourceFile, \"handlePocketbase\");\n if (removed.status === \"unsupported\") {\n return { status: \"failed\", message: HANDLE_HINT };\n }\n // Looked up again: edits to the file forget the nodes found before them.\n const init = workerInit(sourceFile);\n if (init && init !== \"custom\") removeStatementWithComments(sourceFile, init);\n\n pruneUnusedImports(sourceFile, BACKEND_MODULES);\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { isLibSpecifier } from \"../../../../runtime/lib-specifier\";\n\nconst FAILURE_HINT = dedent`\n src/routes/+layout.server.ts still reads locals.meta, which only the\n PocketBase hook provides. Read the values from a static module instead:\n\n import { site } from '#lib/site.js';\n\n // locals.meta.appName -> site.name\n // locals.meta.appURL -> site.url\n // meta: locals.meta -> meta: { appName: site.name, appURL: site.url }\n`;\n\n/**\n * Point an older root layout's meta at `#lib/site.js` instead of `locals.meta`.\n * Templates from before `src/lib/site.ts` read the app name and URL off the\n * PocketBase hook; without the backend nothing sets them, and `App.Locals` no\n * longer declares them. Current templates read `#lib/site.js` already, so this\n * leaves them alone.\n */\nexport function unmodifyLayoutServerMeta(\n layoutServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(layoutServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutServerPath, \"utf8\");\n if (!original.includes(\"locals.meta\")) {\n return { status: \"success\", changed: false };\n }\n\n let updated = original\n .replace(/\\blocals\\.meta\\.appName\\b/g, \"site.name\")\n .replace(/\\blocals\\.meta\\.appURL\\b/g, \"site.url\")\n .replace(\n /\\bmeta:\\s*locals\\.meta\\b/g,\n \"meta: { appName: site.name, appURL: site.url }\",\n );\n\n if (updated.includes(\"locals.meta\")) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n // `locals` usually only carried meta; drop it from the destructuring when\n // nothing else reads it.\n const withoutParam = updated\n .replace(/\\(\\{\\s*locals\\s*,\\s*/g, \"({ \")\n .replace(/,\\s*locals\\s*\\}/g, \" }\");\n if (!/\\blocals\\b/.test(withoutParam)) {\n updated = withoutParam;\n }\n\n const importsSite = [...updated.matchAll(/from\\s+['\"]([^'\"]+)['\"]/g)].some(\n (m) => isLibSpecifier(m[1], \"site\"),\n );\n if (!importsSite) {\n updated = \"import { site } from '#lib/site.js';\\n\" + updated;\n }\n\n fs.writeFileSync(layoutServerPath, updated, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport {\n modifyOutcomeToFile,\n revertOutcomeToFile,\n} from \"../../../runtime/modify-file\";\nimport { toDeleteEntry } from \"../../destroy/shared\";\nimport { ensureSiteFile } from \"../../../runtime/site\";\nimport { unmodifyHooksServerBackend } from \"./modifies/hooks.server\";\nimport { unmodifyLayoutServerMeta } from \"./modifies/layout-server\";\nimport { unmodifySvelteConfig } from \"../../enable/backend/modifies/svelte-config\";\nimport { unmodifyGitignore } from \"../../enable/backend/modifies/gitignore\";\nimport { unmodifyTestSetup } from \"../../enable/backend/modifies/test-setup\";\nimport { BACKEND_ENV_VARS } from \"../../enable/backend/env-vars\";\nimport { WORKFLOWS_ENV_VARS } from \"../../enable/workflows/env-vars\";\nimport { unmodifyEnvVarsFiles } from \"../../../runtime/env-vars\";\n\n/** Every server test under a directory; they need the PocketBase test context. */\nfunction serverTestFiles(dir: string): string[] {\n if (!fs.existsSync(dir)) return [];\n const found: string[] = [];\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) found.push(...serverTestFiles(full));\n else if (entry.name === \"server.test.ts\") found.push(full);\n }\n return found;\n}\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const creates: File[] = [];\n const modifies: File[] = [];\n const deletes: File[] = [];\n\n logger.info(\"Reverting adapter config\");\n const revert = unmodifySvelteConfig(options.root);\n const svelteConfigFile = modifyOutcomeToFile(revert.filePath, revert.outcome);\n if (svelteConfigFile) modifies.push(svelteConfigFile);\n\n // Only the backend's handle and worker come out; handles other patterns\n // composed in stay. The file goes when nothing else was in it.\n logger.info(\"Reverting hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n const hooksServerRevert = revertOutcomeToFile(\n hooksServerPath,\n unmodifyHooksServerBackend(hooksServerPath),\n );\n if (hooksServerRevert.modify) modifies.push(hooksServerRevert.modify);\n if (hooksServerRevert.delete) deletes.push(hooksServerRevert.delete);\n\n // The file goes when these were all it declared. The workflow runtime\n // (deleted with the backend) is the only reader of its switches, so they\n // go too, but only from a project that has it: `TEST` is a common name.\n const hasWorkflows = fs.existsSync(\n path.join(options.root, \"src\", \"lib\", \"server\", \"workflows.ts\"),\n );\n logger.info(\n hasWorkflows\n ? \"Removing the PocketBase and workflow variables from src/env.ts\"\n : \"Removing the PocketBase variables from src/env.ts\",\n );\n const envVars = unmodifyEnvVarsFiles(\n options.root,\n (hasWorkflows ? WORKFLOWS_ENV_VARS : BACKEND_ENV_VARS).map(\n (spec) => spec.name,\n ),\n );\n if (envVars.modify) modifies.push(envVars.modify);\n if (envVars.delete) deletes.push(envVars.delete);\n\n logger.info(\"Reverting .gitignore\");\n const gitignorePath = path.join(options.root, \".gitignore\");\n const gitignoreFile = modifyOutcomeToFile(\n gitignorePath,\n unmodifyGitignore(gitignorePath),\n );\n if (gitignoreFile) modifies.push(gitignoreFile);\n\n logger.info(\"Reverting src/routes/+layout.server.ts\");\n const layoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.server.ts\",\n );\n const layoutServerFile = modifyOutcomeToFile(\n layoutServerPath,\n unmodifyLayoutServerMeta(layoutServerPath),\n );\n if (layoutServerFile) modifies.push(layoutServerFile);\n\n // The converted layout reads `src/lib/site.ts`. Every template ships it; a\n // project from before that gets one here, named as PocketBase knew it.\n if (layoutServerFile?.status === \"success\") {\n const siteFile = await ensureSiteFile(options);\n if (siteFile) creates.push(siteFile);\n }\n\n // Server tests run against the PocketBase-backed test context that the\n // backend's test/setup.ts provides; without it they neither type-check nor\n // run.\n for (const testFile of serverTestFiles(path.join(options.root, \"src\"))) {\n logger.info(`Removing ${path.relative(options.root, testFile)}`);\n deletes.push(toDeleteEntry(testFile));\n }\n\n logger.info(\"Reverting test/setup.ts\");\n const testSetupPath = path.join(options.root, \"test\", \"setup.ts\");\n const testSetupFile = modifyOutcomeToFile(\n testSetupPath,\n unmodifyTestSetup(testSetupPath),\n );\n if (testSetupFile) modifies.push(testSetupFile);\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":";;;;;;;;;;;;;;;;AAoBA,IAAMkB,IAAc,CAAM;;;GAKpBC,IAAY,CAAM;;;;;GAalBC,IAAiC;CACrC;CACA;CACA;CACApB,EAAU,kBAAkB;CAC5B;CACA;AACF;AAGA,SAASqB,EAAkB,GAAiC;CAO1D,OANKC,IACDC,EAAK,kBAAkBD,CAAI,KAE3BC,EAAK,sBAAsBD,CAAI,KAAKC,EAAK,kBAAkBD,CAAI,IAC1DD,EAAkBC,EAAK,cAAc,CAAC,IAG7CC,EAAK,iBAAiBD,CAAI,KAC1BA,EAAK,cAAc,CAAC,CAAC,QAAQ,MAAM,iBACnCA,EAAK,aAAa,CAAC,CAAC,WAAW,IATf;AAWpB;AAGA,SAASE,EAAiB,GAA+B;CACvD,IACE,CAACD,EAAK,gBAAgBE,CAAE,KACxB,CAACF,EAAK,qBAAqBE,CAAE,KAC7B,CAACF,EAAK,sBAAsBE,CAAE,GAE9B,OAAO;CAET,IAAMC,IAAOD,EAAG,QAAQ;CACxB,IAAI,CAACC,GAAM,OAAO;CAClB,IAAI,CAACH,EAAK,QAAQG,CAAI,GAAG,OAAOL,EAAkBK,CAAI;CACtD,IAAMC,IAAaD,EAAK,cAAc;CACtC,OAAOC,EAAW,WAAW,KAAKN,EAAkBM,EAAW,EAAE;AACnE;AAOA,SAASC,EAAW,GAA6C;CAC/D,IAAMH,IAAKI,EAAG,YAAY,MAAM,GAC1BC,IAAOD,EAAG,uBAAuB,MAAM,GACvCE,IAASN,KAAMK,GAAM,qBAAqB;CAMhD,OALI,CAACC,KAAU,CAACA,EAAO,QAAQ,CAAC,CAAC,SAAS,aAAa,IAAU,QAC9CN,IACfD,EAAiBC,CAAE,IACnBK,GAAM,qBAAqB,CAAC,EAAE,gBAAgB,CAAC,CAAC,WAAW,KAC3DN,E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,IAAMC,IAAgBrD,EAAK,KAAKqC,EAAQ,MAAM,QAAQ,UAAU,GAC1DiB,IAAgB5D,EACpB2D,GACAzD,EAAkByD,CAAa,CACjC;CAGA,OAFIC,KAAef,EAAS,KAAKe,CAAa,GAEvC;EACL;EACA;EACA;EACA,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
1
|
+
{"version":3,"file":"generate.runtime-Cgam_XCc.js","names":["getLogger","revertOutcomeToFile","modifyOutcomeToFile","toDeleteEntry","ensureSiteFile","dedent","removeHandle","pruneUnusedImports","removeStatementWithComments","ensureBlankLineAfterImports","formatLikeSource","libModule","isLibSpecifier","unmodifyTestSetup","unmodifySvelteConfig","unmodifyGitignore","BACKEND_ENV_VARS","WORKFLOWS_ENV_VARS","fs","path","HANDLE_HINT","INIT_HINT","BACKEND_MODULES","isStartWorkerCall","node","Node","onlyStartsWorker","fn","body","statements","workerInit","sf","decl","target","unmodifyHooksServerBackend","hooksServerPath","original","sourceFile","Project","QuoteKind","init","FAILURE_HINT","unmodifyLayoutServerMeta","layoutServerPath","updated","withoutParam","m","serverTestFiles","dir","found","entry","full","generate","logger","options","creates","modifies","deletes","revert","svelteConfigFile","hooksServerRevert","hasWorkflows","envVars","unmodifyEnvVarsFiles","spec","gitignorePath","gitignoreFile","layoutServerFile","siteFile","testFile","testSetupPath","testSetupFile"],"sources":["../../src/patterns/disable/backend/modifies/hooks.server.ts","../../src/patterns/disable/backend/modifies/layout-server.ts","../../src/patterns/disable/backend/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport {\n Node,\n Project,\n QuoteKind,\n type SourceFile,\n type Statement,\n} from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { removeHandle } from \"../../../../runtime/compose-handle\";\nimport {\n ensureBlankLineAfterImports,\n pruneUnusedImports,\n removeStatementWithComments,\n formatLikeSource,\n type ModuleMatch,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\n\nconst HANDLE_HINT = dedent`\n Take handlePocketbase(...) out of the exported handle in src/hooks.server.ts,\n and its imports from '@velastack/pocketbase' and '$app/env/private'.\n`;\n\nconst INIT_HINT = dedent`\n The workflows are removed with the backend. Take the startWorker() call out\n of the init hook in src/hooks.server.ts, and its import:\n\n import { startWorker } from '#lib/server/workflows.js';\n`;\n\n/**\n * Modules only the backend's handle and init import from. An import nothing\n * references any more is dropped; a variable other code still reads stays.\n * `$env/dynamic/private` is the `env` object hooks written before SvelteKit 3\n * read the PocketBase variables from.\n */\nconst BACKEND_MODULES: ModuleMatch[] = [\n \"@velastack/pocketbase\",\n \"$app/env/private\",\n \"$env/dynamic/private\",\n libModule(\"server/workflows\"),\n \"@sveltejs/kit\",\n \"@sveltejs/kit/hooks\",\n];\n\n/** `startWorker()`, `await startWorker()` or `return startWorker()`. */\nfunction isStartWorkerCall(node: Node | undefined): boolean {\n if (!node) return false;\n if (Node.isAwaitExpression(node))\n return isStartWorkerCall(node.getExpression());\n if (Node.isExpressionStatement(node) || Node.isReturnStatement(node)) {\n return isStartWorkerCall(node.getExpression());\n }\n return (\n Node.isCallExpression(node) &&\n node.getExpression().getText() === \"startWorker\" &&\n node.getArguments().length === 0\n );\n}\n\n/** A function whose whole body starts the worker. */\nfunction onlyStartsWorker(fn: Node | undefined): boolean {\n if (\n !Node.isArrowFunction(fn) &&\n !Node.isFunctionExpression(fn) &&\n !Node.isFunctionDeclaration(fn)\n ) {\n return false;\n }\n const body = fn.getBody();\n if (!body) return false;\n if (!Node.isBlock(body)) return isStartWorkerCall(body);\n const statements = body.getStatements();\n return statements.length === 1 && isStartWorkerCall(statements[0]);\n}\n\n/**\n * The `init` export when all it does is start the workflow worker, the way\n * the minimal template and enable-workflows write it. `\"custom\"` when an init\n * starts the worker among other things; null when there is nothing to do.\n */\nfunction workerInit(sf: SourceFile): Statement | \"custom\" | null {\n const fn = sf.getFunction(\"init\");\n const decl = sf.getVariableDeclaration(\"init\");\n const target = fn ?? decl?.getVariableStatement();\n if (!target || !target.getText().includes(\"startWorker\")) return null;\n const onlyWorker = fn\n ? onlyStartsWorker(fn)\n : decl?.getVariableStatement()?.getDeclarations().length === 1 &&\n onlyStartsWorker(decl.getInitializer());\n return onlyWorker ? target : \"custom\";\n}\n\n/**\n * Undo what the backend put in `hooks.server.ts`: the PocketBase handle, and\n * the `init` that starts the workflow worker, which is deleted along with the\n * backend. Whatever else the file holds (i18n, content negotiation) stays; a\n * file with nothing else comes out empty, for the caller to delete.\n */\nexport function unmodifyHooksServerBackend(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (\n !original.includes(\"handlePocketbase\") &&\n !original.includes(\"startWorker\")\n ) {\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 // Checked before anything changes, so a failure leaves the file as it was.\n if (workerInit(sourceFile) === \"custom\") {\n return { status: \"failed\", message: INIT_HINT };\n }\n\n const removed = removeHandle(sourceFile, \"handlePocketbase\");\n if (removed.status === \"unsupported\") {\n return { status: \"failed\", message: HANDLE_HINT };\n }\n // Looked up again: edits to the file forget the nodes found before them.\n const init = workerInit(sourceFile);\n if (init && init !== \"custom\") removeStatementWithComments(sourceFile, init);\n\n pruneUnusedImports(sourceFile, BACKEND_MODULES);\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { isLibSpecifier } from \"../../../../runtime/lib-specifier\";\n\nconst FAILURE_HINT = dedent`\n src/routes/+layout.server.ts still reads locals.meta, which only the\n PocketBase hook provides. Read the values from a static module instead:\n\n import { site } from '#lib/site.js';\n\n // locals.meta.appName -> site.name\n // locals.meta.appURL -> site.url\n // meta: locals.meta -> meta: { appName: site.name, appURL: site.url }\n`;\n\n/**\n * Point an older root layout's meta at `#lib/site.js` instead of `locals.meta`.\n * Templates from before `src/lib/site.ts` read the app name and URL off the\n * PocketBase hook; without the backend nothing sets them, and `App.Locals` no\n * longer declares them. Current templates read `#lib/site.js` already, so this\n * leaves them alone.\n */\nexport function unmodifyLayoutServerMeta(\n layoutServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(layoutServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutServerPath, \"utf8\");\n if (!original.includes(\"locals.meta\")) {\n return { status: \"success\", changed: false };\n }\n\n let updated = original\n .replace(/\\blocals\\.meta\\.appName\\b/g, \"site.name\")\n .replace(/\\blocals\\.meta\\.appURL\\b/g, \"site.url\")\n .replace(\n /\\bmeta:\\s*locals\\.meta\\b/g,\n \"meta: { appName: site.name, appURL: site.url }\",\n );\n\n if (updated.includes(\"locals.meta\")) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n // `locals` usually only carried meta; drop it from the destructuring when\n // nothing else reads it.\n const withoutParam = updated\n .replace(/\\(\\{\\s*locals\\s*,\\s*/g, \"({ \")\n .replace(/,\\s*locals\\s*\\}/g, \" }\");\n if (!/\\blocals\\b/.test(withoutParam)) {\n updated = withoutParam;\n }\n\n const importsSite = [...updated.matchAll(/from\\s+['\"]([^'\"]+)['\"]/g)].some(\n (m) => isLibSpecifier(m[1], \"site\"),\n );\n if (!importsSite) {\n updated = \"import { site } from '#lib/site.js';\\n\" + updated;\n }\n\n fs.writeFileSync(layoutServerPath, updated, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport {\n modifyOutcomeToFile,\n revertOutcomeToFile,\n} from \"../../../runtime/modify-file\";\nimport { toDeleteEntry } from \"../../destroy/shared\";\nimport { ensureSiteFile } from \"../../../runtime/site\";\nimport { unmodifyHooksServerBackend } from \"./modifies/hooks.server\";\nimport { unmodifyLayoutServerMeta } from \"./modifies/layout-server\";\nimport { unmodifySvelteConfig } from \"../../enable/backend/modifies/svelte-config\";\nimport { unmodifyGitignore } from \"../../enable/backend/modifies/gitignore\";\nimport { unmodifyTestSetup } from \"../../enable/backend/modifies/test-setup\";\nimport { BACKEND_ENV_VARS } from \"../../enable/backend/env-vars\";\nimport { WORKFLOWS_ENV_VARS } from \"../../enable/workflows/env-vars\";\nimport { unmodifyEnvVarsFiles } from \"../../../runtime/env-vars\";\n\n/** Every server test under a directory; they need the PocketBase test context. */\nfunction serverTestFiles(dir: string): string[] {\n if (!fs.existsSync(dir)) return [];\n const found: string[] = [];\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) found.push(...serverTestFiles(full));\n else if (entry.name === \"server.test.ts\") found.push(full);\n }\n return found;\n}\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const creates: File[] = [];\n const modifies: File[] = [];\n const deletes: File[] = [];\n\n logger.info(\"Reverting adapter config\");\n const revert = unmodifySvelteConfig(options.root);\n const svelteConfigFile = modifyOutcomeToFile(revert.filePath, revert.outcome);\n if (svelteConfigFile) modifies.push(svelteConfigFile);\n\n // Only the backend's handle and worker come out; handles other patterns\n // composed in stay. The file goes when nothing else was in it.\n logger.info(\"Reverting hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n const hooksServerRevert = revertOutcomeToFile(\n hooksServerPath,\n unmodifyHooksServerBackend(hooksServerPath),\n );\n if (hooksServerRevert.modify) modifies.push(hooksServerRevert.modify);\n if (hooksServerRevert.delete) deletes.push(hooksServerRevert.delete);\n\n // The file goes when these were all it declared. The workflow runtime\n // (deleted with the backend) is the only reader of its switches, so they\n // go too, but only from a project that has it: `TEST` is a common name.\n const hasWorkflows = fs.existsSync(\n path.join(options.root, \"src\", \"lib\", \"server\", \"workflows.ts\"),\n );\n logger.info(\n hasWorkflows\n ? \"Removing the PocketBase and workflow variables from src/env.ts\"\n : \"Removing the PocketBase variables from src/env.ts\",\n );\n const envVars = unmodifyEnvVarsFiles(\n options.root,\n (hasWorkflows ? WORKFLOWS_ENV_VARS : BACKEND_ENV_VARS).map(\n (spec) => spec.name,\n ),\n );\n if (envVars.modify) modifies.push(envVars.modify);\n if (envVars.delete) deletes.push(envVars.delete);\n\n logger.info(\"Reverting .gitignore\");\n const gitignorePath = path.join(options.root, \".gitignore\");\n const gitignoreFile = modifyOutcomeToFile(\n gitignorePath,\n unmodifyGitignore(gitignorePath),\n );\n if (gitignoreFile) modifies.push(gitignoreFile);\n\n logger.info(\"Reverting src/routes/+layout.server.ts\");\n const layoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.server.ts\",\n );\n const layoutServerFile = modifyOutcomeToFile(\n layoutServerPath,\n unmodifyLayoutServerMeta(layoutServerPath),\n );\n if (layoutServerFile) modifies.push(layoutServerFile);\n\n // The converted layout reads `src/lib/site.ts`. Every template ships it; a\n // project from before that gets one here, named as PocketBase knew it.\n if (layoutServerFile?.status === \"success\") {\n const siteFile = await ensureSiteFile(options);\n if (siteFile) creates.push(siteFile);\n }\n\n // Server tests run against the PocketBase-backed test context that the\n // backend's test/setup.ts provides; without it they neither type-check nor\n // run.\n for (const testFile of serverTestFiles(path.join(options.root, \"src\"))) {\n logger.info(`Removing ${path.relative(options.root, testFile)}`);\n deletes.push(toDeleteEntry(testFile));\n }\n\n logger.info(\"Reverting test/setup.ts\");\n const testSetupPath = path.join(options.root, \"test\", \"setup.ts\");\n const testSetupFile = modifyOutcomeToFile(\n testSetupPath,\n unmodifyTestSetup(testSetupPath),\n );\n if (testSetupFile) modifies.push(testSetupFile);\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":";;;;;;;;;;;;;;;;AAoBA,IAAMoB,IAAc,CAAM;;;GAKpBC,IAAY,CAAM;;;;;GAalBC,IAAiC;CACrC;CACA;CACA;CACAX,EAAU,kBAAkB;CAC5B;CACA;AACF;AAGA,SAASY,EAAkB,GAAiC;CAO1D,OANKC,IACDC,EAAK,kBAAkBD,CAAI,KAE3BC,EAAK,sBAAsBD,CAAI,KAAKC,EAAK,kBAAkBD,CAAI,IAC1DD,EAAkBC,EAAK,cAAc,CAAC,IAG7CC,EAAK,iBAAiBD,CAAI,KAC1BA,EAAK,cAAc,CAAC,CAAC,QAAQ,MAAM,iBACnCA,EAAK,aAAa,CAAC,CAAC,WAAW,IATf;AAWpB;AAGA,SAASE,EAAiB,GAA+B;CACvD,IACE,CAACD,EAAK,gBAAgBE,CAAE,KACxB,CAACF,EAAK,qBAAqBE,CAAE,KAC7B,CAACF,EAAK,sBAAsBE,CAAE,GAE9B,OAAO;CAET,IAAMC,IAAOD,EAAG,QAAQ;CACxB,IAAI,CAACC,GAAM,OAAO;CAClB,IAAI,CAACH,EAAK,QAAQG,CAAI,GAAG,OAAOL,EAAkBK,CAAI;CACtD,IAAMC,IAAaD,EAAK,cAAc;CACtC,OAAOC,EAAW,WAAW,KAAKN,EAAkBM,EAAW,EAAE;AACnE;AAOA,SAASC,EAAW,GAA6C;CAC/D,IAAMH,IAAKI,EAAG,YAAY,MAAM,GAC1BC,IAAOD,EAAG,uBAAuB,MAAM,GACvCE,IAASN,KAAMK,GAAM,qBAAqB;CAMhD,OALI,CAACC,KAAU,CAACA,EAAO,QAAQ,CAAC,CAAC,SAAS,aAAa,IAAU,QAC9CN,IACfD,EAAiBC,CAAE,IACnBK,GAAM,qBAAqB,CAAC,EAAE,gBAAgB,CAAC,CAAC,WAAW,KAC3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B;CACrC,IAAMC,IAAgBnD,EAAK,KAAKmC,EAAQ,MAAM,QAAQ,UAAU,GAC1DiB,IAAgBrE,EACpBoE,GACAzD,EAAkByD,CAAa,CACjC;CAGA,OAFIC,KAAef,EAAS,KAAKe,CAAa,GAEvC;EACL;EACA;EACA;EACA,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as e } from "./logger-
|
|
2
|
-
import { r as t } from "./modify-file-
|
|
3
|
-
import { r as n } from "./layout.svelte-
|
|
1
|
+
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
+
import { r as t } from "./modify-file-CRZ_gMg0.js";
|
|
3
|
+
import { r as n } from "./layout.svelte-B6wOQ7SM.js";
|
|
4
4
|
import r from "node:path";
|
|
5
|
-
|
|
5
|
+
// src/patterns/enable/og/generate.runtime.ts
|
|
6
6
|
async function i(i) {
|
|
7
7
|
let a = e(i), o = [];
|
|
8
8
|
a.info("Modifying src/routes/+layout.svelte");
|
|
@@ -18,7 +18,6 @@ async function i(i) {
|
|
|
18
18
|
collectionDrops: []
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { i as generate };
|
|
23
22
|
|
|
24
|
-
//# sourceMappingURL=generate.runtime-
|
|
23
|
+
//# sourceMappingURL=generate.runtime-CjqX4tDg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-
|
|
1
|
+
{"version":3,"file":"generate.runtime-CjqX4tDg.js","names":["getLogger","modifyOutcomeToFile","modifyLayoutSvelte","path","generate","logger","options","modifies","layoutPath","file"],"sources":["../../src/patterns/enable/og/generate.runtime.ts"],"sourcesContent":["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 { modifyLayoutSvelte } from \"./modifies/layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n logger.info(\"Modifying src/routes/+layout.svelte\");\n const layoutPath = path.join(options.root, \"src\", \"routes\", \"+layout.svelte\");\n const file = modifyOutcomeToFile(layoutPath, modifyLayoutSvelte(layoutPath));\n if (file) modifies.push(file);\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":";;;;;AAMA,eAAsBI,EAAS,GAAkB;CAC/C,IAAMC,IAASL,EAAUM,CAAO,GAC1BC,IAAmB,CAAC;CAE1B,EAAO,KAAK,qCAAqC;CACjD,IAAMC,IAAaL,EAAK,KAAKG,EAAQ,MAAM,OAAO,UAAU,gBAAgB,GACtEG,IAAOR,EAAoBO,GAAYN,EAAmBM,CAAU,CAAC;CAG3E,OAFIC,KAAMF,EAAS,KAAKE,CAAI,GAErB;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
+
import { r as t } from "./modify-file-CRZ_gMg0.js";
|
|
3
|
+
import { n } from "./env-AxyRWcC_.js";
|
|
4
|
+
import { unmodifyEnvVarsFiles as r } from "./env-vars-CVn2076k.js";
|
|
5
|
+
import { a as i } from "./currency.server-BwuXG0a9.js";
|
|
6
|
+
import { n as a } from "./generate-BCYvhyF9.js";
|
|
7
|
+
import { t as o } from "./svelte-file-DfplF3BU.js";
|
|
8
|
+
import { f as s, m as c, n as l, o as u } from "./ts-morph-helpers-B4KZXP44.js";
|
|
9
|
+
import { c as d, i as f, n as p, o as m } from "./root-layout.svelte-DE0c_y-T.js";
|
|
10
|
+
import { t as h } from "./lib-specifier-C3M0WTev.js";
|
|
11
|
+
import { t as g } from "./shared-DE-J_b1j.js";
|
|
12
|
+
import { n as _, t as v } from "./wuchale-config-CNXoq4rc.js";
|
|
13
|
+
import y from "node:fs";
|
|
14
|
+
import b from "node:path";
|
|
15
|
+
import { Project as x, QuoteKind as S, SyntaxKind as C } from "ts-morph";
|
|
16
|
+
// src/patterns/disable/payments/modifies/modify-nav-user.ts
|
|
17
|
+
function w(e) {
|
|
18
|
+
if (!y.existsSync(e)) return {
|
|
19
|
+
status: "success",
|
|
20
|
+
changed: !1
|
|
21
|
+
};
|
|
22
|
+
let t = y.readFileSync(e, "utf8");
|
|
23
|
+
if (!t.includes("/billing")) return {
|
|
24
|
+
status: "success",
|
|
25
|
+
changed: !1
|
|
26
|
+
};
|
|
27
|
+
let n = new o(t), r = !1, i = (e) => {
|
|
28
|
+
r || e((e) => {
|
|
29
|
+
let t = s(e, "Billing", "@lucide/svelte/icons/credit-card");
|
|
30
|
+
return t.wasRemoved && (r = !0), t.source;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
return i((e) => n.modifyModuleScript(e)), r || i((e) => n.modifyScript(e)), r ? (y.writeFileSync(e, n.toString(), "utf8"), {
|
|
34
|
+
status: "success",
|
|
35
|
+
changed: !0
|
|
36
|
+
}) : {
|
|
37
|
+
status: "success",
|
|
38
|
+
changed: !1
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// src/patterns/disable/payments/modifies/modify-user-signup.ts
|
|
42
|
+
var T = /* @__PURE__ */ new Set(["linkStripeCustomer.run", "linkStripeCustomer"]);
|
|
43
|
+
function E(e) {
|
|
44
|
+
if (!y.existsSync(e)) return {
|
|
45
|
+
status: "success",
|
|
46
|
+
changed: !1
|
|
47
|
+
};
|
|
48
|
+
let t = y.readFileSync(e, "utf8");
|
|
49
|
+
if (!t.includes("linkStripeCustomer")) return {
|
|
50
|
+
status: "success",
|
|
51
|
+
changed: !1
|
|
52
|
+
};
|
|
53
|
+
let n = new x({ manipulationSettings: { quoteKind: S.Single } }).addSourceFileAtPath(e);
|
|
54
|
+
for (let e of ["workflows/link-stripe-customer", "stripe"]) {
|
|
55
|
+
let t = n.getImportDeclarations().find((t) => h(t.getModuleSpecifierValue(), e));
|
|
56
|
+
t && t.remove();
|
|
57
|
+
}
|
|
58
|
+
let r = n.getVariableStatement((e) => e.getDeclarations().some((e) => e.getName() === "linkStripeCustomer"));
|
|
59
|
+
r && r.remove();
|
|
60
|
+
let i = n.getDescendantsOfKind(C.CallExpression).filter((e) => T.has(e.getExpression().getText()));
|
|
61
|
+
for (let e of i) {
|
|
62
|
+
let t = e.getFirstAncestorByKind(C.ExpressionStatement);
|
|
63
|
+
t && c(n, t);
|
|
64
|
+
}
|
|
65
|
+
return u(n), l(n), n.saveSync(), {
|
|
66
|
+
status: "success",
|
|
67
|
+
changed: n.getFullText() !== t
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// src/patterns/disable/payments/generate.runtime.ts
|
|
71
|
+
var D = [
|
|
72
|
+
"transactions",
|
|
73
|
+
"stripe_customers",
|
|
74
|
+
"stripe_payment_methods",
|
|
75
|
+
"stripe_prices",
|
|
76
|
+
"stripe_products"
|
|
77
|
+
];
|
|
78
|
+
async function O(o) {
|
|
79
|
+
let s = o.features.auth, c = e(o), l = a(o), u = l.some((e) => e.id === "stripe"), h = [], x = [], S = (e) => {
|
|
80
|
+
e && h.push(e);
|
|
81
|
+
}, C = b.join(o.root, ".env");
|
|
82
|
+
for (let e of l) c.info(`Stripping ${e.label} credentials from .env`), S(t(C, n(C, i(e))));
|
|
83
|
+
c.info("Removing the currency select from the navbar");
|
|
84
|
+
let T = b.join(o.root, "src", "routes", "(public)", "root-layout.svelte");
|
|
85
|
+
S(t(T, p(T)));
|
|
86
|
+
let O = b.join(o.root, "src", "hooks.server.ts"), k = b.join(o.root, "src", "routes", "+layout.server.ts"), A = b.join(o.root, "src", "routes", "+layout.svelte");
|
|
87
|
+
y.existsSync(k) && (c.info("Removing the visitor's currency from the server"), S(t(A, f(A))), S(t(k, m(k))), S(t(O, d(O)))), c.info("Removing payment variables from src/env.ts");
|
|
88
|
+
let j = r(o.root, l.flatMap((e) => (e.env ?? []).map((e) => e.key)));
|
|
89
|
+
S(j.modify), j.delete && x.push(j.delete);
|
|
90
|
+
let M = b.join(o.root, "wuchale.config.js");
|
|
91
|
+
if (l.some((e) => e.id === "whatsapp") && y.existsSync(M) && (c.info("Removing src/lib/order.ts from wuchale's js adapter"), S(t(M, _(M, v, "remove")))), u && s) {
|
|
92
|
+
c.info("Reverting nav-user.svelte");
|
|
93
|
+
let e = b.join(o.root, "src", "lib", "components", "nav-user.svelte");
|
|
94
|
+
S(t(e, w(e))), c.info("Reverting signup +page.server.ts");
|
|
95
|
+
let n = b.join(o.root, "src", "routes", "(public)", "(auth)", "signup", "+page.server.ts");
|
|
96
|
+
S(t(n, E(n)));
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
creates: [],
|
|
100
|
+
modifies: h,
|
|
101
|
+
deletes: x,
|
|
102
|
+
components: [],
|
|
103
|
+
packages: [],
|
|
104
|
+
collections: [],
|
|
105
|
+
collectionPatches: [],
|
|
106
|
+
collectionDrops: u && o.features.backend ? await g(D, o) : []
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export { O as generate };
|
|
110
|
+
|
|
111
|
+
//# sourceMappingURL=generate.runtime-Cry-DBNl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-CaOO0281.js","names":["isLibSpecifier","getLogger","envEditsFor","planDropsForCollections","providersToRemove","modifyEnvRemove","removeNavItemFromScript","removeStatementWithComments","ensureBlankLineAfterImports","formatLikeSource","modifyOutcomeToFile","SvelteFile","unmodifyHooksServerCurrency","unmodifyLayoutSvelteCurrency","unmodifyRootLayoutCurrencySelect","unmodifyLayoutServerCurrency","modifyWuchaleJsFiles","TRANSLATED_LIB_FILES","fs","path","unmodifyNavUser","navUserPath","source","file","wasRemoved","tryRemove","run","result","src","fn","CALL_EXPRESSIONS","unmodifyUserSignup","userSignupPath","originalSource","sourceFile","Project","QuoteKind","module","decl","d","linkFn","s","callStatements","SyntaxKind","ce","call","stmt","STRIPE_COLLECTIONS","generate","isAppMode","options","logger","providers","isStripe","provider","modifies","deletes","pushResult","envPath","layoutPath","hooksServerPath","layoutServerPath","rootLayoutPath","envVars","unmodifyEnvVarsFiles","variable","wuchaleConfig"],"sources":["../../src/patterns/disable/payments/modifies/modify-nav-user.ts","../../src/patterns/disable/payments/modifies/modify-user-signup.ts","../../src/patterns/disable/payments/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport { removeNavItemFromScript } from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyNavUser(navUserPath: string): ModifyOutcome {\n if (!fs.existsSync(navUserPath)) {\n return { status: \"success\", changed: false };\n }\n\n const source = fs.readFileSync(navUserPath, \"utf8\");\n if (!source.includes(\"/billing\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = new SvelteFile(source);\n let wasRemoved = false;\n\n const tryRemove = (run: (fn: (s: string) => string) => boolean) => {\n if (wasRemoved) return;\n run((src) => {\n const result = removeNavItemFromScript(\n src,\n \"Billing\",\n \"@lucide/svelte/icons/credit-card\",\n );\n if (result.wasRemoved) wasRemoved = true;\n return result.source;\n });\n };\n\n tryRemove((fn) => file.modifyModuleScript(fn));\n if (!wasRemoved) tryRemove((fn) => file.modifyScript(fn));\n\n if (!wasRemoved) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(navUserPath, file.toString(), \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n ensureBlankLineAfterImports,\n formatLikeSource,\n removeStatementWithComments,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { isLibSpecifier } from \"../../../../runtime/lib-specifier\";\n\nconst CALL_EXPRESSIONS = new Set([\n \"linkStripeCustomer.run\",\n // Projects from before the workflow: an inline helper called directly.\n \"linkStripeCustomer\",\n]);\n\nexport function unmodifyUserSignup(userSignupPath: string): ModifyOutcome {\n if (!fs.existsSync(userSignupPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(userSignupPath, \"utf8\");\n if (!originalSource.includes(\"linkStripeCustomer\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(userSignupPath);\n\n for (const module of [\"workflows/link-stripe-customer\", \"stripe\"]) {\n const decl = sourceFile\n .getImportDeclarations()\n .find((d) => isLibSpecifier(d.getModuleSpecifierValue(), module));\n if (decl) decl.remove();\n }\n\n const linkFn = sourceFile.getVariableStatement((s) =>\n s.getDeclarations().some((d) => d.getName() === \"linkStripeCustomer\"),\n );\n if (linkFn) linkFn.remove();\n\n const callStatements = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .filter((ce) => CALL_EXPRESSIONS.has(ce.getExpression().getText()));\n for (const call of callStatements) {\n const stmt = call.getFirstAncestorByKind(SyntaxKind.ExpressionStatement);\n // With the two comment lines enable-payments put above it: left behind,\n // they keep the file from matching the stock signup, and enable-whatsapp\n // then refuses to swap it.\n if (stmt) removeStatementWithComments(sourceFile, stmt);\n }\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\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 { modifyEnvRemove } from \"../../../runtime/env\";\nimport { unmodifyEnvVarsFiles } from \"../../../runtime/env-vars\";\nimport { envEditsFor } from \"../../enable/payments/generate\";\nimport { providersToRemove } from \"./generate\";\nimport { unmodifyNavUser } from \"./modifies/modify-nav-user\";\nimport { unmodifyHooksServerCurrency } from \"../../enable/payments/modifies/hooks.server\";\nimport { unmodifyLayoutServerCurrency } from \"../../enable/payments/modifies/layout.server\";\nimport { unmodifyLayoutSvelteCurrency } from \"../../enable/payments/modifies/layout.svelte\";\nimport { unmodifyRootLayoutCurrencySelect } from \"../../enable/payments/modifies/root-layout.svelte\";\nimport { unmodifyUserSignup } from \"./modifies/modify-user-signup\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\nimport fs from \"node:fs\";\nimport {\n modifyWuchaleJsFiles,\n TRANSLATED_LIB_FILES,\n} from \"../../../runtime/wuchale-config\";\n\n/** Everything enable-payments creates in PocketBase for Stripe. */\nconst STRIPE_COLLECTIONS = [\n \"transactions\",\n \"stripe_customers\",\n \"stripe_payment_methods\",\n \"stripe_prices\",\n \"stripe_products\",\n];\n\nexport async function generate(options: Options) {\n const isAppMode = options.features.auth;\n const logger = getLogger(options);\n const providers = providersToRemove(options);\n const isStripe = providers.some((provider) => provider.id === \"stripe\");\n const modifies: File[] = [];\n const deletes: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n const envPath = path.join(options.root, \".env\");\n for (const provider of providers) {\n logger.info(`Stripping ${provider.label} credentials from .env`);\n pushResult(\n modifyOutcomeToFile(\n envPath,\n modifyEnvRemove(envPath, envEditsFor(provider)),\n ),\n );\n }\n\n logger.info(\"Removing the currency select from the navbar\");\n const layoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"root-layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n layoutPath,\n unmodifyRootLayoutCurrencySelect(layoutPath),\n ),\n );\n\n // The server half of the store, where enable-payments added it.\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n const layoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.server.ts\",\n );\n const rootLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.svelte\",\n );\n if (fs.existsSync(layoutServerPath)) {\n logger.info(\"Removing the visitor's currency from the server\");\n pushResult(\n modifyOutcomeToFile(\n rootLayoutPath,\n unmodifyLayoutSvelteCurrency(rootLayoutPath),\n ),\n );\n pushResult(\n modifyOutcomeToFile(\n layoutServerPath,\n unmodifyLayoutServerCurrency(layoutServerPath),\n ),\n );\n pushResult(\n modifyOutcomeToFile(\n hooksServerPath,\n unmodifyHooksServerCurrency(hooksServerPath),\n ),\n );\n }\n\n logger.info(\"Removing payment variables from src/env.ts\");\n const envVars = unmodifyEnvVarsFiles(\n options.root,\n providers.flatMap((provider) =>\n (provider.env ?? []).map((variable) => variable.key),\n ),\n );\n pushResult(envVars.modify);\n if (envVars.delete) deletes.push(envVars.delete);\n\n // WhatsApp's order message was listed for wuchale; the module goes, so the\n // entry does too.\n const wuchaleConfig = path.join(options.root, \"wuchale.config.js\");\n if (\n providers.some((provider) => provider.id === \"whatsapp\") &&\n fs.existsSync(wuchaleConfig)\n ) {\n logger.info(\"Removing src/lib/order.ts from wuchale's js adapter\");\n pushResult(\n modifyOutcomeToFile(\n wuchaleConfig,\n modifyWuchaleJsFiles(wuchaleConfig, TRANSLATED_LIB_FILES, \"remove\"),\n ),\n );\n }\n\n // The nav item and the signup link exist only in auth's files, which\n // enable-payments edits for Stripe alone.\n if (isStripe && isAppMode) {\n logger.info(\"Reverting nav-user.svelte\");\n const navUserPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"nav-user.svelte\",\n );\n pushResult(modifyOutcomeToFile(navUserPath, unmodifyNavUser(navUserPath)));\n\n logger.info(\"Reverting signup +page.server.ts\");\n const userSignupPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"(auth)\",\n \"signup\",\n \"+page.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(userSignupPath, unmodifyUserSignup(userSignupPath)),\n );\n }\n\n // Every Stripe collection is planned, whatever auth is now; one that was\n // never created is planned as missing and left alone. Without a backend\n // (no provider detected, on a Shopify project) there is nothing to drop.\n const collectionDrops =\n isStripe && options.features.backend\n ? await planDropsForCollections(STRIPE_COLLECTIONS, options)\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":";;;;;;;;;;;;;;;;AAKA,SAAgBoB,EAAgB,GAAoC;CAClE,IAAI,CAACF,EAAG,WAAWG,CAAW,GAC5B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAASJ,EAAG,aAAaG,GAAa,MAAM;CAClD,IAAI,CAACC,EAAO,SAAS,UAAU,GAC7B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAO,IAAIZ,EAAWW,CAAM,GAC9BE,IAAa,IAEXC,KAAa,MAAgD;EACjE,AAAID,KACJE,GAAK,MAAQ;GACX,IAAMC,IAASrB,EACbsB,GACA,WACA,kCACF;GAEA,OADID,EAAO,eAAY,IAAa,KAC7BA,EAAO;EAChB,CAAC;CACH;CAUA,OARAF,GAAW,MAAOF,EAAK,mBAAmBM,CAAE,CAAC,GACxCL,KAAYC,GAAW,MAAOF,EAAK,aAAaM,CAAE,CAAC,GAEnDL,KAILN,EAAG,cAAcG,GAAaE,EAAK,SAAS,GAAG,MAAM,GAC9C;EAAE,QAAQ;EAAW,SAAS;CAAK,KAJjC;EAAE,QAAQ;EAAW,SAAS;CAAM;AAK/C;;;AC9BA,IAAMO,oBAAmB,IAAI,IAAI,CAC/B,0BAEA,oBACF,CAAC;AAED,SAAgBC,EAAmB,GAAuC;CACxE,IAAI,CAACb,EAAG,WAAWc,CAAc,GAC/B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAiBf,EAAG,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MAE3Bf,EAAO,KAAK,qDAAqD,GACjEM,EACE/C,EACEwD,GACAlD,EAAqBkD,GAAejD,GAAsB,QAAQ,CACpE,CACF,IAKEoC,KAAYJ,GAAW;EACzB,EAAO,KAAK,2BAA2B;EACvC,IAAM5B,IAAcF,EAAK,KACvB+B,EAAQ,MACR,OACA,OACA,cACA,iBACF;EAGA,AAFAO,EAAW/C,EAAoBW,GAAaD,EAAgBC,CAAW,CAAC,CAAC,GAEzE8B,EAAO,KAAK,kCAAkC;EAC9C,IAAMnB,IAAiBb,EAAK,KAC1B+B,EAAQ,MACR,OACA,UACA,YACA,UACA,UACA,iBACF;EACA,EACExC,EAAoBsB,GAAgBD,EAAmBC,CAAc,CAAC,CACxE;CACF;CAUA,OAAO;EACL,SAAS,CAAC;EACV;EACA;EACA,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAZAqB,KAAYH,EAAQ,SAAS,UACzB,MAAM/C,EAAwB4C,GAAoBG,CAAO,IACzD,CAAC;CAWP;AACF"}
|
|
1
|
+
{"version":3,"file":"generate.runtime-Cry-DBNl.js","names":["getLogger","modifyOutcomeToFile","envEditsFor","providersToRemove","SvelteFile","removeNavItemFromScript","removeStatementWithComments","ensureBlankLineAfterImports","formatLikeSource","unmodifyHooksServerCurrency","unmodifyLayoutSvelteCurrency","unmodifyRootLayoutCurrencySelect","unmodifyLayoutServerCurrency","isLibSpecifier","planDropsForCollections","modifyWuchaleJsFiles","TRANSLATED_LIB_FILES","fs","path","unmodifyNavUser","navUserPath","source","file","wasRemoved","tryRemove","run","result","src","fn","CALL_EXPRESSIONS","unmodifyUserSignup","userSignupPath","originalSource","sourceFile","Project","QuoteKind","module","decl","d","linkFn","s","callStatements","SyntaxKind","ce","call","stmt","STRIPE_COLLECTIONS","generate","isAppMode","options","logger","providers","isStripe","provider","modifies","deletes","pushResult","envPath","modifyEnvRemove","layoutPath","hooksServerPath","layoutServerPath","rootLayoutPath","envVars","unmodifyEnvVarsFiles","variable","wuchaleConfig"],"sources":["../../src/patterns/disable/payments/modifies/modify-nav-user.ts","../../src/patterns/disable/payments/modifies/modify-user-signup.ts","../../src/patterns/disable/payments/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport { removeNavItemFromScript } from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyNavUser(navUserPath: string): ModifyOutcome {\n if (!fs.existsSync(navUserPath)) {\n return { status: \"success\", changed: false };\n }\n\n const source = fs.readFileSync(navUserPath, \"utf8\");\n if (!source.includes(\"/billing\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = new SvelteFile(source);\n let wasRemoved = false;\n\n const tryRemove = (run: (fn: (s: string) => string) => boolean) => {\n if (wasRemoved) return;\n run((src) => {\n const result = removeNavItemFromScript(\n src,\n \"Billing\",\n \"@lucide/svelte/icons/credit-card\",\n );\n if (result.wasRemoved) wasRemoved = true;\n return result.source;\n });\n };\n\n tryRemove((fn) => file.modifyModuleScript(fn));\n if (!wasRemoved) tryRemove((fn) => file.modifyScript(fn));\n\n if (!wasRemoved) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(navUserPath, file.toString(), \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n ensureBlankLineAfterImports,\n formatLikeSource,\n removeStatementWithComments,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { isLibSpecifier } from \"../../../../runtime/lib-specifier\";\n\nconst CALL_EXPRESSIONS = new Set([\n \"linkStripeCustomer.run\",\n // Projects from before the workflow: an inline helper called directly.\n \"linkStripeCustomer\",\n]);\n\nexport function unmodifyUserSignup(userSignupPath: string): ModifyOutcome {\n if (!fs.existsSync(userSignupPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(userSignupPath, \"utf8\");\n if (!originalSource.includes(\"linkStripeCustomer\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(userSignupPath);\n\n for (const module of [\"workflows/link-stripe-customer\", \"stripe\"]) {\n const decl = sourceFile\n .getImportDeclarations()\n .find((d) => isLibSpecifier(d.getModuleSpecifierValue(), module));\n if (decl) decl.remove();\n }\n\n const linkFn = sourceFile.getVariableStatement((s) =>\n s.getDeclarations().some((d) => d.getName() === \"linkStripeCustomer\"),\n );\n if (linkFn) linkFn.remove();\n\n const callStatements = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .filter((ce) => CALL_EXPRESSIONS.has(ce.getExpression().getText()));\n for (const call of callStatements) {\n const stmt = call.getFirstAncestorByKind(SyntaxKind.ExpressionStatement);\n // With the two comment lines enable-payments put above it: left behind,\n // they keep the file from matching the stock signup, and enable-whatsapp\n // then refuses to swap it.\n if (stmt) removeStatementWithComments(sourceFile, stmt);\n }\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\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 { modifyEnvRemove } from \"../../../runtime/env\";\nimport { unmodifyEnvVarsFiles } from \"../../../runtime/env-vars\";\nimport { envEditsFor } from \"../../enable/payments/generate\";\nimport { providersToRemove } from \"./generate\";\nimport { unmodifyNavUser } from \"./modifies/modify-nav-user\";\nimport { unmodifyHooksServerCurrency } from \"../../enable/payments/modifies/hooks.server\";\nimport { unmodifyLayoutServerCurrency } from \"../../enable/payments/modifies/layout.server\";\nimport { unmodifyLayoutSvelteCurrency } from \"../../enable/payments/modifies/layout.svelte\";\nimport { unmodifyRootLayoutCurrencySelect } from \"../../enable/payments/modifies/root-layout.svelte\";\nimport { unmodifyUserSignup } from \"./modifies/modify-user-signup\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\nimport fs from \"node:fs\";\nimport {\n modifyWuchaleJsFiles,\n TRANSLATED_LIB_FILES,\n} from \"../../../runtime/wuchale-config\";\n\n/** Everything enable-payments creates in PocketBase for Stripe. */\nconst STRIPE_COLLECTIONS = [\n \"transactions\",\n \"stripe_customers\",\n \"stripe_payment_methods\",\n \"stripe_prices\",\n \"stripe_products\",\n];\n\nexport async function generate(options: Options) {\n const isAppMode = options.features.auth;\n const logger = getLogger(options);\n const providers = providersToRemove(options);\n const isStripe = providers.some((provider) => provider.id === \"stripe\");\n const modifies: File[] = [];\n const deletes: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n const envPath = path.join(options.root, \".env\");\n for (const provider of providers) {\n logger.info(`Stripping ${provider.label} credentials from .env`);\n pushResult(\n modifyOutcomeToFile(\n envPath,\n modifyEnvRemove(envPath, envEditsFor(provider)),\n ),\n );\n }\n\n logger.info(\"Removing the currency select from the navbar\");\n const layoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"root-layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n layoutPath,\n unmodifyRootLayoutCurrencySelect(layoutPath),\n ),\n );\n\n // The server half of the store, where enable-payments added it.\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n const layoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.server.ts\",\n );\n const rootLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.svelte\",\n );\n if (fs.existsSync(layoutServerPath)) {\n logger.info(\"Removing the visitor's currency from the server\");\n pushResult(\n modifyOutcomeToFile(\n rootLayoutPath,\n unmodifyLayoutSvelteCurrency(rootLayoutPath),\n ),\n );\n pushResult(\n modifyOutcomeToFile(\n layoutServerPath,\n unmodifyLayoutServerCurrency(layoutServerPath),\n ),\n );\n pushResult(\n modifyOutcomeToFile(\n hooksServerPath,\n unmodifyHooksServerCurrency(hooksServerPath),\n ),\n );\n }\n\n logger.info(\"Removing payment variables from src/env.ts\");\n const envVars = unmodifyEnvVarsFiles(\n options.root,\n providers.flatMap((provider) =>\n (provider.env ?? []).map((variable) => variable.key),\n ),\n );\n pushResult(envVars.modify);\n if (envVars.delete) deletes.push(envVars.delete);\n\n // WhatsApp's order message was listed for wuchale; the module goes, so the\n // entry does too.\n const wuchaleConfig = path.join(options.root, \"wuchale.config.js\");\n if (\n providers.some((provider) => provider.id === \"whatsapp\") &&\n fs.existsSync(wuchaleConfig)\n ) {\n logger.info(\"Removing src/lib/order.ts from wuchale's js adapter\");\n pushResult(\n modifyOutcomeToFile(\n wuchaleConfig,\n modifyWuchaleJsFiles(wuchaleConfig, TRANSLATED_LIB_FILES, \"remove\"),\n ),\n );\n }\n\n // The nav item and the signup link exist only in auth's files, which\n // enable-payments edits for Stripe alone.\n if (isStripe && isAppMode) {\n logger.info(\"Reverting nav-user.svelte\");\n const navUserPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"nav-user.svelte\",\n );\n pushResult(modifyOutcomeToFile(navUserPath, unmodifyNavUser(navUserPath)));\n\n logger.info(\"Reverting signup +page.server.ts\");\n const userSignupPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"(auth)\",\n \"signup\",\n \"+page.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(userSignupPath, unmodifyUserSignup(userSignupPath)),\n );\n }\n\n // Every Stripe collection is planned, whatever auth is now; one that was\n // never created is planned as missing and left alone. Without a backend\n // (no provider detected, on a Shopify project) there is nothing to drop.\n const collectionDrops =\n isStripe && options.features.backend\n ? await planDropsForCollections(STRIPE_COLLECTIONS, options)\n : [];\n\n return {\n creates: [],\n modifies,\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPat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