@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
@@ -0,0 +1,428 @@
1
+ import { n as e } from "./logger-t1HxmpG2.js";
2
+ import { t } from "./ui-D5xgIDR_.js";
3
+ import { r as n } from "./modify-file-CRZ_gMg0.js";
4
+ import { a as r, t as i } from "./config-target-DJbVHwHl.js";
5
+ import { _ as a, i as o, o as s, r as c } from "./ts-morph-helpers-B4KZXP44.js";
6
+ import { i as l, n as u, s as d } from "./_layout-xBzFhszN.js";
7
+ import { t as f } from "./dedent-CCUOcPFW.js";
8
+ import { t as p } from "./compose-handle-Da7m6lV_.js";
9
+ import { t as m } from "./svelte-file-DfplF3BU.js";
10
+ import { r as h, t as g } from "./wuchale-config-CNXoq4rc.js";
11
+ import _ from "node:fs";
12
+ import v from "node:path";
13
+ import { Project as y, QuoteKind as b, SyntaxKind as x } from "ts-morph";
14
+ // src/patterns/enable/i18n/modifies/vite-config.ts
15
+ var S = "Add the wuchale plugin to your Vite config:\n\nimport { wuchale } from 'wuchale/vite';\n\nexport default defineConfig({\n plugins: [wuchale(), /* ...existing plugins */],\n});", C = "Create a Vite config with the wuchale plugin:\n\nimport { defineConfig } from 'vite';\nimport { wuchale } from 'wuchale/vite';\n\nexport default defineConfig({\n plugins: [wuchale()],\n});";
16
+ function w(e) {
17
+ if (!_.existsSync(e)) return {
18
+ status: "not-found",
19
+ message: C
20
+ };
21
+ let t = new y({
22
+ compilerOptions: { allowJs: !0 },
23
+ manipulationSettings: { quoteKind: b.Single }
24
+ }).addSourceFileAtPath(e), n = !1, r = !1;
25
+ t.getImportDeclarations().some((e) => e.getModuleSpecifierValue() === "wuchale/vite") || (t.insertImportDeclaration(0, {
26
+ namedImports: ["wuchale"],
27
+ moduleSpecifier: "wuchale/vite"
28
+ }), n = !0);
29
+ let i = t.getDescendantsOfKind(x.CallExpression).find((e) => e.getExpression().getText() === "defineConfig")?.getArguments()?.[0], a = i?.getKind() === x.ObjectLiteralExpression ? i : null;
30
+ if (!a) r = !0;
31
+ else {
32
+ let e = a.getProperty("plugins");
33
+ if (!e) a.addPropertyAssignment({
34
+ name: "plugins",
35
+ initializer: "[wuchale()]"
36
+ }), n = !0;
37
+ else if (e.getKind() !== x.PropertyAssignment) r = !0;
38
+ else {
39
+ let t = e.getInitializer();
40
+ if (!t) e.setInitializer("[wuchale()]"), n = !0;
41
+ else if (t.getKind() !== x.ArrayLiteralExpression) r = !0;
42
+ else {
43
+ let e = t;
44
+ e.getElements().some((e) => e.getText().replace(/\s/g, "") === "wuchale()") || (e.insertElement(0, "wuchale()"), n = !0);
45
+ }
46
+ }
47
+ }
48
+ return n && (s(t), t.saveSync()), r ? {
49
+ status: "failed",
50
+ message: S
51
+ } : {
52
+ status: "success",
53
+ changed: n
54
+ };
55
+ }
56
+ // src/patterns/enable/i18n/modifies/hooks.server.ts
57
+ var T = "handleWuchale", E = f`
58
+ Wrap your exported handle with the wuchale i18n handler:
59
+
60
+ import { sequence } from '@sveltejs/kit/hooks';
61
+ import { runWithLocale, loadLocales } from 'wuchale/load-utils/server';
62
+ import { getLocale } from '#locales/main.url.js';
63
+ import { locales } from '#locales/data.js';
64
+ import * as main from '#locales/main.loader.server.svelte.js';
65
+ import * as js from '#locales/js.loader.server.js';
66
+
67
+ loadLocales(main.key, main.loadCount, main.loadCatalog, locales);
68
+ loadLocales(js.key, js.loadCount, js.loadCatalog, locales);
69
+
70
+ const handleWuchale = async ({ event, resolve }: any) => {
71
+ const locale = getLocale(event.url);
72
+ return await runWithLocale(locale, () =>
73
+ resolve(event, {
74
+ transformPageChunk: ({ html }: { html: string }) =>
75
+ html.replace('%sveltekit.lang%', locale),
76
+ }),
77
+ );
78
+ };
79
+
80
+ export const handle = sequence(handleWuchale, /* your existing handle */);
81
+ `, D = f`
82
+ import type { Handle } from '@sveltejs/kit/hooks';
83
+ import { runWithLocale, loadLocales } from 'wuchale/load-utils/server';
84
+ import { getLocale } from '#locales/main.url.js';
85
+ import { locales } from '#locales/data.js';
86
+ import * as main from '#locales/main.loader.server.svelte.js';
87
+ import * as js from '#locales/js.loader.server.js';
88
+
89
+ loadLocales(main.key, main.loadCount, main.loadCatalog, locales);
90
+ loadLocales(js.key, js.loadCount, js.loadCatalog, locales);
91
+
92
+ const handleWuchale: Handle = async ({ event, resolve }) => {
93
+ const locale = getLocale(event.url);
94
+ return await runWithLocale(locale, () =>
95
+ resolve(event, {
96
+ transformPageChunk: ({ html }) => html.replace('%sveltekit.lang%', locale)
97
+ })
98
+ );
99
+ };
100
+
101
+ export const handle = handleWuchale;
102
+ `;
103
+ function O(e, t, n) {
104
+ e.getImportDeclarations().find((e) => e.getModuleSpecifierValue() === t) || e.addImportDeclaration({
105
+ namespaceImport: n,
106
+ moduleSpecifier: t
107
+ });
108
+ }
109
+ function k(e) {
110
+ if (!_.existsSync(e)) return _.existsSync(e.replace(/\.ts$/, ".js")) ? {
111
+ status: "failed",
112
+ message: E
113
+ } : (_.mkdirSync(v.dirname(e), { recursive: !0 }), _.writeFileSync(e, D + "\n"), {
114
+ status: "success",
115
+ changed: !0
116
+ });
117
+ let t = _.readFileSync(e, "utf8");
118
+ if (t.includes("runWithLocale") || t.includes("loadLocales(")) return {
119
+ status: "success",
120
+ changed: !1
121
+ };
122
+ let n = new y({
123
+ compilerOptions: { allowJs: !0 },
124
+ manipulationSettings: { quoteKind: b.Single }
125
+ }).addSourceFileAtPath(e), r = p(n, { expression: T });
126
+ if (r.status === "unsupported" || !r.statement) return {
127
+ status: "failed",
128
+ message: E
129
+ };
130
+ let i = r.statement;
131
+ o(n, "wuchale/load-utils/server", "runWithLocale"), o(n, "wuchale/load-utils/server", "loadLocales"), o(n, "#locales/main.url.js", "getLocale"), o(n, "#locales/data.js", "locales"), O(n, "#locales/main.loader.server.svelte.js", "main"), O(n, "#locales/js.loader.server.js", "js");
132
+ let a = f`
133
+ loadLocales(main.key, main.loadCount, main.loadCatalog, locales);
134
+ loadLocales(js.key, js.loadCount, js.loadCatalog, locales);
135
+ `, c = f`
136
+ const ${T} = async ({ event, resolve }: any) => {
137
+ const locale = getLocale(event.url);
138
+ return await runWithLocale(locale, () =>
139
+ resolve(event, {
140
+ transformPageChunk: ({ html }: { html: string }) =>
141
+ html.replace('%sveltekit.lang%', locale)
142
+ })
143
+ );
144
+ };
145
+ `;
146
+ return n.insertText(i.getStart(!0), `${a}\n\n${c}\n\n`), s(n), n.saveSync(), {
147
+ status: "success",
148
+ changed: !0
149
+ };
150
+ }
151
+ // src/patterns/enable/i18n/modifies/hooks.ts
152
+ var A = f`
153
+ const rerouteDeLocalize = (url: string) => {
154
+ const [upath, locale] = deLocalizeDefault(url, locales);
155
+ const { path } = matchUrl(upath, locale);
156
+ return path ?? url;
157
+ };
158
+ `, j = f`
159
+ import { deLocalizeDefault } from 'wuchale/url';
160
+ import { matchUrl } from '#locales/main.url.js';
161
+ import { locales } from '#locales/data.js';
162
+
163
+ const rerouteDeLocalize = (url: string) => {
164
+ const [upath, locale] = deLocalizeDefault(url, locales);
165
+ const { path } = matchUrl(upath, locale);
166
+ return path ?? url;
167
+ };
168
+
169
+ export const reroute = ({ url }) => rerouteDeLocalize(url.pathname);
170
+ `, M = f`
171
+ Compose your existing reroute in src/hooks.ts with the wuchale de-localizer:
172
+
173
+ import { deLocalizeDefault } from 'wuchale/url';
174
+ import { matchUrl } from '#locales/main.url.js';
175
+ import { locales } from '#locales/data.js';
176
+
177
+ const rerouteDeLocalize = (url: string) => {
178
+ const [upath, locale] = deLocalizeDefault(url, locales);
179
+ const { path } = matchUrl(upath, locale);
180
+ return path ?? url;
181
+ };
182
+
183
+ export const reroute = ({ url }) => rerouteDeLocalize(existingReroute(url.pathname));
184
+ `, N = /^\(\s*\{\s*url\s*\}\s*\)\s*=>\s*negotiateReroute\(\s*url\.pathname\s*\)$/;
185
+ function P(e) {
186
+ return e.getFunction("reroute") ? !0 : e.getExportDeclarations().some((e) => e.getNamedExports().some((e) => (e.getAliasNode()?.getText() ?? e.getName()) === "reroute"));
187
+ }
188
+ function F(e) {
189
+ o(e, "wuchale/url", "deLocalizeDefault"), o(e, "#locales/main.url.js", "matchUrl"), o(e, "#locales/data.js", "locales");
190
+ }
191
+ function I(e) {
192
+ if (!_.existsSync(e)) return _.mkdirSync(v.dirname(e), { recursive: !0 }), _.writeFileSync(e, j + "\n"), {
193
+ status: "success",
194
+ changed: !0
195
+ };
196
+ if (_.readFileSync(e, "utf8").includes("rerouteDeLocalize")) return {
197
+ status: "success",
198
+ changed: !1
199
+ };
200
+ let t = new y({
201
+ compilerOptions: { allowJs: !0 },
202
+ manipulationSettings: { quoteKind: b.Single }
203
+ }).addSourceFileAtPath(e), n = t.getVariableDeclaration("reroute");
204
+ if (!n) return P(t) ? {
205
+ status: "failed",
206
+ message: M
207
+ } : (F(t), t.addStatements(`\n${A}\n\nexport const reroute = ({ url }) => rerouteDeLocalize(url.pathname);\n`), s(t), t.saveSync(), {
208
+ status: "success",
209
+ changed: !0
210
+ });
211
+ if (!n.getFirstAncestorByKind(x.VariableStatement)?.hasExportKeyword()) return {
212
+ status: "failed",
213
+ message: M
214
+ };
215
+ let r = n.getInitializer();
216
+ if (!r || !N.test(r.getText())) return {
217
+ status: "failed",
218
+ message: M
219
+ };
220
+ F(t), n.setInitializer("({ url }) => rerouteDeLocalize(negotiateReroute(url.pathname))");
221
+ let i = t.getVariableStatements().find((e) => e.getDeclarations().some((e) => e.getName() === "reroute"));
222
+ return t.insertText(i.getStart(!0), `${A}\n\n`), s(t), t.saveSync(), {
223
+ status: "success",
224
+ changed: !0
225
+ };
226
+ }
227
+ // src/patterns/enable/i18n/modifies/app-html.ts
228
+ var L = "Add the sveltekit lang placeholder to the <html> tag:\n\n<html lang=\"%sveltekit.lang%\">", R = "Create src/app.html with a lang placeholder:\n\n<!doctype html>\n<html lang=\"%sveltekit.lang%\">\n <head>\n <meta charset=\"utf-8\" />\n %sveltekit.head%\n </head>\n <body data-sveltekit-preload-data=\"hover\">\n <div style=\"display: contents\">%sveltekit.body%</div>\n </body>\n</html>";
229
+ function z(e) {
230
+ if (!_.existsSync(e)) return {
231
+ status: "not-found",
232
+ message: R
233
+ };
234
+ let t = _.readFileSync(e, "utf8");
235
+ if (t.includes("lang=\"%sveltekit.lang%\"") || t.includes("lang='%sveltekit.lang%'")) return {
236
+ status: "success",
237
+ changed: !1
238
+ };
239
+ let n = t.replace(/<html(\s[^>]*?)?>/i, (e) => /\slang\s*=/i.test(e) ? e.replace(/\slang\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/i, " lang=\"%sveltekit.lang%\"") : e.replace(/<html/i, "<html lang=\"%sveltekit.lang%\""));
240
+ return n === t ? {
241
+ status: "failed",
242
+ message: L
243
+ } : (_.writeFileSync(e, n), {
244
+ status: "success",
245
+ changed: !0
246
+ });
247
+ }
248
+ // src/patterns/enable/i18n/modifies/gitignore.ts
249
+ var B = "Create a .gitignore with the wuchale cache ignored:\n\n# Wuchale\nsrc/locales/.wuchale";
250
+ function V(e) {
251
+ if (!_.existsSync(e)) return {
252
+ status: "not-found",
253
+ message: B
254
+ };
255
+ let t = _.readFileSync(e, "utf8");
256
+ if (t.includes("src/locales/.wuchale")) return {
257
+ status: "success",
258
+ changed: !1
259
+ };
260
+ let n = f`
261
+ # Wuchale
262
+ src/locales/.wuchale
263
+ `, r = t + (t.length > 0 && !t.endsWith("\n") ? "\n" : "") + "\n" + n + "\n";
264
+ return _.writeFileSync(e, r), {
265
+ status: "success",
266
+ changed: !0
267
+ };
268
+ }
269
+ // src/patterns/enable/i18n/modifies/root-layout.svelte.ts
270
+ var H = "<Navbar.Item>\n <LanguageSelect />\n </Navbar.Item>\n ", U = "<LanguageSelect />", W = f`
271
+ import LanguageSelect from '#lib/components/language-select.svelte';
272
+ `, G = [
273
+ "Add the language select inside your <Navbar.List> in the root layout.",
274
+ "",
275
+ "Import to add to the <script> tag:",
276
+ "",
277
+ W,
278
+ "",
279
+ "Markup to add at the end of <Navbar.List>:",
280
+ H
281
+ ].join("\n"), K = [
282
+ "Create a root layout that includes a language select inside <Navbar.List>.",
283
+ "",
284
+ "Import for the <script> tag:",
285
+ "",
286
+ W,
287
+ "",
288
+ "Markup at the end of <Navbar.List>:",
289
+ H
290
+ ].join("\n"), q = [
291
+ "Add the language select to your root layout.",
292
+ "",
293
+ "Import to add to the <script> tag:",
294
+ "",
295
+ W,
296
+ "",
297
+ "Markup to add wherever it should render, e.g. above {@render children()}:",
298
+ "",
299
+ U
300
+ ].join("\n"), J = [
301
+ "Create a root layout that includes the language select.",
302
+ "",
303
+ "Import for the <script> tag:",
304
+ "",
305
+ W,
306
+ "",
307
+ "Markup above {@render children()}:",
308
+ "",
309
+ U
310
+ ].join("\n");
311
+ function Y(e) {
312
+ e.modifyScript((e) => {
313
+ let { source: t } = a(e, (e) => {
314
+ c(e, [{
315
+ defaultImport: "LanguageSelect",
316
+ moduleSpecifier: "#lib/components/language-select.svelte"
317
+ }]);
318
+ });
319
+ return t;
320
+ });
321
+ }
322
+ function ee(e, t = "shadcn") {
323
+ let n = t === "plain";
324
+ if (!_.existsSync(e)) return {
325
+ status: "not-found",
326
+ message: n ? J : K
327
+ };
328
+ let r = m.fromPath(e);
329
+ return r.hasElement("LanguageSelect") ? {
330
+ status: "success",
331
+ changed: !1
332
+ } : n ? !r.getScript() || !r.insertBeforeChildren(U) ? {
333
+ status: "failed",
334
+ message: q
335
+ } : (Y(r), r.writeTo(e), {
336
+ status: "success",
337
+ changed: r.hasChanged()
338
+ }) : r.hasElement("Navbar.List") ? (Y(r), r.insertBeforeClosingTag("Navbar.List", H), r.writeTo(e), {
339
+ status: "success",
340
+ changed: r.hasChanged()
341
+ }) : {
342
+ status: "failed",
343
+ message: G
344
+ };
345
+ }
346
+ // src/patterns/enable/i18n/welcome-catalog.ts
347
+ var X = "src/routes/+page.svelte", Z = "src/locales/es.po", te = "<h1>Welcome to SvelteKit</h1>\n<p>Visit <a href=\"https://svelte.dev/docs/kit\">svelte.dev/docs/kit</a> to read the documentation</p>", Q = [{
348
+ reference: X,
349
+ msgid: "Welcome to SvelteKit",
350
+ msgstr: "Bienvenido a SvelteKit"
351
+ }, {
352
+ reference: X,
353
+ msgid: "Visit <0>svelte.dev/docs/kit</0> to read the documentation",
354
+ msgstr: "Visita <0>svelte.dev/docs/kit</0> para leer la documentación"
355
+ }], ne = {
356
+ reference: "src/lib/components/language-select.svelte",
357
+ msgid: "Language",
358
+ msgstr: "Idioma"
359
+ }, re = "msgid \"\"\nmsgstr \"\"\n\"Source-Language: en\\n\"\n\"Language: es\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=utf-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Plural-Forms: nplurals=3\\n\"\n\"X-Plurals-Order: one, many, other\\n\"", $ = (e) => e.replace(/\s+/g, "");
360
+ function ie(e, t) {
361
+ if (_.existsSync(v.join(e, Z))) return null;
362
+ let n = v.join(e, X);
363
+ return !_.existsSync(n) || $(_.readFileSync(n, "utf8")) !== $(te) ? null : {
364
+ path: Z,
365
+ language: "text",
366
+ content: [re, ...(t === "plain" ? [...Q, ne] : Q).map((e) => [
367
+ `#: ${e.reference}`,
368
+ `msgid "${e.msgid}"`,
369
+ `msgstr "${e.msgstr}"`
370
+ ].join("\n"))].join("\n\n") + "\n",
371
+ status: "success"
372
+ };
373
+ }
374
+ // src/patterns/enable/i18n/generate.runtime.ts
375
+ function ae(e, t) {
376
+ let n = g.filter((t) => _.existsSync(v.join(e, t)));
377
+ return n.length === 0 ? t : t.map((e) => {
378
+ if (!e.path.endsWith("wuchale.config.js")) return e;
379
+ let t = h(e.content, n);
380
+ return t?.changed ? {
381
+ ...e,
382
+ content: t.source
383
+ } : e;
384
+ });
385
+ }
386
+ async function oe(a) {
387
+ let o = e(a), s = [], c = (e) => {
388
+ e && s.push(e);
389
+ };
390
+ o.info("Modifying vite.config");
391
+ let f = r(a.root, i) ?? v.join(a.root, i[0]);
392
+ c(n(f, w(f))), o.info("Adding #locales to package.json imports");
393
+ let p = l(a.root);
394
+ c(n(p.filePath, p.outcome)), o.info("Modifying hooks.server.ts");
395
+ let m = v.join(a.root, "src", "hooks.server.ts");
396
+ c(n(m, k(m))), o.info("Modifying hooks.ts");
397
+ let h = v.join(a.root, "src", "hooks.ts");
398
+ c(n(h, I(h))), o.info("Modifying app.html");
399
+ let g = v.join(a.root, "src", "app.html");
400
+ c(n(g, z(g))), o.info("Modifying root +layout.ts");
401
+ let y = v.join(a.root, "src", "routes", "+layout.ts");
402
+ c(n(y, u(y))), o.info("Modifying root layout language select");
403
+ let b = [
404
+ v.join(a.root, "src", "routes", "(public)", "root-layout.svelte"),
405
+ v.join(a.root, "src", "routes", "root-layout.svelte"),
406
+ v.join(a.root, "src", "routes", "(public)", "+layout.svelte"),
407
+ v.join(a.root, "src", "routes", "+layout.svelte")
408
+ ], x = t(a), S = b.find((e) => _.existsSync(e)) ?? (x === "plain" ? b[3] : b[0]);
409
+ c(n(S, ee(S, x))), o.info("Updating .gitignore");
410
+ let C = v.join(a.root, ".gitignore");
411
+ c(n(C, V(C))), o.info("Updating .prettierignore");
412
+ let T = v.join(a.root, ".prettierignore");
413
+ c(n(T, d(T)));
414
+ let E = ie(a.root, x);
415
+ return E && o.info("Translating the welcome page into Spanish"), {
416
+ creates: E ? [E] : [],
417
+ modifies: s,
418
+ deletes: [],
419
+ components: [],
420
+ packages: [],
421
+ collections: [],
422
+ collectionPatches: [],
423
+ collectionDrops: []
424
+ };
425
+ }
426
+ export { oe as generate, ae as withLibraryTexts };
427
+
428
+ //# sourceMappingURL=generate.runtime-Dfl-07VS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.runtime-Dfl-07VS.js","names":["FAILURE_HINT","NOT_FOUND_HINT","FAILURE_HINT","FAILURE_HINT","FAILURE_HINT","NOT_FOUND_HINT","NOT_FOUND_HINT","getLogger","modifyOutcomeToFile","probeFirstExisting","VITE_CONFIG_CANDIDATES","withInMemoryScript","ensureNamedImport","formatLikeSource","ensureImports","modifyPackageImportsI18n","ensureRootLayoutI18n","modifyPrettierignore","dedent","addHandle","SvelteFile","withWuchaleJsFiles","TRANSLATED_LIB_FILES","fs","path","FAILURE_HINT$4","NOT_FOUND_HINT$3","modifyViteConfig","viteConfigPath","sourceFile","Project","QuoteKind","changed","failed","d","configArg","SyntaxKind","ce","configObj","pluginsProp","pluginsInit","arr","el","I18N_HANDLE","FAILURE_HINT$3","HOOKS_SERVER_SNIPPET","ensureNamespaceImport","moduleSpecifier","ns","modifyHooksServerI18n","hooksServerPath","original","composed","handleStmt","startupSnippet","i18nHandleSnippet","DELOCALIZE_HELPER","HOOKS_SNIPPET","FAILURE_HINT$2","NEGOTIATE_ONLY_REROUTE","hasOtherReroute","n","ensureDeLocalizeImports","modifyHooksI18n","hooksPath","rerouteDecl","init","target","s","FAILURE_HINT$1","NOT_FOUND_HINT$2","modifyAppHtml","appHtmlPath","updated","match","NOT_FOUND_HINT$1","modifyGitignore","gitignorePath","block","LANGUAGE_SELECT_SNIPPET","PLAIN_LANGUAGE_SELECT_SNIPPET","IMPORT_SNIPPET","FAILURE_HINT","NOT_FOUND_HINT","PLAIN_FAILURE_HINT","PLAIN_NOT_FOUND_HINT","addImport","out","source","sf","modifyRootLayoutLanguageSelect","plain","ui","layoutPath","file","PAGE_PATH","CATALOG_PATH","WELCOME_PAGE","PAGE_ENTRIES","PLAIN_SELECT_ENTRY","HEADER","normalize","welcomePageCatalog","root","pagePath","entry","withLibraryTexts","present","creates","edited","generate","logger","options","modifies","pushResult","imports","rootLayoutCandidates","resolveUi","rootLayoutPath","p","prettierignorePath","catalog"],"sources":["../../src/patterns/enable/i18n/modifies/vite-config.ts","../../src/patterns/enable/i18n/modifies/hooks.server.ts","../../src/patterns/enable/i18n/modifies/hooks.ts","../../src/patterns/enable/i18n/modifies/app-html.ts","../../src/patterns/enable/i18n/modifies/gitignore.ts","../../src/patterns/enable/i18n/modifies/root-layout.svelte.ts","../../src/patterns/enable/i18n/welcome-catalog.ts","../../src/patterns/enable/i18n/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst FAILURE_HINT = [\n \"Add the wuchale plugin to your Vite config:\",\n \"\",\n \"import { wuchale } from 'wuchale/vite';\",\n \"\",\n \"export default defineConfig({\",\n \" plugins: [wuchale(), /* ...existing plugins */],\",\n \"});\",\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create a Vite config with the wuchale plugin:\",\n \"\",\n \"import { defineConfig } from 'vite';\",\n \"import { wuchale } from 'wuchale/vite';\",\n \"\",\n \"export default defineConfig({\",\n \" plugins: [wuchale()],\",\n \"});\",\n].join(\"\\n\");\n\nexport function modifyViteConfig(viteConfigPath: string): ModifyOutcome {\n if (!fs.existsSync(viteConfigPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\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 let changed = false;\n let failed = false;\n\n const hasImport = sourceFile\n .getImportDeclarations()\n .some((d) => d.getModuleSpecifierValue() === \"wuchale/vite\");\n\n if (!hasImport) {\n sourceFile.insertImportDeclaration(0, {\n namedImports: [\"wuchale\"],\n moduleSpecifier: \"wuchale/vite\",\n });\n changed = true;\n }\n\n const defineConfigCall = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((ce) => ce.getExpression().getText() === \"defineConfig\");\n\n const configArg = defineConfigCall?.getArguments()?.[0];\n const configObj =\n configArg?.getKind() === SyntaxKind.ObjectLiteralExpression\n ? (configArg as import(\"ts-morph\").ObjectLiteralExpression)\n : null;\n\n if (!configObj) {\n failed = true;\n } else {\n const pluginsProp = configObj.getProperty(\"plugins\");\n if (!pluginsProp) {\n configObj.addPropertyAssignment({\n name: \"plugins\",\n initializer: \"[wuchale()]\",\n });\n changed = true;\n } else if (pluginsProp.getKind() !== SyntaxKind.PropertyAssignment) {\n failed = true;\n } else {\n const pluginsInit = (\n pluginsProp as import(\"ts-morph\").PropertyAssignment\n ).getInitializer();\n\n if (!pluginsInit) {\n (pluginsProp as import(\"ts-morph\").PropertyAssignment).setInitializer(\n \"[wuchale()]\",\n );\n changed = true;\n } else if (pluginsInit.getKind() !== SyntaxKind.ArrayLiteralExpression) {\n failed = true;\n } else {\n const arr = pluginsInit as import(\"ts-morph\").ArrayLiteralExpression;\n const hasWuchale = arr\n .getElements()\n .some((el) => el.getText().replace(/\\s/g, \"\") === \"wuchale()\");\n\n if (!hasWuchale) {\n arr.insertElement(0, \"wuchale()\");\n changed = true;\n }\n }\n }\n }\n\n if (changed) {\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n }\n\n if (failed) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n return { status: \"success\", changed };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { addHandle } from \"../../../../runtime/compose-handle\";\nimport {\n ensureNamedImport,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nconst I18N_HANDLE = \"handleWuchale\";\n\nconst FAILURE_HINT = dedent`\n Wrap your exported handle with the wuchale i18n handler:\n\n import { sequence } from '@sveltejs/kit/hooks';\n import { runWithLocale, loadLocales } from 'wuchale/load-utils/server';\n import { getLocale } from '#locales/main.url.js';\n import { locales } from '#locales/data.js';\n import * as main from '#locales/main.loader.server.svelte.js';\n import * as js from '#locales/js.loader.server.js';\n\n loadLocales(main.key, main.loadCount, main.loadCatalog, locales);\n loadLocales(js.key, js.loadCount, js.loadCatalog, locales);\n\n const handleWuchale = async ({ event, resolve }: any) => {\n const locale = getLocale(event.url);\n return await runWithLocale(locale, () =>\n resolve(event, {\n transformPageChunk: ({ html }: { html: string }) =>\n html.replace('%sveltekit.lang%', locale),\n }),\n );\n };\n\n export const handle = sequence(handleWuchale, /* your existing handle */);\n`;\n\n/**\n * The whole file, for a project that had no server hooks: a fresh `sv create`\n * app or a static site. `disable-i18n` deletes it again once the i18n handle\n * is all that is left.\n */\nexport const HOOKS_SERVER_SNIPPET = dedent`\n import type { Handle } from '@sveltejs/kit/hooks';\n import { runWithLocale, loadLocales } from 'wuchale/load-utils/server';\n import { getLocale } from '#locales/main.url.js';\n import { locales } from '#locales/data.js';\n import * as main from '#locales/main.loader.server.svelte.js';\n import * as js from '#locales/js.loader.server.js';\n\n loadLocales(main.key, main.loadCount, main.loadCatalog, locales);\n loadLocales(js.key, js.loadCount, js.loadCatalog, locales);\n\n const handleWuchale: Handle = async ({ event, resolve }) => {\n const locale = getLocale(event.url);\n return await runWithLocale(locale, () =>\n resolve(event, {\n transformPageChunk: ({ html }) => html.replace('%sveltekit.lang%', locale)\n })\n );\n };\n\n export const handle = handleWuchale;\n`;\n\nfunction ensureNamespaceImport(\n sourceFile: import(\"ts-morph\").SourceFile,\n moduleSpecifier: string,\n ns: string,\n) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === moduleSpecifier);\n if (existing) return;\n sourceFile.addImportDeclaration({ namespaceImport: ns, moduleSpecifier });\n}\n\nexport function modifyHooksServerI18n(hooksServerPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n // SvelteKit loads the first `hooks.server.*` it finds, and `.js` sorts\n // first, so a new `.ts` beside it would never run.\n if (fs.existsSync(hooksServerPath.replace(/\\.ts$/, \".js\"))) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n fs.mkdirSync(path.dirname(hooksServerPath), { recursive: true });\n fs.writeFileSync(hooksServerPath, HOOKS_SERVER_SNIPPET + \"\\n\");\n return { status: \"success\", changed: true };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (original.includes(\"runWithLocale\") || 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 // Composed first: an unsupported handle leaves the file untouched.\n const composed = addHandle(sourceFile, { expression: I18N_HANDLE });\n if (composed.status === \"unsupported\" || !composed.statement) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n const handleStmt = composed.statement;\n\n ensureNamedImport(sourceFile, \"wuchale/load-utils/server\", \"runWithLocale\");\n ensureNamedImport(sourceFile, \"wuchale/load-utils/server\", \"loadLocales\");\n ensureNamedImport(sourceFile, \"#locales/main.url.js\", \"getLocale\");\n ensureNamedImport(sourceFile, \"#locales/data.js\", \"locales\");\n ensureNamespaceImport(\n sourceFile,\n \"#locales/main.loader.server.svelte.js\",\n \"main\",\n );\n ensureNamespaceImport(sourceFile, \"#locales/js.loader.server.js\", \"js\");\n\n const startupSnippet = dedent`\n loadLocales(main.key, main.loadCount, main.loadCatalog, locales);\n loadLocales(js.key, js.loadCount, js.loadCatalog, locales);\n `;\n\n const i18nHandleSnippet = dedent`\n const ${I18N_HANDLE} = async ({ event, resolve }: any) => {\n const locale = getLocale(event.url);\n return await runWithLocale(locale, () =>\n resolve(event, {\n transformPageChunk: ({ html }: { html: string }) =>\n html.replace('%sveltekit.lang%', locale)\n })\n );\n };\n `;\n\n // Above the handle and its JSDoc, so `handleWuchale` is declared before\n // the handle reads it.\n sourceFile.insertText(\n handleStmt.getStart(true),\n `${startupSnippet}\\n\\n${i18nHandleSnippet}\\n\\n`,\n );\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n ensureNamedImport,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nconst DELOCALIZE_HELPER = dedent`\n const rerouteDeLocalize = (url: string) => {\n const [upath, locale] = deLocalizeDefault(url, locales);\n const { path } = matchUrl(upath, locale);\n return path ?? url;\n };\n`;\n\n/**\n * The whole file, for a project that had no universal hooks. `disable-i18n`\n * deletes it again once the de-localizing reroute is all that is left.\n */\nexport const HOOKS_SNIPPET = dedent`\n import { deLocalizeDefault } from 'wuchale/url';\n import { matchUrl } from '#locales/main.url.js';\n import { locales } from '#locales/data.js';\n\n const rerouteDeLocalize = (url: string) => {\n const [upath, locale] = deLocalizeDefault(url, locales);\n const { path } = matchUrl(upath, locale);\n return path ?? url;\n };\n\n export const reroute = ({ url }) => rerouteDeLocalize(url.pathname);\n`;\n\nconst FAILURE_HINT = dedent`\n Compose your existing reroute in src/hooks.ts with the wuchale de-localizer:\n\n import { deLocalizeDefault } from 'wuchale/url';\n import { matchUrl } from '#locales/main.url.js';\n import { locales } from '#locales/data.js';\n\n const rerouteDeLocalize = (url: string) => {\n const [upath, locale] = deLocalizeDefault(url, locales);\n const { path } = matchUrl(upath, locale);\n return path ?? url;\n };\n\n export const reroute = ({ url }) => rerouteDeLocalize(existingReroute(url.pathname));\n`;\n\n/** What `enable-content-negotiation` leaves behind, to the whitespace. */\nconst NEGOTIATE_ONLY_REROUTE =\n /^\\(\\s*\\{\\s*url\\s*\\}\\s*\\)\\s*=>\\s*negotiateReroute\\(\\s*url\\.pathname\\s*\\)$/;\n\n/** A `reroute` this modifier cannot compose with: not a variable declaration. */\nfunction hasOtherReroute(sourceFile: SourceFile): boolean {\n if (sourceFile.getFunction(\"reroute\")) return true;\n return sourceFile\n .getExportDeclarations()\n .some((d) =>\n d\n .getNamedExports()\n .some(\n (n) => (n.getAliasNode()?.getText() ?? n.getName()) === \"reroute\",\n ),\n );\n}\n\nfunction ensureDeLocalizeImports(sourceFile: SourceFile) {\n ensureNamedImport(sourceFile, \"wuchale/url\", \"deLocalizeDefault\");\n ensureNamedImport(sourceFile, \"#locales/main.url.js\", \"matchUrl\");\n ensureNamedImport(sourceFile, \"#locales/data.js\", \"locales\");\n}\n\n/**\n * Add the de-localizing reroute to `src/hooks.ts`, composing with the one\n * `enable-content-negotiation` wrote rather than replacing the file: either\n * pattern may be enabled first, and negotiation's `modifyHooksNegotiate`\n * composes the other way round.\n */\nexport function modifyHooksI18n(hooksPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksPath)) {\n fs.mkdirSync(path.dirname(hooksPath), { recursive: true });\n fs.writeFileSync(hooksPath, HOOKS_SNIPPET + \"\\n\");\n return { status: \"success\", changed: true };\n }\n\n const original = fs.readFileSync(hooksPath, \"utf8\");\n if (original.includes(\"rerouteDeLocalize\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksPath);\n\n const rerouteDecl = sourceFile.getVariableDeclaration(\"reroute\");\n\n if (!rerouteDecl) {\n // A reroute in a shape ts-morph cannot rewrite (a function declaration,\n // a re-export) would collide with the one added below.\n if (hasOtherReroute(sourceFile)) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n ensureDeLocalizeImports(sourceFile);\n sourceFile.addStatements(\n `\\n${DELOCALIZE_HELPER}\\n\\nexport const reroute = ({ url }) => rerouteDeLocalize(url.pathname);\\n`,\n );\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n }\n\n const rerouteStmt = rerouteDecl.getFirstAncestorByKind(\n SyntaxKind.VariableStatement,\n );\n if (!rerouteStmt?.hasExportKeyword()) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const init = rerouteDecl.getInitializer();\n if (!init || !NEGOTIATE_ONLY_REROUTE.test(init.getText())) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n ensureDeLocalizeImports(sourceFile);\n rerouteDecl.setInitializer(\n \"({ url }) => rerouteDeLocalize(negotiateReroute(url.pathname))\",\n );\n\n // Last: inserting text forgets the nodes above, and the helper has to be\n // declared before the reroute that reads it.\n const target = sourceFile\n .getVariableStatements()\n .find((s) => s.getDeclarations().some((d) => d.getName() === \"reroute\"))!;\n sourceFile.insertText(target.getStart(true), `${DELOCALIZE_HELPER}\\n\\n`);\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst FAILURE_HINT = [\n \"Add the sveltekit lang placeholder to the <html> tag:\",\n \"\",\n '<html lang=\"%sveltekit.lang%\">',\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create src/app.html with a lang placeholder:\",\n \"\",\n \"<!doctype html>\",\n '<html lang=\"%sveltekit.lang%\">',\n \" <head>\",\n ' <meta charset=\"utf-8\" />',\n \" %sveltekit.head%\",\n \" </head>\",\n ' <body data-sveltekit-preload-data=\"hover\">',\n ' <div style=\"display: contents\">%sveltekit.body%</div>',\n \" </body>\",\n \"</html>\",\n].join(\"\\n\");\n\nexport function modifyAppHtml(appHtmlPath: string): ModifyOutcome {\n if (!fs.existsSync(appHtmlPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const original = fs.readFileSync(appHtmlPath, \"utf8\");\n if (\n original.includes('lang=\"%sveltekit.lang%\"') ||\n original.includes(\"lang='%sveltekit.lang%'\")\n ) {\n return { status: \"success\", changed: false };\n }\n\n const updated = original.replace(/<html(\\s[^>]*?)?>/i, (match) => {\n // A static lang (the templates ship lang=\"en\") is replaced by the\n // placeholder so the server hook can fill in the negotiated locale.\n if (/\\slang\\s*=/i.test(match)) {\n return match.replace(\n /\\slang\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s>]+)/i,\n ' lang=\"%sveltekit.lang%\"',\n );\n }\n return match.replace(/<html/i, '<html lang=\"%sveltekit.lang%\"');\n });\n\n if (updated === original) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n fs.writeFileSync(appHtmlPath, updated);\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst NOT_FOUND_HINT = [\n \"Create a .gitignore with the wuchale cache ignored:\",\n \"\",\n \"# Wuchale\",\n \"src/locales/.wuchale\",\n].join(\"\\n\");\n\nexport function modifyGitignore(gitignorePath: string): ModifyOutcome {\n if (!fs.existsSync(gitignorePath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\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 block = dedent`\n # Wuchale\n src/locales/.wuchale\n `;\n\n const needsNewline = original.length > 0 && !original.endsWith(\"\\n\");\n const updated = original + (needsNewline ? \"\\n\" : \"\") + \"\\n\" + block + \"\\n\";\n fs.writeFileSync(gitignorePath, updated);\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureImports,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport type { Ui } from \"../../../../core/field/ui\";\n\nconst LANGUAGE_SELECT_SNIPPET = `<Navbar.Item>\n\t\t\t\t<LanguageSelect />\n\t\t\t</Navbar.Item>\n\t\t\t`;\n\nconst PLAIN_LANGUAGE_SELECT_SNIPPET = \"<LanguageSelect />\";\n\nconst IMPORT_SNIPPET = dedent`\n import LanguageSelect from '#lib/components/language-select.svelte';\n`;\n\nconst FAILURE_HINT = [\n \"Add the language select 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 at the end of <Navbar.List>:\",\n LANGUAGE_SELECT_SNIPPET,\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create a root layout that includes a language select inside <Navbar.List>.\",\n \"\",\n \"Import for the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup at the end of <Navbar.List>:\",\n LANGUAGE_SELECT_SNIPPET,\n].join(\"\\n\");\n\nconst PLAIN_FAILURE_HINT = [\n \"Add the language select to your root layout.\",\n \"\",\n \"Import to add to the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup to add wherever it should render, e.g. above {@render children()}:\",\n \"\",\n PLAIN_LANGUAGE_SELECT_SNIPPET,\n].join(\"\\n\");\n\nconst PLAIN_NOT_FOUND_HINT = [\n \"Create a root layout that includes the language select.\",\n \"\",\n \"Import for the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup above {@render children()}:\",\n \"\",\n PLAIN_LANGUAGE_SELECT_SNIPPET,\n].join(\"\\n\");\n\nfunction addImport(file: SvelteFile): void {\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n {\n defaultImport: \"LanguageSelect\",\n moduleSpecifier: \"#lib/components/language-select.svelte\",\n },\n ]);\n });\n return out;\n });\n}\n\n/**\n * A vela layout gets the select as the last `<Navbar.List>` item. A plain one\n * (a project vela did not create) has no navbar, so the select goes above the\n * layout's children.\n */\nexport function modifyRootLayoutLanguageSelect(\n layoutPath: string,\n ui: Ui = \"shadcn\",\n): ModifyOutcome {\n const plain = ui === \"plain\";\n if (!fs.existsSync(layoutPath)) {\n return {\n status: \"not-found\",\n message: plain ? PLAIN_NOT_FOUND_HINT : NOT_FOUND_HINT,\n };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n if (file.hasElement(\"LanguageSelect\")) {\n return { status: \"success\", changed: false };\n }\n\n if (plain) {\n // Without a <script> the import has nowhere to go, and the markup alone\n // would not compile.\n if (!file.getScript()) {\n return { status: \"failed\", message: PLAIN_FAILURE_HINT };\n }\n if (!file.insertBeforeChildren(PLAIN_LANGUAGE_SELECT_SNIPPET)) {\n return { status: \"failed\", message: PLAIN_FAILURE_HINT };\n }\n addImport(file);\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n }\n\n if (!file.hasElement(\"Navbar.List\")) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n addImport(file);\n file.insertBeforeClosingTag(\"Navbar.List\", LANGUAGE_SELECT_SNIPPET);\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 } from \"../../../core/types\";\nimport type { Ui } from \"../../../core/field/ui\";\n\nconst PAGE_PATH = \"src/routes/+page.svelte\";\nconst CATALOG_PATH = \"src/locales/es.po\";\n\n/** `src/routes/+page.svelte` as `sv create` writes it. */\nconst WELCOME_PAGE = [\n \"<h1>Welcome to SvelteKit</h1>\",\n '<p>Visit <a href=\"https://svelte.dev/docs/kit\">svelte.dev/docs/kit</a> to read the documentation</p>',\n].join(\"\\n\");\n\ninterface Entry {\n reference: string;\n msgid: string;\n msgstr: string;\n}\n\nconst PAGE_ENTRIES: Entry[] = [\n {\n reference: PAGE_PATH,\n msgid: \"Welcome to SvelteKit\",\n msgstr: \"Bienvenido a SvelteKit\",\n },\n {\n reference: PAGE_PATH,\n msgid: \"Visit <0>svelte.dev/docs/kit</0> to read the documentation\",\n msgstr: \"Visita <0>svelte.dev/docs/kit</0> para leer la documentación\",\n },\n];\n\n// The native <select>'s aria-label. The shadcn select has no text of its own:\n// locale names come from Intl.DisplayNames.\nconst PLAIN_SELECT_ENTRY: Entry = {\n reference: \"src/lib/components/language-select.svelte\",\n msgid: \"Language\",\n msgstr: \"Idioma\",\n};\n\n// What wuchale writes for `es`. It rewrites the file on the first extraction,\n// keeping these translations and adding the source locale's catalog.\nconst HEADER = [\n 'msgid \"\"',\n 'msgstr \"\"',\n '\"Source-Language: en\\\\n\"',\n '\"Language: es\\\\n\"',\n '\"MIME-Version: 1.0\\\\n\"',\n '\"Content-Type: text/plain; charset=utf-8\\\\n\"',\n '\"Content-Transfer-Encoding: 8bit\\\\n\"',\n '\"Plural-Forms: nplurals=3\\\\n\"',\n '\"X-Plurals-Order: one, many, other\\\\n\"',\n].join(\"\\n\");\n\n// Whitespace is ignored so a page prettier has rewrapped still counts.\nconst normalize = (source: string) => source.replace(/\\s+/g, \"\");\n\n/**\n * A Spanish catalog for the `sv create` welcome page, so the language select\n * visibly does something on a fresh project. Anything else in the project is\n * left for the user to translate. Null unless the page is untouched, and never\n * over an existing catalog.\n */\nexport function welcomePageCatalog(root: string, ui: Ui): File | null {\n if (fs.existsSync(path.join(root, CATALOG_PATH))) return null;\n\n const pagePath = path.join(root, PAGE_PATH);\n if (!fs.existsSync(pagePath)) return null;\n const page = fs.readFileSync(pagePath, \"utf8\");\n if (normalize(page) !== normalize(WELCOME_PAGE)) return null;\n\n const entries =\n ui === \"plain\" ? [...PAGE_ENTRIES, PLAIN_SELECT_ENTRY] : PAGE_ENTRIES;\n const blocks = entries.map((entry) =>\n [\n `#: ${entry.reference}`,\n `msgid \"${entry.msgid}\"`,\n `msgstr \"${entry.msgstr}\"`,\n ].join(\"\\n\"),\n );\n\n return {\n path: CATALOG_PATH,\n language: \"text\",\n content: [HEADER, ...blocks].join(\"\\n\\n\") + \"\\n\",\n status: \"success\",\n };\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 { resolveUi } from \"../../../core/field/ui\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport {\n probeFirstExisting,\n VITE_CONFIG_CANDIDATES,\n} from \"../../../runtime/config-target\";\nimport { modifyViteConfig } from \"./modifies/vite-config\";\nimport { modifyPackageImportsI18n } from \"./modifies/package-imports\";\nimport { modifyHooksServerI18n } from \"./modifies/hooks.server\";\nimport { modifyHooksI18n } from \"./modifies/hooks\";\nimport { modifyAppHtml } from \"./modifies/app-html\";\nimport { modifyGitignore } from \"./modifies/gitignore\";\nimport { modifyPrettierignore } from \"./modifies/prettierignore\";\nimport { ensureRootLayoutI18n } from \"./modifies/+layout\";\nimport { modifyRootLayoutLanguageSelect } from \"./modifies/root-layout.svelte\";\nimport { welcomePageCatalog } from \"./welcome-catalog\";\nimport {\n TRANSLATED_LIB_FILES,\n withWuchaleJsFiles,\n} from \"../../../runtime/wuchale-config\";\n\n/**\n * The `wuchale.config.js` create, with the library modules that carry\n * visitor-facing text and already exist in the project (the WhatsApp order\n * message, say) listed for the js adapter. A pattern enabled later adds its\n * own module to the written config.\n */\nexport function withLibraryTexts(root: string, creates: File[]): File[] {\n const present = TRANSLATED_LIB_FILES.filter((file) =>\n fs.existsSync(path.join(root, file)),\n );\n if (present.length === 0) return creates;\n return creates.map((file) => {\n if (!file.path.endsWith(\"wuchale.config.js\")) return file;\n const edited = withWuchaleJsFiles(file.content, present);\n return edited?.changed ? { ...file, content: edited.source } : file;\n });\n}\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Modifying 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, modifyViteConfig(viteConfigPath)),\n );\n\n logger.info(\"Adding #locales to package.json imports\");\n const imports = modifyPackageImportsI18n(options.root);\n pushResult(modifyOutcomeToFile(imports.filePath, imports.outcome));\n\n logger.info(\"Modifying hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n pushResult(\n modifyOutcomeToFile(\n hooksServerPath,\n modifyHooksServerI18n(hooksServerPath),\n ),\n );\n\n logger.info(\"Modifying hooks.ts\");\n const hooksPath = path.join(options.root, \"src\", \"hooks.ts\");\n pushResult(modifyOutcomeToFile(hooksPath, modifyHooksI18n(hooksPath)));\n\n logger.info(\"Modifying app.html\");\n const appHtmlPath = path.join(options.root, \"src\", \"app.html\");\n pushResult(modifyOutcomeToFile(appHtmlPath, modifyAppHtml(appHtmlPath)));\n\n logger.info(\"Modifying root +layout.ts\");\n const layoutPath = path.join(options.root, \"src\", \"routes\", \"+layout.ts\");\n pushResult(modifyOutcomeToFile(layoutPath, ensureRootLayoutI18n(layoutPath)));\n\n logger.info(\"Modifying 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 const ui = resolveUi(options);\n // With no layout at all, a plain project's not-found hint names the\n // +layout.svelte it would have rather than vela's root-layout.svelte.\n const rootLayoutPath =\n rootLayoutCandidates.find((p) => fs.existsSync(p)) ??\n (ui === \"plain\" ? rootLayoutCandidates[3] : rootLayoutCandidates[0]);\n pushResult(\n modifyOutcomeToFile(\n rootLayoutPath,\n modifyRootLayoutLanguageSelect(rootLayoutPath, ui),\n ),\n );\n\n logger.info(\"Updating .gitignore\");\n const gitignorePath = path.join(options.root, \".gitignore\");\n pushResult(\n modifyOutcomeToFile(gitignorePath, modifyGitignore(gitignorePath)),\n );\n\n logger.info(\"Updating .prettierignore\");\n const prettierignorePath = path.join(options.root, \".prettierignore\");\n pushResult(\n modifyOutcomeToFile(\n prettierignorePath,\n modifyPrettierignore(prettierignorePath),\n ),\n );\n\n const catalog = welcomePageCatalog(options.root, ui);\n if (catalog) logger.info(\"Translating the welcome page into Spanish\");\n\n return {\n creates: catalog ? [catalog] : [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;;;;;AAKA,IAAMA,IAAe,oLAUfC,IAAiB;AAWvB,SAAgB0B,EAAiB,GAAuC;CACtE,IAAI,CAACJ,EAAG,WAAWK,CAAc,GAC/B,OAAO;EAAE,QAAQ;EAAa,SAAS3B;CAAe;CAOxD,IAAM4B,IAAa,IAJCC,EAAQ;EAC1B,iBAAiB,EAAE,SAAS,GAAK;EACjC,sBAAsB,EAAE,WAAWC,EAAU,OAAO;CACtD,CACmB,CAAA,CAAQ,oBAAoBH,CAAc,GAEzDI,IAAU,IACVC,IAAS;C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