@velastack/patterns 0.13.0 → 0.13.2

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.
Files changed (228) hide show
  1. package/dist/chunks/{_layout-DQhSAhfF.js → _layout-xBzFhszN.js} +36 -20
  2. package/dist/chunks/_layout-xBzFhszN.js.map +1 -0
  3. package/dist/chunks/{_page-C7kGoW7_.js → _page-44USwLXO.js} +2 -3
  4. package/dist/chunks/{_page-C7kGoW7_.js.map → _page-44USwLXO.js.map} +1 -1
  5. package/dist/chunks/{_page-DoPdZgZv.js → _page-Bt37d4uo.js} +2 -3
  6. package/dist/chunks/_page-Bt37d4uo.js.map +1 -0
  7. package/dist/chunks/{_page-B6yd6_Vl.js → _page-DcbEFpyw.js} +2 -3
  8. package/dist/chunks/_page-DcbEFpyw.js.map +1 -0
  9. package/dist/chunks/{auth-pages-jsyDV1GR.js → auth-pages-BW3_yluN.js} +6 -9
  10. package/dist/chunks/{auth-pages-jsyDV1GR.js.map → auth-pages-BW3_yluN.js.map} +1 -1
  11. package/dist/chunks/{collections-DZOuRpvS.js → collections-CFW9ZqUE.js} +5 -7
  12. package/dist/chunks/{collections-DZOuRpvS.js.map → collections-CFW9ZqUE.js.map} +1 -1
  13. package/dist/chunks/{collections-zEoRuILr.js → collections-D-xbHi4M.js} +39 -45
  14. package/dist/chunks/{collections-zEoRuILr.js.map → collections-D-xbHi4M.js.map} +1 -1
  15. package/dist/chunks/{compose-handle-BBlamPfx.js → compose-handle-Da7m6lV_.js} +3 -4
  16. package/dist/chunks/{compose-handle-BBlamPfx.js.map → compose-handle-Da7m6lV_.js.map} +1 -1
  17. package/dist/chunks/{config-target-BgyFkbFL.js → config-target-DJbVHwHl.js} +3 -4
  18. package/dist/chunks/{config-target-BgyFkbFL.js.map → config-target-DJbVHwHl.js.map} +1 -1
  19. package/dist/chunks/{constants-CUv536Rj.js → constants-DpK-r_m5.js} +2 -4
  20. package/dist/chunks/{constants-CUv536Rj.js.map → constants-DpK-r_m5.js.map} +1 -1
  21. package/dist/chunks/{currency.server-DygAf6a1.js → currency.server-BwuXG0a9.js} +9 -11
  22. package/dist/chunks/{currency.server-DygAf6a1.js.map → currency.server-BwuXG0a9.js.map} +1 -1
  23. package/dist/chunks/{dedent-Gq6Krl4n.js → dedent-CCUOcPFW.js} +2 -3
  24. package/dist/chunks/{dedent-Gq6Krl4n.js.map → dedent-CCUOcPFW.js.map} +1 -1
  25. package/dist/chunks/{dispatch-BIvOwbKN.js → dispatch-BxlKS_5v.js} +2 -3
  26. package/dist/chunks/{dispatch-BIvOwbKN.js.map → dispatch-BxlKS_5v.js.map} +1 -1
  27. package/dist/chunks/{env-BugddEjd.js → env-AxyRWcC_.js} +2 -3
  28. package/dist/chunks/{env-BugddEjd.js.map → env-AxyRWcC_.js.map} +1 -1
  29. package/dist/chunks/{env-vars-mnRA0hOe.js → env-vars-CUh4mLM_.js} +2 -3
  30. package/dist/chunks/{env-vars-mnRA0hOe.js.map → env-vars-CUh4mLM_.js.map} +1 -1
  31. package/dist/chunks/{env-vars-XvAeH6u5.js → env-vars-CVn2076k.js} +58 -59
  32. package/dist/chunks/{env-vars-XvAeH6u5.js.map → env-vars-CVn2076k.js.map} +1 -1
  33. package/dist/chunks/{env-vars-Cr4lbMD_.js → env-vars-T3_7JNSg.js} +3 -4
  34. package/dist/chunks/{env-vars-Cr4lbMD_.js.map → env-vars-T3_7JNSg.js.map} +1 -1
  35. package/dist/chunks/{env-vars-file-B_6esJW3.js → env-vars-file-B2zHQZqO.js} +2 -3
  36. package/dist/chunks/{env-vars-file-B_6esJW3.js.map → env-vars-file-B2zHQZqO.js.map} +1 -1
  37. package/dist/chunks/{env.preview-uMRKT5Pc.js → env.preview-C676UTOP.js} +2 -3
  38. package/dist/chunks/{env.preview-uMRKT5Pc.js.map → env.preview-C676UTOP.js.map} +1 -1
  39. package/dist/chunks/{errors-DR3gF_7a.js → errors-DdSUZI8f.js} +2 -3
  40. package/dist/chunks/{errors-DR3gF_7a.js.map → errors-DdSUZI8f.js.map} +1 -1
  41. package/dist/chunks/{format-result-BVoLVknk.js → format-result-CojavkIZ.js} +2 -3
  42. package/dist/chunks/{format-result-BVoLVknk.js.map → format-result-CojavkIZ.js.map} +1 -1
  43. package/dist/chunks/{generate-Cbg-Z3sA.js → generate-BCYvhyF9.js} +62 -63
  44. package/dist/chunks/{generate-Cbg-Z3sA.js.map → generate-BCYvhyF9.js.map} +1 -1
  45. package/dist/chunks/{generate-DyV5R8NP.js → generate-CKuUg3p-.js} +3 -4
  46. package/dist/chunks/{generate-DyV5R8NP.js.map → generate-CKuUg3p-.js.map} +1 -1
  47. package/dist/chunks/{generate-DjuhSibA.js → generate-CY_Ii_bz.js} +61 -64
  48. package/dist/chunks/{generate-DjuhSibA.js.map → generate-CY_Ii_bz.js.map} +1 -1
  49. package/dist/chunks/generate-CuOm66dn.js +57 -0
  50. package/dist/chunks/{generate-BtWZCvuO.js.map → generate-CuOm66dn.js.map} +1 -1
  51. package/dist/chunks/{generate-BrOPb9tW.js → generate-DYq5Oj58.js} +3 -4
  52. package/dist/chunks/{generate-BrOPb9tW.js.map → generate-DYq5Oj58.js.map} +1 -1
  53. package/dist/chunks/{generate-Crdzw45a.js → generate-F4FDWvFo.js} +13 -14
  54. package/dist/chunks/{generate-Crdzw45a.js.map → generate-F4FDWvFo.js.map} +1 -1
  55. package/dist/chunks/{generate-DgZhFNjO.js → generate-oZ1QeqPr.js} +17 -19
  56. package/dist/chunks/{generate-DgZhFNjO.js.map → generate-oZ1QeqPr.js.map} +1 -1
  57. package/dist/chunks/{generate.runtime-ByC9kOl2.js → generate.runtime-22jW8aVT.js} +37 -41
  58. package/dist/chunks/{generate.runtime-ByC9kOl2.js.map → generate.runtime-22jW8aVT.js.map} +1 -1
  59. package/dist/chunks/{generate.runtime-BfQlxsWK.js → generate.runtime-B06rPt_j.js} +103 -108
  60. package/dist/chunks/{generate.runtime-BfQlxsWK.js.map → generate.runtime-B06rPt_j.js.map} +1 -1
  61. package/dist/chunks/{generate.runtime-s9ai7PxV.js → generate.runtime-B6FeCL5I.js} +85 -90
  62. package/dist/chunks/{generate.runtime-s9ai7PxV.js.map → generate.runtime-B6FeCL5I.js.map} +1 -1
  63. package/dist/chunks/{generate.runtime-DzCVGruq.js → generate.runtime-BgGeOqYG.js} +19 -21
  64. package/dist/chunks/{generate.runtime-DzCVGruq.js.map → generate.runtime-BgGeOqYG.js.map} +1 -1
  65. package/dist/chunks/{generate.runtime-USnFqTbU.js → generate.runtime-Bv_16lWi.js} +94 -99
  66. package/dist/chunks/{generate.runtime-USnFqTbU.js.map → generate.runtime-Bv_16lWi.js.map} +1 -1
  67. package/dist/chunks/generate.runtime-Bz9z0VPR.js +108 -0
  68. package/dist/chunks/{generate.runtime-DVUj1LJK.js.map → generate.runtime-Bz9z0VPR.js.map} +1 -1
  69. package/dist/chunks/{generate.runtime-CHaE6Mm9.js → generate.runtime-C37djibw.js} +25 -27
  70. package/dist/chunks/{generate.runtime-CHaE6Mm9.js.map → generate.runtime-C37djibw.js.map} +1 -1
  71. package/dist/chunks/{generate.runtime-BsjcGBme.js → generate.runtime-CM3bj0nP.js} +12 -14
  72. package/dist/chunks/{generate.runtime-BsjcGBme.js.map → generate.runtime-CM3bj0nP.js.map} +1 -1
  73. package/dist/chunks/generate.runtime-CMuxVUIY.js +46 -0
  74. package/dist/chunks/{generate.runtime-BfM3dX_R.js.map → generate.runtime-CMuxVUIY.js.map} +1 -1
  75. package/dist/chunks/{generate.runtime-DRZDjZqw.js → generate.runtime-CVqPHddZ.js} +44 -46
  76. package/dist/chunks/generate.runtime-CVqPHddZ.js.map +1 -0
  77. package/dist/chunks/{generate.runtime-CEd3qCtW.js → generate.runtime-C_SdcnRs.js} +44 -47
  78. package/dist/chunks/generate.runtime-C_SdcnRs.js.map +1 -0
  79. package/dist/chunks/generate.runtime-Cco2mFW2.js +63 -0
  80. package/dist/chunks/{generate.runtime-taYl9Tg5.js.map → generate.runtime-Cco2mFW2.js.map} +1 -1
  81. package/dist/chunks/generate.runtime-Cg-dfN9B.js +48 -0
  82. package/dist/chunks/{generate.runtime-TKR-qAJM.js.map → generate.runtime-Cg-dfN9B.js.map} +1 -1
  83. package/dist/chunks/{generate.runtime-DqYYJXAz.js → generate.runtime-CjqX4tDg.js} +5 -6
  84. package/dist/chunks/{generate.runtime-DqYYJXAz.js.map → generate.runtime-CjqX4tDg.js.map} +1 -1
  85. package/dist/chunks/generate.runtime-Cry-DBNl.js +111 -0
  86. package/dist/chunks/{generate.runtime-2GD2E1NK.js.map → generate.runtime-Cry-DBNl.js.map} +1 -1
  87. package/dist/chunks/{generate.runtime-DGmpjkRe.js → generate.runtime-Ct7cG8va.js} +76 -79
  88. package/dist/chunks/generate.runtime-Ct7cG8va.js.map +1 -0
  89. package/dist/chunks/generate.runtime-Cxg1b_BK.js +63 -0
  90. package/dist/chunks/{generate.runtime-CXGiQWDK.js.map → generate.runtime-Cxg1b_BK.js.map} +1 -1
  91. package/dist/chunks/{generate.runtime-4TxcYKld.js → generate.runtime-CyWuhV6m.js} +16 -18
  92. package/dist/chunks/{generate.runtime-4TxcYKld.js.map → generate.runtime-CyWuhV6m.js.map} +1 -1
  93. package/dist/chunks/generate.runtime-CzYArKUA.js +42 -0
  94. package/dist/chunks/{generate.runtime-g6qaIY3k.js.map → generate.runtime-CzYArKUA.js.map} +1 -1
  95. package/dist/chunks/{generate.runtime-C_5Ghjri.js → generate.runtime-D769VJFt.js} +3 -4
  96. package/dist/chunks/{generate.runtime-C_5Ghjri.js.map → generate.runtime-D769VJFt.js.map} +1 -1
  97. package/dist/chunks/{generate.runtime-C9yduilW.js → generate.runtime-DICcLOts.js} +19 -22
  98. package/dist/chunks/{generate.runtime-C9yduilW.js.map → generate.runtime-DICcLOts.js.map} +1 -1
  99. package/dist/chunks/generate.runtime-DLg2CKxQ.js +341 -0
  100. package/dist/chunks/generate.runtime-DLg2CKxQ.js.map +1 -0
  101. package/dist/chunks/{generate.runtime-C2pIioyZ.js → generate.runtime-DaPA2NNL.js} +47 -50
  102. package/dist/chunks/{generate.runtime-C2pIioyZ.js.map → generate.runtime-DaPA2NNL.js.map} +1 -1
  103. package/dist/chunks/{generate.runtime-B2DI0x05.js → generate.runtime-DfHFd8xs.js} +36 -44
  104. package/dist/chunks/{generate.runtime-B2DI0x05.js.map → generate.runtime-DfHFd8xs.js.map} +1 -1
  105. package/dist/chunks/generate.runtime-Dfl-07VS.js +428 -0
  106. package/dist/chunks/generate.runtime-Dfl-07VS.js.map +1 -0
  107. package/dist/chunks/{generate.runtime-BO1KyRcJ.js → generate.runtime-DhNspd-h.js} +64 -76
  108. package/dist/chunks/generate.runtime-DhNspd-h.js.map +1 -0
  109. package/dist/chunks/{generate.runtime-BPVZsAL0.js → generate.runtime-DkS7CBmK.js} +8 -10
  110. package/dist/chunks/{generate.runtime-BPVZsAL0.js.map → generate.runtime-DkS7CBmK.js.map} +1 -1
  111. package/dist/chunks/generate.runtime-Dtae524O.js +34 -0
  112. package/dist/chunks/{generate.runtime-Du8puIJQ.js.map → generate.runtime-Dtae524O.js.map} +1 -1
  113. package/dist/chunks/{generate.runtime-CvtSK0E1.js → generate.runtime-EB8vpc7D.js} +57 -66
  114. package/dist/chunks/{generate.runtime-CvtSK0E1.js.map → generate.runtime-EB8vpc7D.js.map} +1 -1
  115. package/dist/chunks/{generate.runtime-UrLaWKvN.js → generate.runtime-TCVlsBbJ.js} +7 -8
  116. package/dist/chunks/{generate.runtime-UrLaWKvN.js.map → generate.runtime-TCVlsBbJ.js.map} +1 -1
  117. package/dist/chunks/{generate.runtime-B8y_l-6N.js → generate.runtime-YFyuyFhh.js} +108 -132
  118. package/dist/chunks/generate.runtime-YFyuyFhh.js.map +1 -0
  119. package/dist/chunks/{generate.runtime-bWGwyz2U.js → generate.runtime-cYh0CQ5d.js} +36 -41
  120. package/dist/chunks/{generate.runtime-bWGwyz2U.js.map → generate.runtime-cYh0CQ5d.js.map} +1 -1
  121. package/dist/chunks/generate.runtime-erWI6j7m.js +64 -0
  122. package/dist/chunks/{generate.runtime-B-WOQsda.js.map → generate.runtime-erWI6j7m.js.map} +1 -1
  123. package/dist/chunks/{generate.runtime-DI73x08q.js → generate.runtime-hq8xt0m_.js} +21 -23
  124. package/dist/chunks/generate.runtime-hq8xt0m_.js.map +1 -0
  125. package/dist/chunks/{generate.runtime-C4hyve9h.js → generate.runtime-i3tMIA1A.js} +85 -108
  126. package/dist/chunks/{generate.runtime-C4hyve9h.js.map → generate.runtime-i3tMIA1A.js.map} +1 -1
  127. package/dist/chunks/generate.runtime-j_5K3Uue.js +120 -0
  128. package/dist/chunks/generate.runtime-j_5K3Uue.js.map +1 -0
  129. package/dist/chunks/{generate.runtime-BEvi6bml.js → generate.runtime-mE0knt2T.js} +34 -38
  130. package/dist/chunks/{generate.runtime-BEvi6bml.js.map → generate.runtime-mE0knt2T.js.map} +1 -1
  131. package/dist/chunks/{layout.svelte-Cb12mxua.js → layout.svelte-B6wOQ7SM.js} +10 -11
  132. package/dist/chunks/{layout.svelte-Cb12mxua.js.map → layout.svelte-B6wOQ7SM.js.map} +1 -1
  133. package/dist/chunks/{lib-specifier-Cngo1zF_.js → lib-specifier-C3M0WTev.js} +2 -3
  134. package/dist/chunks/{lib-specifier-Cngo1zF_.js.map → lib-specifier-C3M0WTev.js.map} +1 -1
  135. package/dist/chunks/{load-function-Dmkhg1pQ.js → load-function-BFvIVsh7.js} +3 -4
  136. package/dist/chunks/{load-function-Dmkhg1pQ.js.map → load-function-BFvIVsh7.js.map} +1 -1
  137. package/dist/chunks/{logger-CQONztPm.js → logger-t1HxmpG2.js} +2 -3
  138. package/dist/chunks/{logger-CQONztPm.js.map → logger-t1HxmpG2.js.map} +1 -1
  139. package/dist/chunks/{modify-file-D9U2LXEa.js → modify-file-CRZ_gMg0.js} +7 -10
  140. package/dist/chunks/{modify-file-D9U2LXEa.js.map → modify-file-CRZ_gMg0.js.map} +1 -1
  141. package/dist/chunks/{modify-nav-user-CJ1LevSU.js → modify-nav-user--7OwY9fI.js} +7 -16
  142. package/dist/chunks/{modify-nav-user-CJ1LevSU.js.map → modify-nav-user--7OwY9fI.js.map} +1 -1
  143. package/dist/chunks/{modify-nav-user-iUpv2lm-.js → modify-nav-user-D42kWyU6.js} +8 -14
  144. package/dist/chunks/{modify-nav-user-iUpv2lm-.js.map → modify-nav-user-D42kWyU6.js.map} +1 -1
  145. package/dist/chunks/modify-svelte-config-remote-wE5K2bU_.js +20 -0
  146. package/dist/chunks/{modify-svelte-config-remote-CEyYydL7.js.map → modify-svelte-config-remote-wE5K2bU_.js.map} +1 -1
  147. package/dist/chunks/{modify-user-signup-DLtopazD.js → modify-user-signup-ENhadGKH.js} +5 -6
  148. package/dist/chunks/{modify-user-signup-DLtopazD.js.map → modify-user-signup-ENhadGKH.js.map} +1 -1
  149. package/dist/chunks/{modify-utils-Cw-on_cL.js → modify-utils--zro3IGe.js} +3 -4
  150. package/dist/chunks/{modify-utils-Cw-on_cL.js.map → modify-utils--zro3IGe.js.map} +1 -1
  151. package/dist/chunks/{package-imports-B9Asv3ZH.js → package-imports-CcIIHbp5.js} +3 -4
  152. package/dist/chunks/{package-imports-B9Asv3ZH.js.map → package-imports-CcIIHbp5.js.map} +1 -1
  153. package/dist/chunks/{pocketbase-C5GS-Dh5.js → pocketbase-CvsJYXj-.js} +2 -3
  154. package/dist/chunks/{pocketbase-C5GS-Dh5.js.map → pocketbase-CvsJYXj-.js.map} +1 -1
  155. package/dist/chunks/{pocketbase-DpudAAmd.js → pocketbase-YG9yht8R.js} +2 -3
  156. package/dist/chunks/{pocketbase-DpudAAmd.js.map → pocketbase-YG9yht8R.js.map} +1 -1
  157. package/dist/chunks/{pocketbase-BTR3gI8o.js → pocketbase-gUn2UrDd.js} +6 -14
  158. package/dist/chunks/{pocketbase-BTR3gI8o.js.map → pocketbase-gUn2UrDd.js.map} +1 -1
  159. package/dist/chunks/{providers-CpRRQdMg.js → providers-BB3Z2TrN.js} +4 -5
  160. package/dist/chunks/{providers-CpRRQdMg.js.map → providers-BB3Z2TrN.js.map} +1 -1
  161. package/dist/chunks/{providers-CL9kQ4hp.js → providers-tjlFH5di.js} +4 -5
  162. package/dist/chunks/{providers-CL9kQ4hp.js.map → providers-tjlFH5di.js.map} +1 -1
  163. package/dist/chunks/{rolldown-runtime-5HNE8Q1r.js → rolldown-runtime-CwxnZyOB.js} +1 -2
  164. package/dist/chunks/{root-layout.svelte-CUVbnlX-.js → root-layout.svelte-DE0c_y-T.js} +12 -16
  165. package/dist/chunks/{root-layout.svelte-CUVbnlX-.js.map → root-layout.svelte-DE0c_y-T.js.map} +1 -1
  166. package/dist/chunks/{shared-CAjLx_8Z.js → shared-DE-J_b1j.js} +4 -5
  167. package/dist/chunks/{shared-CAjLx_8Z.js.map → shared-DE-J_b1j.js.map} +1 -1
  168. package/dist/chunks/{site-D0IuWkAR.js → site-B9hDxucR.js} +11 -12
  169. package/dist/chunks/{site-D0IuWkAR.js.map → site-B9hDxucR.js.map} +1 -1
  170. package/dist/chunks/{stripe-customer-B3tP8gtD.js → stripe-customer-5S-nOXP1.js} +2 -3
  171. package/dist/chunks/stripe-customer-5S-nOXP1.js.map +1 -0
  172. package/dist/chunks/{svelte-file-Dv5-bl79.js → svelte-file-DfplF3BU.js} +2 -3
  173. package/dist/chunks/{svelte-file-Dv5-bl79.js.map → svelte-file-DfplF3BU.js.map} +1 -1
  174. package/dist/chunks/{table-core-BKBoEStB.js → table-core-BXmnfjln.js} +26 -33
  175. package/dist/chunks/{table-core-BKBoEStB.js.map → table-core-BXmnfjln.js.map} +1 -1
  176. package/dist/chunks/{taggedTemplateLiteral-KSUnuvOk.js → taggedTemplateLiteral-CLenToGE.js} +1 -2
  177. package/dist/chunks/test-setup-cZj1tqaf.js +176 -0
  178. package/dist/chunks/test-setup-cZj1tqaf.js.map +1 -0
  179. package/dist/chunks/{ts-morph-helpers-CHI9wAil.js → ts-morph-helpers-B4KZXP44.js} +2 -3
  180. package/dist/chunks/{ts-morph-helpers-CHI9wAil.js.map → ts-morph-helpers-B4KZXP44.js.map} +1 -1
  181. package/dist/chunks/{ui-DD4NltyN.js → ui-D5xgIDR_.js} +3 -4
  182. package/dist/chunks/{ui-DD4NltyN.js.map → ui-D5xgIDR_.js.map} +1 -1
  183. package/dist/chunks/{ui-B3Db8cQg.js → ui-IkdkLwmB.js} +53 -55
  184. package/dist/chunks/{ui-B3Db8cQg.js.map → ui-IkdkLwmB.js.map} +1 -1
  185. package/dist/chunks/{unmodify-load-Buak-r1f.js → unmodify-load-CdWXJ_Ac.js} +3 -4
  186. package/dist/chunks/{unmodify-load-Buak-r1f.js.map → unmodify-load-CdWXJ_Ac.js.map} +1 -1
  187. package/dist/chunks/{util-BLYliuUK.js → util-ILWdjRAd.js} +2 -3
  188. package/dist/chunks/{util-BLYliuUK.js.map → util-ILWdjRAd.js.map} +1 -1
  189. package/dist/chunks/{whatsapp-Pya8Zi07.js → whatsapp-Bt4o4_q2.js} +3 -4
  190. package/dist/chunks/{whatsapp-Pya8Zi07.js.map → whatsapp-Bt4o4_q2.js.map} +1 -1
  191. package/dist/chunks/write-result-C1GYInL8.js +499 -0
  192. package/dist/chunks/write-result-C1GYInL8.js.map +1 -0
  193. package/dist/chunks/{wuchale-config-c3Q4JVSF.js → wuchale-config-CNXoq4rc.js} +2 -3
  194. package/dist/chunks/{wuchale-config-c3Q4JVSF.js.map → wuchale-config-CNXoq4rc.js.map} +1 -1
  195. package/dist/index.js +1497 -1581
  196. package/dist/index.js.map +1 -1
  197. package/package.json +1 -1
  198. package/dist/chunks/_layout-DQhSAhfF.js.map +0 -1
  199. package/dist/chunks/_page-B6yd6_Vl.js.map +0 -1
  200. package/dist/chunks/_page-DoPdZgZv.js.map +0 -1
  201. package/dist/chunks/generate-BtWZCvuO.js +0 -58
  202. package/dist/chunks/generate.runtime-2GD2E1NK.js +0 -114
  203. package/dist/chunks/generate.runtime-7sU7RzIA.js +0 -483
  204. package/dist/chunks/generate.runtime-7sU7RzIA.js.map +0 -1
  205. package/dist/chunks/generate.runtime-B-WOQsda.js +0 -67
  206. package/dist/chunks/generate.runtime-B8y_l-6N.js.map +0 -1
  207. package/dist/chunks/generate.runtime-BO1KyRcJ.js.map +0 -1
  208. package/dist/chunks/generate.runtime-BfM3dX_R.js +0 -48
  209. package/dist/chunks/generate.runtime-CEd3qCtW.js.map +0 -1
  210. package/dist/chunks/generate.runtime-CXGiQWDK.js +0 -64
  211. package/dist/chunks/generate.runtime-DGmpjkRe.js.map +0 -1
  212. package/dist/chunks/generate.runtime-DI73x08q.js.map +0 -1
  213. package/dist/chunks/generate.runtime-DIkM5xIB.js +0 -326
  214. package/dist/chunks/generate.runtime-DIkM5xIB.js.map +0 -1
  215. package/dist/chunks/generate.runtime-DRZDjZqw.js.map +0 -1
  216. package/dist/chunks/generate.runtime-DVUj1LJK.js +0 -112
  217. package/dist/chunks/generate.runtime-Deg1Tz9u.js +0 -124
  218. package/dist/chunks/generate.runtime-Deg1Tz9u.js.map +0 -1
  219. package/dist/chunks/generate.runtime-Du8puIJQ.js +0 -35
  220. package/dist/chunks/generate.runtime-TKR-qAJM.js +0 -50
  221. package/dist/chunks/generate.runtime-g6qaIY3k.js +0 -43
  222. package/dist/chunks/generate.runtime-taYl9Tg5.js +0 -65
  223. package/dist/chunks/modify-svelte-config-remote-CEyYydL7.js +0 -42
  224. package/dist/chunks/stripe-customer-B3tP8gtD.js.map +0 -1
  225. package/dist/chunks/test-setup-CbCXmPkE.js +0 -179
  226. package/dist/chunks/test-setup-CbCXmPkE.js.map +0 -1
  227. package/dist/chunks/write-result-BWXq9RRn.js +0 -499
  228. package/dist/chunks/write-result-BWXq9RRn.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.runtime-DI73x08q.js","names":["dedent","getLogger","withInMemoryScript","modifyOutcomeToFile","SvelteFile","fs","path","CART_BUTTON_MODULE","CART_NAVBAR_ITEM","IMPORT_SNIPPET","FAILURE_HINT","NOT_FOUND_HINT","modifyRootLayoutSvelte","layoutPath","file","out","source","sf","authItem","items","lastItem","hasStripeCustomer","root","generate","logger","options","modifies"],"sources":["../../src/patterns/enable/ecommerce/modifies/root-layout.svelte.ts","../../src/patterns/enable/ecommerce/generate.runtime.ts"],"sourcesContent":["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\nexport const CART_BUTTON_MODULE = \"#lib/components/cart/cart-button.svelte\";\n\nconst CART_NAVBAR_ITEM = \"<Navbar.Item>\\n\\t<CartButton />\\n</Navbar.Item>\";\n\nconst IMPORT_SNIPPET = `import CartButton from '${CART_BUTTON_MODULE}';`;\n\nconst FAILURE_HINT = dedent`\n Add the cart button inside your <Navbar.List> in the root layout.\n\n Import to add to the <script> tag:\n\n ${IMPORT_SNIPPET}\n\n Markup to add inside <Navbar.List>:\n\n ${CART_NAVBAR_ITEM}\n`;\n\nconst NOT_FOUND_HINT = dedent`\n Add the cart button to the layout your public pages share.\n\n Import for the <script> tag:\n\n ${IMPORT_SNIPPET}\n\n Markup, wherever your navigation is:\n\n <CartButton />\n`;\n\n/**\n * Puts the cart button in the navbar: left of the account menu when auth\n * added one, else after the last item.\n */\nexport function modifyRootLayoutSvelte(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(\"Navbar.List\")) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n if (file.hasElement(\"CartButton\")) {\n return { status: \"success\", changed: false };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n { defaultImport: \"CartButton\", moduleSpecifier: CART_BUTTON_MODULE },\n ]);\n });\n return out;\n });\n\n const authItem = file.findElementContaining(\"Navbar.Item\", \"AuthMenu.Root\");\n const items = file.childElements(\"Navbar.List\", \"Navbar.Item\");\n const lastItem = items[items.length - 1];\n if (authItem) {\n file.insertBeforeElement(authItem, CART_NAVBAR_ITEM);\n } else if (lastItem) {\n file.insertAfterElement(lastItem, CART_NAVBAR_ITEM);\n } else {\n file.insertBeforeClosingTag(\n \"Navbar.List\",\n `\\n\\t\\t${CART_NAVBAR_ITEM.replace(/\\n/g, \"\\n\\t\\t\")}\\n\\t`,\n );\n }\n\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\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 { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyRootLayoutSvelte } from \"./modifies/root-layout.svelte\";\n\n/** Created by enable-payments for Stripe when auth was already on. */\nexport function hasStripeCustomer(root: string): boolean {\n return fs.existsSync(\n path.join(root, \"src\", \"lib\", \"server\", \"stripe-customer.ts\"),\n );\n}\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n logger.info(\"Adding the cart to the navbar\");\n const layoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"root-layout.svelte\",\n );\n const file = modifyOutcomeToFile(\n layoutPath,\n modifyRootLayoutSvelte(layoutPath),\n );\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":";;;;;;;;AASA,IAAaO,IAAqB,2CAE5BC,IAAmB,kDAEnBC,IAAiB,2BAA2BF,EAAmB,KAE/DG,IAAe,CAAM;;;;;IAKvBD,EAAe;;;;IAIfD,EAAiB;GAGfG,IAAiB,CAAM;;;;;IAKzBF,EAAe;;;;;;AAWnB,SAAgBG,EAAuB,GAAmC;CACxE,IAAI,CAACP,EAAG,WAAWQ,CAAU,GAC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CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
@@ -1,326 +0,0 @@
1
- import { r as e } from "./lib-specifier-Cngo1zF_.js";
2
- import { t } from "./dedent-Gq6Krl4n.js";
3
- import { n } from "./logger-CQONztPm.js";
4
- import { _ as r, c as i, d as a, h as o, m as s, n as c, o as l, s as u, u as d } from "./ts-morph-helpers-CHI9wAil.js";
5
- import { a as f, r as p } from "./modify-file-D9U2LXEa.js";
6
- import { t as m } from "./svelte-file-Dv5-bl79.js";
7
- import { n as h } from "./compose-handle-BBlamPfx.js";
8
- import { a as g, o as _, s as v, t as y } from "./config-target-BgyFkbFL.js";
9
- import { r as b } from "./package-imports-B9Asv3ZH.js";
10
- import { r as x, t as S } from "./_layout-DQhSAhfF.js";
11
- import C from "node:fs";
12
- import w from "node:path";
13
- import { Project as T, QuoteKind as E, SyntaxKind as D } from "ts-morph";
14
- //#region src/patterns/disable/i18n/modifies/gitignore.ts
15
- function O(e) {
16
- if (!C.existsSync(e)) return {
17
- status: "success",
18
- changed: !1
19
- };
20
- let t = C.readFileSync(e, "utf8");
21
- if (!t.includes("src/locales/.wuchale")) return {
22
- status: "success",
23
- changed: !1
24
- };
25
- let n = t.split("\n"), r = [];
26
- for (let e = 0; e < n.length; e++) {
27
- let t = n[e];
28
- if (t === "# Wuchale") {
29
- let t = e + 1, r = !1;
30
- for (; t < n.length && n[t].trim() !== "";) n[t] === "src/locales/.wuchale" && (r = !0), t++;
31
- if (r) {
32
- e = t;
33
- continue;
34
- }
35
- }
36
- t !== "src/locales/.wuchale" && r.push(t);
37
- }
38
- let i = r.join("\n");
39
- return i = i.replace(/\n{3,}/g, "\n\n"), i === t ? {
40
- status: "success",
41
- changed: !1
42
- } : (C.writeFileSync(e, i), {
43
- status: "success",
44
- changed: !0
45
- });
46
- }
47
- //#endregion
48
- //#region src/patterns/disable/i18n/modifies/vite-config.ts
49
- function k(e) {
50
- if (!C.existsSync(e)) return {
51
- status: "success",
52
- changed: !1
53
- };
54
- let t = C.readFileSync(e, "utf8");
55
- if (!t.includes("wuchale")) return {
56
- status: "success",
57
- changed: !1
58
- };
59
- let n = new T({
60
- compilerOptions: { allowJs: !0 },
61
- manipulationSettings: { quoteKind: E.Single }
62
- }).addSourceFileAtPath(e);
63
- for (;;) {
64
- let e = !1;
65
- for (let t of n.getDescendantsOfKind(D.ArrayLiteralExpression)) {
66
- let n = t.getElements().findIndex((e) => e.getText().replace(/\s/g, "") === "wuchale()");
67
- if (n >= 0) {
68
- t.removeElement(n), e = !0;
69
- break;
70
- }
71
- }
72
- if (!e) break;
73
- }
74
- return d(n, "wuchale/vite"), l(n), n.saveSync(), {
75
- status: "success",
76
- changed: n.getFullText() !== t
77
- };
78
- }
79
- //#endregion
80
- //#region src/patterns/disable/i18n/modifies/locales-alias.ts
81
- var A = {
82
- notFound: "No SvelteKit config to revert.",
83
- failed: "Remove the $locales alias from the sveltekit() arg in vite.config by hand."
84
- };
85
- function j(e) {
86
- let t = _(e, A);
87
- if (t.status === "not-found") return {
88
- filePath: t.filePath,
89
- outcome: {
90
- status: "success",
91
- changed: !1
92
- }
93
- };
94
- if (t.status === "failed") return {
95
- filePath: t.filePath,
96
- outcome: {
97
- status: "failed",
98
- message: t.message
99
- }
100
- };
101
- let { target: n } = t, r = n.configObject.getProperty("alias")?.asKind(D.PropertyAssignment), i = r?.getInitializer()?.asKind(D.ObjectLiteralExpression), a = i?.getProperties().find((e) => e.getText().replace(/['"]/g, "").startsWith("$locales"));
102
- return r && i && a && (a.remove(), i.getProperties().length === 0 && r.remove()), {
103
- filePath: n.filePath,
104
- outcome: v(n)
105
- };
106
- }
107
- //#endregion
108
- //#region src/patterns/disable/i18n/modifies/locales-module.ts
109
- function M(e) {
110
- let t = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), n = RegExp(`^[$#]locales/${t}(\\.js)?$`);
111
- return (e) => n.test(e);
112
- }
113
- //#endregion
114
- //#region src/patterns/disable/i18n/modifies/hooks.server.ts
115
- var N = "handleWuchale", P = t`
116
- Take handleWuchale out of the exported handle in src/hooks.server.ts, then
117
- remove its declaration, the loadLocales(...) calls and the wuchale and
118
- #locales imports.
119
- `, F = [
120
- "wuchale/load-utils/server",
121
- M("main.url"),
122
- M("data"),
123
- M("main.loader.server.svelte"),
124
- M("js.loader.server")
125
- ];
126
- function I(e) {
127
- if (!C.existsSync(e)) return {
128
- status: "success",
129
- changed: !1
130
- };
131
- let t = C.readFileSync(e, "utf8");
132
- if (!t.includes(N) && !t.includes("loadLocales(")) return {
133
- status: "success",
134
- changed: !1
135
- };
136
- let n = new T({
137
- compilerOptions: { allowJs: !0 },
138
- manipulationSettings: { quoteKind: E.Single }
139
- }).addSourceFileAtPath(e);
140
- for (;;) {
141
- let e = n.getStatements().find((e) => e.getKind() === D.ExpressionStatement && /^loadLocales\s*\(/.test(e.getText()));
142
- if (!e) break;
143
- e.remove();
144
- }
145
- if (h(n, N).status === "unsupported") return {
146
- status: "failed",
147
- message: P
148
- };
149
- o(n, N);
150
- for (let e of F) d(n, e);
151
- return a(n, "@sveltejs/kit/hooks", "sequence"), a(n, "@sveltejs/kit/hooks", "Handle"), a(n, "@sveltejs/kit", "Handle"), l(n), c(n), n.saveSync(), {
152
- status: "success",
153
- changed: n.getFullText() !== t
154
- };
155
- }
156
- //#endregion
157
- //#region src/patterns/disable/i18n/modifies/hooks.ts
158
- var L = "rerouteDeLocalize", R = t`
159
- Take rerouteDeLocalize out of the exported reroute in src/hooks.ts, then
160
- remove its declaration and the wuchale and #locales imports.
161
- `, z = [
162
- "wuchale/url",
163
- M("main.url"),
164
- M("data")
165
- ], B = /^\(\s*\{\s*url\s*\}\s*\)\s*=>\s*rerouteDeLocalize\(\s*url\.pathname\s*\)$/, V = /^\(\s*\{\s*url\s*\}\s*\)\s*=>\s*rerouteDeLocalize\(\s*negotiateReroute\(\s*url\.pathname\s*\)\s*\)$/;
166
- function H(e) {
167
- if (!C.existsSync(e)) return {
168
- status: "success",
169
- changed: !1
170
- };
171
- let t = C.readFileSync(e, "utf8");
172
- if (!t.includes(L)) return {
173
- status: "success",
174
- changed: !1
175
- };
176
- let n = new T({
177
- compilerOptions: { allowJs: !0 },
178
- manipulationSettings: { quoteKind: E.Single }
179
- }).addSourceFileAtPath(e), r = n.getVariableDeclaration(L)?.getFirstAncestorByKind(D.VariableStatement), a = n.getVariableDeclaration("reroute"), s = a?.getInitializer()?.getText() ?? "", d = V.test(s), f = d || B.test(s) ? a?.getFirstAncestorByKind(D.VariableStatement) : void 0;
180
- return n.getStatements().filter((e) => e !== r && e !== f && e.getText().includes(L)).length > 0 ? {
181
- status: "failed",
182
- message: R
183
- } : (d ? a?.setInitializer("({ url }) => negotiateReroute(url.pathname)") : f && o(n, "reroute"), o(n, L), i(n, z), u(n) ? (C.writeFileSync(e, "", "utf8"), {
184
- status: "success",
185
- changed: !0
186
- }) : (l(n), c(n), n.saveSync(), {
187
- status: "success",
188
- changed: n.getFullText() !== t
189
- }));
190
- }
191
- //#endregion
192
- //#region src/patterns/disable/i18n/modifies/app-html.ts
193
- function U(e) {
194
- if (!C.existsSync(e)) return {
195
- status: "success",
196
- changed: !1
197
- };
198
- let t = C.readFileSync(e, "utf8"), n = t.replace(/lang\s*=\s*(?:"%sveltekit\.lang%"|'%sveltekit\.lang%')/g, "lang=\"en\"");
199
- return n === t ? {
200
- status: "success",
201
- changed: !1
202
- } : (C.writeFileSync(e, n, "utf8"), {
203
- status: "success",
204
- changed: !0
205
- });
206
- }
207
- //#endregion
208
- //#region src/patterns/disable/i18n/modifies/+layout.ts
209
- var W = t`
210
- src/routes/+layout.ts still loads wuchale locales. Remove these from it:
211
-
212
- import { browser } from '$app/env';
213
- import { loadLocale } from 'wuchale/load-utils';
214
- import { getLocale } from '#locales/main.url.js';
215
- import '#locales/main.loader.svelte.js';
216
- import '#locales/js.loader.js';
217
-
218
- and the loadLocale(...) call inside load().
219
- `, G = [M("main.loader.svelte"), M("js.loader")], K = [
220
- (e) => /^\$app\/env(ironment)?$/.test(e),
221
- "wuchale/load-utils",
222
- M("main.url")
223
- ];
224
- function q(e) {
225
- return e.replace(/["']/g, "'").replace(/\s+/g, "");
226
- }
227
- function J(e) {
228
- if (!C.existsSync(e)) return {
229
- status: "success",
230
- changed: !1
231
- };
232
- let t = C.readFileSync(e, "utf8");
233
- if (!t.includes("loadLocale") && !/[$#]locales\//.test(t)) return {
234
- status: "success",
235
- changed: !1
236
- };
237
- let n = new T({
238
- compilerOptions: { allowJs: !0 },
239
- manipulationSettings: { quoteKind: E.Single }
240
- }).addSourceFileAtPath(e), r = n.getVariableStatements().find((e) => e.getDeclarations().some((e) => e.getName() === "load")) ?? n.getFunction("load");
241
- if (r) {
242
- if (q(r.getText()) !== q(S)) return {
243
- status: "failed",
244
- message: W
245
- };
246
- s(n, r);
247
- }
248
- for (let e of G) d(n, e);
249
- return i(n, K), u(n) ? (C.writeFileSync(e, "", "utf8"), {
250
- status: "success",
251
- changed: !0
252
- }) : (l(n), c(n), n.saveSync(), {
253
- status: "success",
254
- changed: n.getFullText() !== t
255
- });
256
- }
257
- //#endregion
258
- //#region src/patterns/disable/i18n/modifies/root-layout.svelte.ts
259
- function Y(t) {
260
- if (!C.existsSync(t)) return {
261
- status: "success",
262
- changed: !1
263
- };
264
- let n = C.readFileSync(t, "utf8");
265
- if (!n.includes("LanguageSelect")) return {
266
- status: "success",
267
- changed: !1
268
- };
269
- let i = m.fromPath(t);
270
- i.modifyScript((t) => {
271
- let { source: n } = r(t, (t) => {
272
- d(t, e("components/language-select.svelte")), c(t);
273
- });
274
- return n;
275
- });
276
- let a = i.toString();
277
- return a = a.replace(/[ \t]*<Navbar\.Item>\s*<LanguageSelect\s*\/>\s*<\/Navbar\.Item>[ \t]*\r?\n?/g, ""), a = a.replace(/[ \t]*<LanguageSelect\s*\/>[ \t]*\r?\n?/g, ""), C.writeFileSync(t, a, "utf8"), {
278
- status: "success",
279
- changed: a !== n
280
- };
281
- }
282
- //#endregion
283
- //#region src/patterns/disable/i18n/generate.runtime.ts
284
- async function X(e) {
285
- let t = n(e), r = [], i = [], a = (e) => {
286
- e && r.push(e);
287
- };
288
- t.info("Reverting vite.config");
289
- let o = g(e.root, y) ?? w.join(e.root, y[0]);
290
- a(p(o, k(o))), t.info("Removing #locales from package.json imports");
291
- let s = b(e.root, Object.keys(x), x);
292
- a(p(s.filePath, s.outcome)), t.info("Reverting the legacy $locales alias");
293
- let c = j(e.root);
294
- a(p(c.filePath, c.outcome)), t.info("Reverting hooks.server.ts");
295
- let l = w.join(e.root, "src", "hooks.server.ts"), u = f(l, I(l));
296
- a(u.modify), u.delete && i.push(u.delete), t.info("Reverting hooks.ts");
297
- let d = w.join(e.root, "src", "hooks.ts"), m = f(d, H(d));
298
- a(m.modify), m.delete && i.push(m.delete), t.info("Reverting app.html");
299
- let h = w.join(e.root, "src", "app.html");
300
- a(p(h, U(h))), t.info("Reverting root +layout.ts");
301
- let _ = w.join(e.root, "src", "routes", "+layout.ts"), v = f(_, J(_));
302
- a(v.modify), v.delete && i.push(v.delete), t.info("Reverting root layout language select");
303
- let S = [
304
- w.join(e.root, "src", "routes", "(public)", "root-layout.svelte"),
305
- w.join(e.root, "src", "routes", "root-layout.svelte"),
306
- w.join(e.root, "src", "routes", "(public)", "+layout.svelte"),
307
- w.join(e.root, "src", "routes", "+layout.svelte")
308
- ];
309
- for (let e of S) C.existsSync(e) && a(p(e, Y(e)));
310
- t.info("Reverting .gitignore");
311
- let T = w.join(e.root, ".gitignore");
312
- return a(p(T, O(T))), {
313
- creates: [],
314
- modifies: r,
315
- deletes: i,
316
- components: [],
317
- packages: [],
318
- collections: [],
319
- collectionPatches: [],
320
- collectionDrops: []
321
- };
322
- }
323
- //#endregion
324
- export { X as generate };
325
-
326
- //# sourceMappingURL=generate.runtime-DIkM5xIB.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.runtime-DIkM5xIB.js","names":["FAILURE_HINT","I18N_MODULES","FAILURE_HINT","libModule","withInMemoryScript","pruneUnusedImports","removeNamedImportIfUnused","removeTopLevelStatementByIdentifier","removeStatementWithComments","ensureBlankLineAfterImports","formatLikeSource","isEffectivelyEmpty","removeImportByModuleSpecifier","revertOutcomeToFile","modifyOutcomeToFile","SvelteFile","removeHandle","probeFirstExisting","resolveConfigTarget","saveTarget","VITE_CONFIG_CANDIDATES","removePackageImports","LOCALES_IMPORTS","LOAD_STATEMENT","fs","path","unmodifyGitignore","gitignorePath","original","lines","out","i","line","j","hasWuchale","updated","unmodifyViteConfig","viteConfigPath","sourceFile","Project","QuoteKind","removed","arr","SyntaxKind","index","el","HINTS","unmodifyLocalesAlias","res","root","aliasProp","target","aliasObj","locales","p","localesModule","escaped","name","pattern","specifier","I18N_HANDLE","FAILURE_HINT$2","I18N_MODULES$1","unmodifyHooksServerI18n","hooksServerPath","stmt","s","moduleSpecifier","DELOCALIZE_HELPER","FAILURE_HINT$1","I18N_MODULES","I18N_ONLY_REROUTE","COMPOSED_REROUTE","unmodifyHooksI18n","hooksPath","helperStatement","rerouteDecl","initText","composed","rerouteStatement","unmodifyAppHtml","appHtmlPath","FAILURE_HINT","SIDE_EFFECT_MODULES","BINDING_MODULES","normalize","source","unmodifyRootLayoutI18n","layoutPath","loadStatement","d","unmodifyRootLayoutLanguageSelect","file","sf","generate","logger","getLogger","options","modifies","deletes","pushResult","imports","alias","hooksServerRevert","hooksRevert","layoutRevert","rootLayoutCandidates","candidate"],"sources":["../../src/patterns/disable/i18n/modifies/gitignore.ts","../../src/patterns/disable/i18n/modifies/vite-config.ts","../../src/patterns/disable/i18n/modifies/locales-alias.ts","../../src/patterns/disable/i18n/modifies/locales-module.ts","../../src/patterns/disable/i18n/modifies/hooks.server.ts","../../src/patterns/disable/i18n/modifies/hooks.ts","../../src/patterns/disable/i18n/modifies/app-html.ts","../../src/patterns/disable/i18n/modifies/+layout.ts","../../src/patterns/disable/i18n/modifies/root-layout.svelte.ts","../../src/patterns/disable/i18n/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyGitignore(gitignorePath: string): ModifyOutcome {\n if (!fs.existsSync(gitignorePath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(gitignorePath, \"utf8\");\n if (!original.includes(\"src/locales/.wuchale\")) {\n return { status: \"success\", changed: false };\n }\n\n const lines = original.split(\"\\n\");\n const out: string[] = [];\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === \"# Wuchale\") {\n let j = i + 1;\n let hasWuchale = false;\n while (j < lines.length && lines[j].trim() !== \"\") {\n if (lines[j] === \"src/locales/.wuchale\") {\n hasWuchale = true;\n }\n j++;\n }\n if (hasWuchale) {\n i = j;\n continue;\n }\n }\n if (line === \"src/locales/.wuchale\") continue;\n out.push(line);\n }\n\n let updated = out.join(\"\\n\");\n updated = updated.replace(/\\n{3,}/g, \"\\n\\n\");\n\n if (updated === original) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(gitignorePath, updated);\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 removeImportByModuleSpecifier,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\n/** Remove `wuchale()` from the Vite plugins and its import. */\nexport function unmodifyViteConfig(viteConfigPath: string): ModifyOutcome {\n if (!fs.existsSync(viteConfigPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(viteConfigPath, \"utf8\");\n if (!original.includes(\"wuchale\")) {\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(viteConfigPath);\n\n // One removal at a time: manipulating the tree invalidates sibling nodes.\n for (;;) {\n let removed = false;\n for (const arr of sourceFile.getDescendantsOfKind(\n SyntaxKind.ArrayLiteralExpression,\n )) {\n const index = arr\n .getElements()\n .findIndex((el) => el.getText().replace(/\\s/g, \"\") === \"wuchale()\");\n if (index >= 0) {\n arr.removeElement(index);\n removed = true;\n break;\n }\n }\n if (!removed) break;\n }\n\n removeImportByModuleSpecifier(sourceFile, \"wuchale/vite\");\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import { SyntaxKind } from \"ts-morph\";\nimport {\n resolveConfigTarget,\n saveTarget,\n type ConfigModifyResult,\n} from \"../../../../runtime/config-target\";\n\nconst HINTS = {\n notFound: \"No SvelteKit config to revert.\",\n failed:\n \"Remove the $locales alias from the sveltekit() arg in vite.config by hand.\",\n};\n\n/**\n * Remove the `$locales` alias enable-i18n wrote before SvelteKit 3, which\n * `sv migrate sveltekit-3` moves into the inline `sveltekit({...})` arg;\n * `alias` goes too once it is empty. Projects enabled since then map\n * `#locales/*` in package.json `imports` instead.\n */\nexport function unmodifyLocalesAlias(root: string): ConfigModifyResult {\n const res = resolveConfigTarget(root, HINTS);\n // Nothing to revert in a project without a config.\n if (res.status === \"not-found\") {\n return {\n filePath: res.filePath,\n outcome: { status: \"success\", changed: false },\n };\n }\n if (res.status === \"failed\") {\n return {\n filePath: res.filePath,\n outcome: { status: \"failed\", message: res.message },\n };\n }\n\n const { target } = res;\n const aliasProp = target.configObject\n .getProperty(\"alias\")\n ?.asKind(SyntaxKind.PropertyAssignment);\n const aliasObj = aliasProp\n ?.getInitializer()\n ?.asKind(SyntaxKind.ObjectLiteralExpression);\n const locales = aliasObj\n ?.getProperties()\n .find((p) => p.getText().replace(/['\"]/g, \"\").startsWith(\"$locales\"));\n if (aliasProp && aliasObj && locales) {\n locales.remove();\n if (aliasObj.getProperties().length === 0) aliasProp.remove();\n }\n return { filePath: target.filePath, outcome: saveTarget(target) };\n}\n","/**\n * Matches an import of wuchale's `src/locales/<name>.js` the way enable-i18n\n * writes it (`#locales/main.url.js`), and the `$locales/main.url` alias form\n * it wrote before SvelteKit 3, so disabling works on either.\n */\nexport function localesModule(name: string): (specifier: string) => boolean {\n const escaped = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const pattern = new RegExp(`^[$#]locales/${escaped}(\\\\.js)?$`);\n return (specifier) => pattern.test(specifier);\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { removeHandle } from \"../../../../runtime/compose-handle\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n removeNamedImportIfUnused,\n removeTopLevelStatementByIdentifier,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { localesModule } from \"./locales-module\";\n\nconst I18N_HANDLE = \"handleWuchale\";\nconst FAILURE_HINT = dedent`\n Take handleWuchale out of the exported handle in src/hooks.server.ts, then\n remove its declaration, the loadLocales(...) calls and the wuchale and\n #locales imports.\n`;\n\nconst I18N_MODULES = [\n \"wuchale/load-utils/server\",\n localesModule(\"main.url\"),\n localesModule(\"data\"),\n localesModule(\"main.loader.server.svelte\"),\n localesModule(\"js.loader.server\"),\n];\n\n/**\n * Undo `modifyHooksServerI18n`: drop the locale bootstrap, the wuchale handle\n * and its imports, and unwrap `sequence(handleWuchale, ...)`. A file that\n * enable-i18n created comes out empty, for the caller to delete.\n */\nexport function unmodifyHooksServerI18n(\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 (!original.includes(I18N_HANDLE) && !original.includes(\"loadLocales(\")) {\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 // loadLocales(...) bootstrap calls, one at a time (removal invalidates siblings).\n for (;;) {\n const stmt = sourceFile\n .getStatements()\n .find(\n (s) =>\n s.getKind() === SyntaxKind.ExpressionStatement &&\n /^loadLocales\\s*\\(/.test(s.getText()),\n );\n if (!stmt) break;\n stmt.remove();\n }\n\n // `export const handle = handleWuchale` goes altogether; a sequence loses\n // the argument, or unwraps to the handle it composed with.\n const removed = removeHandle(sourceFile, I18N_HANDLE);\n if (removed.status === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n removeTopLevelStatementByIdentifier(sourceFile, I18N_HANDLE);\n for (const moduleSpecifier of I18N_MODULES) {\n removeImportByModuleSpecifier(sourceFile, moduleSpecifier);\n }\n removeNamedImportIfUnused(sourceFile, \"@sveltejs/kit/hooks\", \"sequence\");\n removeNamedImportIfUnused(sourceFile, \"@sveltejs/kit/hooks\", \"Handle\");\n // A project from before SvelteKit 3 imports it from the package root.\n removeNamedImportIfUnused(sourceFile, \"@sveltejs/kit\", \"Handle\");\n\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 { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n ensureBlankLineAfterImports,\n isEffectivelyEmpty,\n pruneUnusedImports,\n removeTopLevelStatementByIdentifier,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { localesModule } from \"./locales-module\";\n\nconst DELOCALIZE_HELPER = \"rerouteDeLocalize\";\n\nconst FAILURE_HINT = dedent`\n Take rerouteDeLocalize out of the exported reroute in src/hooks.ts, then\n remove its declaration and the wuchale and #locales imports.\n`;\n\nconst I18N_MODULES = [\n \"wuchale/url\",\n localesModule(\"main.url\"),\n localesModule(\"data\"),\n];\n\n/** The two reroutes `modifyHooksI18n` writes: on its own, and composed. */\nconst I18N_ONLY_REROUTE =\n /^\\(\\s*\\{\\s*url\\s*\\}\\s*\\)\\s*=>\\s*rerouteDeLocalize\\(\\s*url\\.pathname\\s*\\)$/;\nconst COMPOSED_REROUTE =\n /^\\(\\s*\\{\\s*url\\s*\\}\\s*\\)\\s*=>\\s*rerouteDeLocalize\\(\\s*negotiateReroute\\(\\s*url\\.pathname\\s*\\)\\s*\\)$/;\n\n/**\n * Undo `modifyHooksI18n`: drop the de-localizer and its imports, leaving the\n * negotiation reroute it may have been composed with. A file that enable-i18n\n * created comes out empty, for the caller to delete.\n */\nexport function unmodifyHooksI18n(hooksPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksPath, \"utf8\");\n if (!original.includes(DELOCALIZE_HELPER)) {\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 helperStatement = sourceFile\n .getVariableDeclaration(DELOCALIZE_HELPER)\n ?.getFirstAncestorByKind(SyntaxKind.VariableStatement);\n\n const rerouteDecl = sourceFile.getVariableDeclaration(\"reroute\");\n const initText = rerouteDecl?.getInitializer()?.getText() ?? \"\";\n const composed = COMPOSED_REROUTE.test(initText);\n const rerouteStatement =\n composed || I18N_ONLY_REROUTE.test(initText)\n ? rerouteDecl?.getFirstAncestorByKind(SyntaxKind.VariableStatement)\n : undefined;\n\n // Anything else reading the de-localizer is code enable-i18n did not write,\n // so undoing it is the developer's call.\n const otherReaders = sourceFile\n .getStatements()\n .filter(\n (s) =>\n s !== helperStatement &&\n s !== rerouteStatement &&\n s.getText().includes(DELOCALIZE_HELPER),\n );\n if (otherReaders.length > 0) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n if (composed) {\n // content-negotiation's reroute is underneath; it stays.\n rerouteDecl?.setInitializer(\"({ url }) => negotiateReroute(url.pathname)\");\n } else if (rerouteStatement) {\n removeTopLevelStatementByIdentifier(sourceFile, \"reroute\");\n }\n\n removeTopLevelStatementByIdentifier(sourceFile, DELOCALIZE_HELPER);\n pruneUnusedImports(sourceFile, I18N_MODULES);\n\n if (isEffectivelyEmpty(sourceFile)) {\n // Emptied rather than removed: the runtime turns an empty hooks.ts into a\n // delete entry, so the removal is written and reported like any other.\n fs.writeFileSync(hooksPath, \"\", \"utf8\");\n return { status: \"success\", changed: true };\n }\n\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 type { ModifyOutcome } from \"../../../../core/types\";\n\n/**\n * Put a real language back. `%sveltekit.lang%` is not a SvelteKit\n * placeholder; only the wuchale hook replaced it, so without that hook it\n * would be served literally.\n */\nexport function unmodifyAppHtml(appHtmlPath: string): ModifyOutcome {\n if (!fs.existsSync(appHtmlPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(appHtmlPath, \"utf8\");\n const updated = original.replace(\n /lang\\s*=\\s*(?:\"%sveltekit\\.lang%\"|'%sveltekit\\.lang%')/g,\n 'lang=\"en\"',\n );\n if (updated === original) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(appHtmlPath, updated, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, type Statement } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { LOAD_STATEMENT } from \"../../../enable/i18n/modifies/+layout\";\nimport {\n ensureBlankLineAfterImports,\n isEffectivelyEmpty,\n pruneUnusedImports,\n removeImportByModuleSpecifier,\n removeStatementWithComments,\n formatLikeSource,\n type ModuleMatch,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { localesModule } from \"./locales-module\";\n\nconst FAILURE_HINT = dedent`\n src/routes/+layout.ts still loads wuchale locales. Remove these from it:\n\n import { browser } from '$app/env';\n import { loadLocale } from 'wuchale/load-utils';\n import { getLocale } from '#locales/main.url.js';\n import '#locales/main.loader.svelte.js';\n import '#locales/js.loader.js';\n\n and the loadLocale(...) call inside load().\n`;\n\nconst SIDE_EFFECT_MODULES = [\n localesModule(\"main.loader.svelte\"),\n localesModule(\"js.loader\"),\n];\nconst BINDING_MODULES: ModuleMatch[] = [\n // `$app/env`, or the module it replaced before SvelteKit 3.\n (specifier) => /^\\$app\\/env(ironment)?$/.test(specifier),\n \"wuchale/load-utils\",\n localesModule(\"main.url\"),\n];\n\nfunction normalize(source: string): string {\n return source.replace(/[\"']/g, \"'\").replace(/\\s+/g, \"\");\n}\n\n/**\n * Undo `ensureRootLayoutI18n`: drop the wuchale load and its imports, leaving\n * whatever else the file holds. A file enable-i18n wrote whole comes out\n * empty, for the caller to delete.\n */\nexport function unmodifyRootLayoutI18n(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutPath, \"utf8\");\n if (!original.includes(\"loadLocale\") && !/[$#]locales\\//.test(original)) {\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(layoutPath);\n\n const loadStatement: Statement | undefined =\n sourceFile\n .getVariableStatements()\n .find((s) => s.getDeclarations().some((d) => d.getName() === \"load\")) ??\n sourceFile.getFunction(\"load\");\n\n if (loadStatement) {\n // A load that grew code of its own needs a hand; only the one enable-i18n\n // wrote is safe to take out wholesale.\n if (normalize(loadStatement.getText()) !== normalize(LOAD_STATEMENT)) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n removeStatementWithComments(sourceFile, loadStatement);\n }\n\n for (const moduleSpecifier of SIDE_EFFECT_MODULES) {\n removeImportByModuleSpecifier(sourceFile, moduleSpecifier);\n }\n pruneUnusedImports(sourceFile, BINDING_MODULES);\n\n if (isEffectivelyEmpty(sourceFile)) {\n // Emptied rather than removed: the runtime turns an empty +layout.ts into\n // a delete entry, so the removal is written and reported like any other.\n fs.writeFileSync(layoutPath, \"\", \"utf8\");\n return { status: \"success\", changed: true };\n }\n\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 { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\n\n/** Take the language select (and the nav item enable-i18n wrapped it in) back out. */\nexport function unmodifyRootLayoutLanguageSelect(\n layoutPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutPath, \"utf8\");\n if (!original.includes(\"LanguageSelect\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n removeImportByModuleSpecifier(\n sf,\n libModule(\"components/language-select.svelte\"),\n );\n ensureBlankLineAfterImports(sf);\n });\n return out;\n });\n\n let updated = file.toString();\n updated = updated.replace(\n /[ \\t]*<Navbar\\.Item>\\s*<LanguageSelect\\s*\\/>\\s*<\\/Navbar\\.Item>[ \\t]*\\r?\\n?/g,\n \"\",\n );\n updated = updated.replace(/[ \\t]*<LanguageSelect\\s*\\/>[ \\t]*\\r?\\n?/g, \"\");\n\n fs.writeFileSync(layoutPath, updated, \"utf8\");\n return { status: \"success\", changed: updated !== original };\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 {\n probeFirstExisting,\n VITE_CONFIG_CANDIDATES,\n} from \"../../../runtime/config-target\";\nimport { unmodifyGitignore } from \"./modifies/gitignore\";\nimport { unmodifyViteConfig } from \"./modifies/vite-config\";\nimport { unmodifyLocalesAlias } from \"./modifies/locales-alias\";\nimport { removePackageImports } from \"../../../runtime/package-imports\";\nimport { LOCALES_IMPORTS } from \"../../enable/i18n/modifies/package-imports\";\nimport { unmodifyHooksServerI18n } from \"./modifies/hooks.server\";\nimport { unmodifyHooksI18n } from \"./modifies/hooks\";\nimport { unmodifyAppHtml } from \"./modifies/app-html\";\nimport { unmodifyRootLayoutI18n } from \"./modifies/+layout\";\nimport { unmodifyRootLayoutLanguageSelect } from \"./modifies/root-layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const deletes: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Reverting vite.config\");\n const viteConfigPath =\n probeFirstExisting(options.root, VITE_CONFIG_CANDIDATES) ??\n path.join(options.root, VITE_CONFIG_CANDIDATES[0]);\n pushResult(\n modifyOutcomeToFile(viteConfigPath, unmodifyViteConfig(viteConfigPath)),\n );\n\n logger.info(\"Removing #locales from package.json imports\");\n // Only while it still maps where enable-i18n pointed it.\n const imports = removePackageImports(\n options.root,\n Object.keys(LOCALES_IMPORTS),\n LOCALES_IMPORTS,\n );\n pushResult(modifyOutcomeToFile(imports.filePath, imports.outcome));\n\n // A project enabled before SvelteKit 3 has the `$locales` alias instead,\n // moved into the sveltekit() arg by `vela migrate sveltekit-3`.\n logger.info(\"Reverting the legacy $locales alias\");\n const alias = unmodifyLocalesAlias(options.root);\n pushResult(modifyOutcomeToFile(alias.filePath, alias.outcome));\n\n logger.info(\"Reverting hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n // enable-i18n may have created it; emptied, it goes.\n const hooksServerRevert = revertOutcomeToFile(\n hooksServerPath,\n unmodifyHooksServerI18n(hooksServerPath),\n );\n pushResult(hooksServerRevert.modify);\n if (hooksServerRevert.delete) deletes.push(hooksServerRevert.delete);\n\n logger.info(\"Reverting hooks.ts\");\n const hooksPath = path.join(options.root, \"src\", \"hooks.ts\");\n // The de-localizing reroute may be all it holds; emptied, it goes.\n const hooksRevert = revertOutcomeToFile(\n hooksPath,\n unmodifyHooksI18n(hooksPath),\n );\n pushResult(hooksRevert.modify);\n if (hooksRevert.delete) deletes.push(hooksRevert.delete);\n\n logger.info(\"Reverting app.html\");\n const appHtmlPath = path.join(options.root, \"src\", \"app.html\");\n pushResult(modifyOutcomeToFile(appHtmlPath, unmodifyAppHtml(appHtmlPath)));\n\n logger.info(\"Reverting root +layout.ts\");\n const layoutPath = path.join(options.root, \"src\", \"routes\", \"+layout.ts\");\n // enable-i18n may have written the whole file; emptied, it goes.\n const layoutRevert = revertOutcomeToFile(\n layoutPath,\n unmodifyRootLayoutI18n(layoutPath),\n );\n pushResult(layoutRevert.modify);\n if (layoutRevert.delete) deletes.push(layoutRevert.delete);\n\n logger.info(\"Reverting root layout language select\");\n const rootLayoutCandidates = [\n path.join(options.root, \"src\", \"routes\", \"(public)\", \"root-layout.svelte\"),\n path.join(options.root, \"src\", \"routes\", \"root-layout.svelte\"),\n path.join(options.root, \"src\", \"routes\", \"(public)\", \"+layout.svelte\"),\n path.join(options.root, \"src\", \"routes\", \"+layout.svelte\"),\n ];\n for (const candidate of rootLayoutCandidates) {\n if (!fs.existsSync(candidate)) continue;\n pushResult(\n modifyOutcomeToFile(\n candidate,\n unmodifyRootLayoutLanguageSelect(candidate),\n ),\n );\n }\n\n logger.info(\"Reverting .gitignore\");\n const gitignorePath = path.join(options.root, \".gitignore\");\n pushResult(\n modifyOutcomeToFile(gitignorePath, unmodifyGitignore(gitignorePath)),\n );\n\n return {\n creates: [],\n modifies,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,EACEtF,EAAoBa,GAAeD,EAAkBC,CAAa,CAAC,CACrE,GAEO;EACL,SAAS,CAAC;EACV;EACA;EACA,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.runtime-DRZDjZqw.js","names":["successServer","successSvelte","languageFromPath","_page_server_default","_page_default","withInMemoryScript","ensureImports","removeImportByModuleSpecifier","modifyOutcomeToFile","addItemToNavUser","fs","path","COMPLETED","ASYNC_PAYMENT","EVENTS","CASES_SNIPPET","FAILURE_HINT","NOT_FOUND_HINT","eventSwitch","sf","SyntaxKind","statement","modifyWebhookServer","filePath","original","added","clauses","defaultClause","Node","last","formatLikeSource","source","unmodifyWebhookServer","isOrders","clause","expression","ranges","i","first","start","end","SUCCESS_PAGE","NAV_USER","generate","logger","getLogger","options","modifies","pushResult","file","dispatchPath","name","content","navUserPath","wasAdded","newNavUserSnippet"],"sources":["../../src/patterns/enable/orders/modifies/modify-webhook-server.ts","../../src/patterns/enable/orders/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Node, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n ensureImports,\n formatLikeSource,\n removeImportByModuleSpecifier,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nconst COMPLETED = \"./checkout/completed\";\nconst ASYNC_PAYMENT = \"./checkout/async-payment\";\n\n/** The Checkout Session events the order handlers take. */\nconst EVENTS = [\n \"checkout.session.completed\",\n \"checkout.session.async_payment_succeeded\",\n \"checkout.session.async_payment_failed\",\n];\n\nconst CASES_SNIPPET = dedent`\n case 'checkout.session.completed':\n await handleCheckoutSessionCompleted(event.data.object, locals);\n break;\n\n case 'checkout.session.async_payment_succeeded':\n case 'checkout.session.async_payment_failed':\n await handleCheckoutAsyncPayment(event.data.object, locals);\n break;\n`;\n\nconst FAILURE_HINT = dedent`\n Route the Checkout Session events to the order handlers in src/routes/webhooks/stripe/handlers/dispatch.ts:\n\n import { handleCheckoutSessionCompleted } from '${COMPLETED}';\n import { handleCheckoutAsyncPayment } from '${ASYNC_PAYMENT}';\n\n and, inside the \\`switch (event.type)\\`:\n\n ${CASES_SNIPPET.split(\"\\n\").join(\"\\n \")}\n`;\n\nconst NOT_FOUND_HINT =\n \"Enable payments first: src/routes/webhooks/stripe/handlers/dispatch.ts is created by enable-payments.\";\n\n/** The `switch (event.type)` the dispatcher routes on. */\nfunction eventSwitch(sf: import(\"ts-morph\").SourceFile) {\n return sf\n .getDescendantsOfKind(SyntaxKind.SwitchStatement)\n .find((statement) =>\n statement.getExpression().getText().includes(\"event.type\"),\n );\n}\n\n/** The order handlers join the dispatcher's switch, ahead of its default. */\nexport function modifyWebhookServer(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n const original = fs.readFileSync(filePath, \"utf8\");\n if (original.includes(\"handleCheckoutSessionCompleted\")) {\n return { status: \"success\", changed: false };\n }\n\n let added = false;\n const { source } = withInMemoryScript(original, (sf) => {\n const statement = eventSwitch(sf);\n if (!statement) return;\n const clauses = statement.getCaseBlock().getClauses();\n const defaultClause = clauses.find(Node.isDefaultClause);\n if (defaultClause) {\n defaultClause.replaceWithText(\n `${CASES_SNIPPET}\\n\\n${defaultClause.getText()}`,\n );\n } else if (clauses.length > 0) {\n const last = clauses[clauses.length - 1];\n last.replaceWithText(`${last.getText()}\\n\\n${CASES_SNIPPET}`);\n } else {\n return;\n }\n ensureImports(sf, [\n {\n namedImports: [\"handleCheckoutSessionCompleted\"],\n moduleSpecifier: COMPLETED,\n },\n {\n namedImports: [\"handleCheckoutAsyncPayment\"],\n moduleSpecifier: ASYNC_PAYMENT,\n },\n ]);\n formatLikeSource(sf);\n added = true;\n });\n if (!added) return { status: \"failed\", message: FAILURE_HINT };\n fs.writeFileSync(filePath, source, \"utf8\");\n return { status: \"success\", changed: true };\n}\n\n/** Take the order cases and their imports back out of the dispatcher. */\nexport function unmodifyWebhookServer(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"success\", changed: false };\n }\n const original = fs.readFileSync(filePath, \"utf8\");\n if (!original.includes(\"handleCheckoutSessionCompleted\")) {\n return { status: \"success\", changed: false };\n }\n\n const { source } = withInMemoryScript(original, (sf) => {\n const statement = eventSwitch(sf);\n if (statement) {\n // Each run of order clauses goes with the whitespace before it, so the\n // blank line that separated its neighbours is the one that stays.\n const clauses = statement.getCaseBlock().getClauses();\n const isOrders = (clause: (typeof clauses)[number]) => {\n if (!Node.isCaseClause(clause)) return false;\n const expression = clause.getExpression();\n return (\n Node.isStringLiteral(expression) &&\n EVENTS.includes(expression.getLiteralText())\n );\n };\n // Positions first, bottom-up: removing text forgets the nodes after it.\n const ranges: [number, number][] = [];\n for (let i = clauses.length - 1; i >= 0; i--) {\n if (!isOrders(clauses[i])) continue;\n let first = i;\n while (first > 0 && isOrders(clauses[first - 1])) first--;\n const start =\n first > 0 ? clauses[first - 1].getEnd() : clauses[first].getStart();\n ranges.push([start, clauses[i].getEnd()]);\n i = first;\n }\n for (const [start, end] of ranges) sf.removeText(start, end);\n }\n removeImportByModuleSpecifier(sf, COMPLETED);\n removeImportByModuleSpecifier(sf, ASYNC_PAYMENT);\n formatLikeSource(sf);\n });\n fs.writeFileSync(filePath, source, \"utf8\");\n return { status: \"success\", changed: source !== original };\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 { languageFromPath } from \"../../../core/util\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyWebhookServer } from \"./modifies/modify-webhook-server\";\nimport { addItemToNavUser } from \"../payments/modifies/modify-nav-user\";\nimport successServer from \"./preview-modifies/src/routes/(public)/checkout/success/+page.server.ts?raw\";\nimport successSvelte from \"./preview-modifies/src/routes/(public)/checkout/success/+page.svelte?raw\";\n\n/** The success page, which enable-ecommerce wrote and this pattern rewrites to show the order. */\nexport const SUCCESS_PAGE = \"src/routes/(public)/checkout/success\";\n\nconst NAV_USER = path.join(\"src\", \"lib\", \"components\", \"nav-user.svelte\");\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\n \"Routing the Checkout Session events in webhooks/stripe/handlers/dispatch.ts\",\n );\n const dispatchPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"webhooks\",\n \"stripe\",\n \"handlers\",\n \"dispatch.ts\",\n );\n pushResult(\n modifyOutcomeToFile(dispatchPath, modifyWebhookServer(dispatchPath)),\n );\n\n // A rewrite rather than an edit: the page's load changes shape (the order\n // and its lines, then Stripe's summary as the fallback).\n logger.info(\"Showing the order on /checkout/success\");\n for (const [name, content] of [\n [\"+page.server.ts\", successServer],\n [\"+page.svelte\", successSvelte],\n ] as const) {\n const file = path.join(options.root, SUCCESS_PAGE, name);\n if (fs.existsSync(file) && fs.readFileSync(file, \"utf8\") === content)\n continue;\n modifies.push({\n path: file,\n language: languageFromPath(file),\n content,\n status: \"success\",\n });\n }\n\n if (options.features.auth) {\n logger.info(\"Adding Orders to the user menu\");\n const navUserPath = path.join(options.root, NAV_USER);\n if (fs.existsSync(navUserPath)) {\n const source = fs.readFileSync(navUserPath, \"utf8\");\n if (!source.includes(\"'/orders'\")) {\n const { newNavUserSnippet, wasAdded } = addItemToNavUser(\n source,\n \"Orders\",\n \"/orders\",\n \"PackageIcon\",\n \"@lucide/svelte/icons/package\",\n );\n if (wasAdded) {\n fs.writeFileSync(navUserPath, newNavUserSnippet, \"utf8\");\n modifies.push({\n path: navUserPath,\n language: languageFromPath(navUserPath),\n content: newNavUserSnippet,\n status: \"success\",\n });\n } else {\n modifies.push({\n path: navUserPath,\n language: languageFromPath(navUserPath),\n content: source,\n status: \"failed\",\n message:\n \"Add an Orders item to the navUser array in nav-user.svelte:\\n\\n\" +\n \"import PackageIcon from '@lucide/svelte/icons/package';\\n\" +\n \"{ title: 'Orders', url: '/orders', icon: PackageIcon }\",\n });\n }\n }\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":";;;;;;;;;;;AAWA,IAAMY,IAAY,wBACZC,IAAgB,4BAGhBC,IAAS;CACb;CACA;CACA;AACF,GAEMC,IAAgB,CAAM;;;;;;;;;GAWtBC,IAAe,CAAM;;;oDAGyBJ,EAAU;gDACdC,EAAc;;;;IAI1DE,EAAc,MAAM,IAAI,CAAC,CAAC,KAAK,MAAM,EAAE;GAGrCE,IACJ;AAGF,SAASC,EAAY,GAAmC;CACtD,OAAOC,EACJ,qBAAqBC,EAAW,eAAe,CAAC,CAChD,MAAM,MACLC,EAAU,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,YAAY,CAC3D;AACJ;AAGA,SAAgBC,EAAoB,GAAiC;CACnE,IAAI,CAACZ,EAAG,WAAWa,CAAQ,GACzB,OAAO;EAAE,QAAQ;EAAa,SAASN;CAAe;CAExD,IAAMO,IAAWd,EAAG,aAAaa,GAAU,MAAM;CACjD,IAAIC,EAAS,SAAS,gCAAgC,GACpD,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAIC,IAAQ,IACN,EAAE,cAAWpB,EAAmBmB,IAAW,MAAO;EACtD,IAAMH,IAAYH,EAAYC,CAAE;EAChC,IAAI,CAACE,GAAW;EAChB,IAAMK,IAAUL,EAAU,aAAa,CAAC,CAAC,WAAW,GAC9CM,IAAgBD,EAAQ,KAAKE,EAAK,eAAe;EACvD,IAAID,GACF,EAAc,gBACZ,GAAGZ,EAAc,MAAMY,EAAc,QAAQ,GAC/C;OACK,IAAID,EAAQ,SAAS,GAAG;GA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CAEA,IAAIH,EAAQ,SAAS,MAAM;EACzB,EAAO,KAAK,gCAAgC;EAC5C,IAAMO,IAAc1C,EAAK,KAAKmC,EAAQ,MAAMJ,CAAQ;EACpD,IAAIhC,EAAG,WAAW2C,CAAW,GAAG;GAC9B,IAAMtB,IAASrB,EAAG,aAAa2C,GAAa,MAAM;GAClD,IAAI,CAACtB,EAAO,SAAS,WAAW,GAAG;IACjC,IAAM,EAAE,sBAAmB,gBAAatB,EACtCsB,GACA,UACA,WACA,eACA,8BACF;IACA,AAAIuB,KACF5C,EAAG,cAAc2C,GAAaE,GAAmB,MAAM,GACvDR,EAAS,KAAK;KACZ,MAAMM;KACN,UAAUnD,EAAiBmD,CAAW;KACtC,SAASE;KACT,QAAQ;IACV,CAAC,KAEDR,EAAS,KAAK;KACZ,MAAMM;KACN,UAAUnD,EAAiBmD,CAAW;KACtC,SAAStB;KACT,QAAQ;KACR,SACE;IAGJ,CAAC;GAEL;EACF;CACF;CAEA,OAAO;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
@@ -1,112 +0,0 @@
1
- import { r as e } from "./lib-specifier-Cngo1zF_.js";
2
- import { n as t } from "./logger-CQONztPm.js";
3
- import { t as n } from "./shared-CAjLx_8Z.js";
4
- import { _ as r, g as i, n as a, o, p as s, u as c } from "./ts-morph-helpers-CHI9wAil.js";
5
- import { r as l } from "./modify-file-D9U2LXEa.js";
6
- import { t as u } from "./svelte-file-Dv5-bl79.js";
7
- import d from "node:fs";
8
- import f from "node:path";
9
- import { Project as p, SyntaxKind as m } from "ts-morph";
10
- //#region src/patterns/disable/auth/modifies/+layout.server.ts
11
- function h(e) {
12
- if (!d.existsSync(e)) return {
13
- status: "success",
14
- changed: !1
15
- };
16
- let t = d.readFileSync(e, "utf8");
17
- if (!t.includes("locals.pb.authStore.record")) return {
18
- status: "success",
19
- changed: !1
20
- };
21
- let n = new p().addSourceFileAtPath(e), r = n.getDescendantsOfKind(m.ObjectLiteralExpression);
22
- for (let e of r) {
23
- let t = e.getProperty("user");
24
- t && t.getKind() === m.PropertyAssignment && t.getInitializer()?.getText() === "locals.pb.authStore.record" && t.remove();
25
- }
26
- return i(n, "locals"), o(n), n.saveSync(), {
27
- status: "success",
28
- changed: n.getFullText() !== t
29
- };
30
- }
31
- //#endregion
32
- //#region src/patterns/disable/auth/modifies/root-layout.svelte.ts
33
- function g(t) {
34
- if (!d.existsSync(t)) return {
35
- status: "success",
36
- changed: !1
37
- };
38
- let n = d.readFileSync(t, "utf8"), i = new u(n);
39
- if (!i.hasElement("AuthMenu.Root")) return {
40
- status: "success",
41
- changed: !1
42
- };
43
- i.removeElementContaining("Navbar.Item", "AuthMenu.Root") || i.removeElement("AuthMenu.Root");
44
- let o = i.toString().replace(/<script[\s\S]*?<\/script>/g, "");
45
- return i.modifyScript((t) => {
46
- let { source: n } = r(t, (t) => {
47
- c(t, e("components/ui/auth-menu")), c(t, e("components/user-avatar.svelte")), c(t, e("components/ui/avatar")), s(t, "data", o), a(t);
48
- });
49
- return n;
50
- }), i.writeTo(t), {
51
- status: "success",
52
- changed: i.hasChanged()
53
- };
54
- }
55
- //#endregion
56
- //#region src/patterns/disable/auth/modifies/hooks.server.ts
57
- function _(e) {
58
- if (!d.existsSync(e)) return {
59
- status: "success",
60
- changed: !1
61
- };
62
- let t = d.readFileSync(e, "utf8"), n = new p().addSourceFileAtPath(e), r = n.getDescendantsOfKind(m.CallExpression).find((e) => e.getExpression().getText() === "handlePocketbase");
63
- if (!r) return {
64
- status: "success",
65
- changed: !1
66
- };
67
- let [i] = r.getArguments();
68
- if (!i || i.getKind() !== m.ObjectLiteralExpression) return {
69
- status: "success",
70
- changed: !1
71
- };
72
- let a = i.asKindOrThrow(m.ObjectLiteralExpression), s = a.getProperty("auth");
73
- return s ? (s.remove(), a.getProperties().length === 0 && r.removeArgument(0), o(n), n.saveSync(), {
74
- status: "success",
75
- changed: n.getFullText() !== t
76
- }) : {
77
- status: "success",
78
- changed: !1
79
- };
80
- }
81
- //#endregion
82
- //#region src/patterns/disable/auth/generate.runtime.ts
83
- async function v(e) {
84
- let r = t(e), i = [], a = (e) => {
85
- e && i.push(e);
86
- };
87
- r.info("Reverting +layout.server.ts");
88
- let o = f.join(e.root, "src", "routes", "+layout.server.ts");
89
- a(l(o, h(o))), r.info("Reverting root layout");
90
- let s = [
91
- f.join(e.root, "src", "routes", "(public)", "root-layout.svelte"),
92
- f.join(e.root, "src", "routes", "root-layout.svelte"),
93
- f.join(e.root, "src", "routes", "(public)", "+layout.svelte"),
94
- f.join(e.root, "src", "routes", "+layout.svelte")
95
- ], c = s.find((e) => d.existsSync(e)) ?? s[0];
96
- a(l(c, g(c))), r.info("Reverting hooks.server.ts");
97
- let u = f.join(e.root, "src", "hooks.server.ts");
98
- return a(l(u, _(u))), {
99
- creates: [],
100
- modifies: i,
101
- deletes: [],
102
- components: [],
103
- packages: [],
104
- collections: [],
105
- collectionPatches: [],
106
- collectionDrops: await n(["oauth_accounts"], e)
107
- };
108
- }
109
- //#endregion
110
- export { v as generate };
111
-
112
- //# sourceMappingURL=generate.runtime-DVUj1LJK.js.map