@velastack/patterns 0.3.4 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/README.md +44 -2
  2. package/dist/chunks/_layout-kkgN0IF7.js +62 -0
  3. package/dist/chunks/_layout-kkgN0IF7.js.map +1 -0
  4. package/dist/chunks/{collections-CrOvS2E7.js → collections-Dz2fvKnz.js} +2 -2
  5. package/dist/chunks/collections-Dz2fvKnz.js.map +1 -0
  6. package/dist/chunks/{compose-handle-B-CkDcQD.js → compose-handle-D_Rz3Fzo.js} +10 -4
  7. package/dist/chunks/compose-handle-D_Rz3Fzo.js.map +1 -0
  8. package/dist/chunks/{config-target-Bln26FJe.js → config-target-Dx3w6WSk.js} +59 -70
  9. package/dist/chunks/config-target-Dx3w6WSk.js.map +1 -0
  10. package/dist/chunks/constants-BjyMU5s8.js +6 -0
  11. package/dist/chunks/constants-BjyMU5s8.js.map +1 -0
  12. package/dist/chunks/dedent-Gq6Krl4n.js.map +1 -1
  13. package/dist/chunks/dispatch-CXOXPLFk.js +6 -0
  14. package/dist/chunks/dispatch-CXOXPLFk.js.map +1 -0
  15. package/dist/chunks/env-BPfk1VAw.js.map +1 -1
  16. package/dist/chunks/env-vars-C1NUX-bf.js +268 -0
  17. package/dist/chunks/env-vars-C1NUX-bf.js.map +1 -0
  18. package/dist/chunks/env-vars-Cr4lbMD_.js +21 -0
  19. package/dist/chunks/env-vars-Cr4lbMD_.js.map +1 -0
  20. package/dist/chunks/env-vars-De0Xs0L2.js +20 -0
  21. package/dist/chunks/env-vars-De0Xs0L2.js.map +1 -0
  22. package/dist/chunks/env-vars-file-B_6esJW3.js +34 -0
  23. package/dist/chunks/env-vars-file-B_6esJW3.js.map +1 -0
  24. package/dist/chunks/env-vars-mnRA0hOe.js +19 -0
  25. package/dist/chunks/env-vars-mnRA0hOe.js.map +1 -0
  26. package/dist/chunks/env.preview-uMRKT5Pc.js.map +1 -1
  27. package/dist/chunks/errors-DR3gF_7a.js.map +1 -1
  28. package/dist/chunks/format-result-DZ8De8KY.js.map +1 -1
  29. package/dist/chunks/generate-BW3l5Fxw.js +252 -0
  30. package/dist/chunks/generate-BW3l5Fxw.js.map +1 -0
  31. package/dist/chunks/{generate-CyuY2Ci7.js → generate-DeaBlnK6.js} +25 -24
  32. package/dist/chunks/generate-DeaBlnK6.js.map +1 -0
  33. package/dist/chunks/generate-DetW_gbr.js +68 -0
  34. package/dist/chunks/generate-DetW_gbr.js.map +1 -0
  35. package/dist/chunks/{generate-DwADTUob.js → generate-Gcc8iRkZ.js} +9 -6
  36. package/dist/chunks/generate-Gcc8iRkZ.js.map +1 -0
  37. package/dist/chunks/{generate-DQeWOEPY.js → generate-WMJo3QGZ.js} +9 -6
  38. package/dist/chunks/generate-WMJo3QGZ.js.map +1 -0
  39. package/dist/chunks/generate.runtime-1-91UmM8.js +85 -0
  40. package/dist/chunks/generate.runtime-1-91UmM8.js.map +1 -0
  41. package/dist/chunks/generate.runtime-6FXJM8hT.js +67 -0
  42. package/dist/chunks/generate.runtime-6FXJM8hT.js.map +1 -0
  43. package/dist/chunks/generate.runtime-B1jVAnDI.js +155 -0
  44. package/dist/chunks/generate.runtime-B1jVAnDI.js.map +1 -0
  45. package/dist/chunks/generate.runtime-BA3tDKnn.js +147 -0
  46. package/dist/chunks/generate.runtime-BA3tDKnn.js.map +1 -0
  47. package/dist/chunks/{generate.runtime-4FDxnvCl.js → generate.runtime-BO778G0r.js} +5 -5
  48. package/dist/chunks/generate.runtime-BO778G0r.js.map +1 -0
  49. package/dist/chunks/{generate.runtime-Um77JfwC.js → generate.runtime-B_UVGa3q.js} +7 -7
  50. package/dist/chunks/generate.runtime-B_UVGa3q.js.map +1 -0
  51. package/dist/chunks/{generate.runtime-BKiJvE8I.js → generate.runtime-BgTz41Zg.js} +105 -101
  52. package/dist/chunks/generate.runtime-BgTz41Zg.js.map +1 -0
  53. package/dist/chunks/{generate.runtime-FdZw277n.js → generate.runtime-C6bSvGMb.js} +108 -142
  54. package/dist/chunks/generate.runtime-C6bSvGMb.js.map +1 -0
  55. package/dist/chunks/generate.runtime-C8zJRNYG.js +124 -0
  56. package/dist/chunks/generate.runtime-C8zJRNYG.js.map +1 -0
  57. package/dist/chunks/generate.runtime-CCr1lvo4.js +43 -0
  58. package/dist/chunks/generate.runtime-CCr1lvo4.js.map +1 -0
  59. package/dist/chunks/generate.runtime-CYagyR5c.js +326 -0
  60. package/dist/chunks/generate.runtime-CYagyR5c.js.map +1 -0
  61. package/dist/chunks/{generate.runtime-n9AFWtPp.js → generate.runtime-Ce_rwzNa.js} +4 -4
  62. package/dist/chunks/generate.runtime-Ce_rwzNa.js.map +1 -0
  63. package/dist/chunks/{generate.runtime-cQGLxuZM.js → generate.runtime-CexC1Oky.js} +4 -4
  64. package/dist/chunks/generate.runtime-CexC1Oky.js.map +1 -0
  65. package/dist/chunks/{generate.runtime-AYQVW1S-.js → generate.runtime-CnPraLKv.js} +35 -31
  66. package/dist/chunks/generate.runtime-CnPraLKv.js.map +1 -0
  67. package/dist/chunks/generate.runtime-CslAvllQ.js +112 -0
  68. package/dist/chunks/generate.runtime-CslAvllQ.js.map +1 -0
  69. package/dist/chunks/{generate.runtime-onBnOiS7.js → generate.runtime-CuNhY5hn.js} +10 -10
  70. package/dist/chunks/generate.runtime-CuNhY5hn.js.map +1 -0
  71. package/dist/chunks/{generate.runtime-B45MvtYm.js → generate.runtime-DD51OSuL.js} +14 -14
  72. package/dist/chunks/generate.runtime-DD51OSuL.js.map +1 -0
  73. package/dist/chunks/generate.runtime-DHBRyMAq.js +65 -0
  74. package/dist/chunks/generate.runtime-DHBRyMAq.js.map +1 -0
  75. package/dist/chunks/{generate.runtime-D1DNAY6k.js → generate.runtime-DM4o_QYY.js} +9 -9
  76. package/dist/chunks/generate.runtime-DM4o_QYY.js.map +1 -0
  77. package/dist/chunks/generate.runtime-DV3WmZtb.js +35 -0
  78. package/dist/chunks/generate.runtime-DV3WmZtb.js.map +1 -0
  79. package/dist/chunks/generate.runtime-D_sQOeQa.js +164 -0
  80. package/dist/chunks/generate.runtime-D_sQOeQa.js.map +1 -0
  81. package/dist/chunks/{generate.runtime-ofdnLtxS.js → generate.runtime-DqD3PW-W.js} +3 -3
  82. package/dist/chunks/generate.runtime-DqD3PW-W.js.map +1 -0
  83. package/dist/chunks/{generate.runtime-VgVwRiiN.js → generate.runtime-Dtgw9IQO.js} +8 -8
  84. package/dist/chunks/generate.runtime-Dtgw9IQO.js.map +1 -0
  85. package/dist/chunks/{generate.runtime-CN5c2xH8.js → generate.runtime-IlBCcXvv.js} +14 -14
  86. package/dist/chunks/generate.runtime-IlBCcXvv.js.map +1 -0
  87. package/dist/chunks/{generate.runtime-BSRFv4cJ.js → generate.runtime-cwvAoKoH.js} +3 -3
  88. package/dist/chunks/generate.runtime-cwvAoKoH.js.map +1 -0
  89. package/dist/chunks/{generate.runtime-DG-3G00z.js → generate.runtime-kvxmTlQb.js} +3 -3
  90. package/dist/chunks/{generate.runtime-DG-3G00z.js.map → generate.runtime-kvxmTlQb.js.map} +1 -1
  91. package/dist/chunks/generate.runtime-pVLzzpUM.js +122 -0
  92. package/dist/chunks/generate.runtime-pVLzzpUM.js.map +1 -0
  93. package/dist/chunks/{generate.runtime-BFOXm2DD.js → generate.runtime-zJpEufTc.js} +10 -10
  94. package/dist/chunks/generate.runtime-zJpEufTc.js.map +1 -0
  95. package/dist/chunks/lib-specifier-Cngo1zF_.js +33 -0
  96. package/dist/chunks/lib-specifier-Cngo1zF_.js.map +1 -0
  97. package/dist/chunks/logger-CQONztPm.js.map +1 -1
  98. package/dist/chunks/{modify-file-Dwfv0dCI.js → modify-file-BlDeeurK.js} +3 -3
  99. package/dist/chunks/modify-file-BlDeeurK.js.map +1 -0
  100. package/dist/chunks/{modify-svelte-config-remote-BUU_EaDf.js → modify-svelte-config-remote-p0TfVzxm.js} +8 -10
  101. package/dist/chunks/modify-svelte-config-remote-p0TfVzxm.js.map +1 -0
  102. package/dist/chunks/modify-utils-Cw-on_cL.js.map +1 -1
  103. package/dist/chunks/nav-user-BRIHOOpG.js +6 -0
  104. package/dist/chunks/nav-user-BRIHOOpG.js.map +1 -0
  105. package/dist/chunks/package-imports-Bbw3iMPg.js +173 -0
  106. package/dist/chunks/package-imports-Bbw3iMPg.js.map +1 -0
  107. package/dist/chunks/pocketbase-C5GS-Dh5.js.map +1 -1
  108. package/dist/chunks/pocketbase-DpudAAmd.js.map +1 -1
  109. package/dist/chunks/{pocketbase-BkhUywtb.js → pocketbase-Dry6ry17.js} +2 -2
  110. package/dist/chunks/pocketbase-Dry6ry17.js.map +1 -0
  111. package/dist/chunks/{providers-BL9vJP_9.js → providers-BHR6-XZ7.js} +11 -4
  112. package/dist/chunks/providers-BHR6-XZ7.js.map +1 -0
  113. package/dist/chunks/{shared-C8GtNxpm.js → shared-CZC4d7Uj.js} +2 -2
  114. package/dist/chunks/shared-CZC4d7Uj.js.map +1 -0
  115. package/dist/chunks/{site-BdMX8qrH.js → site-BwCA18Sv.js} +2 -2
  116. package/dist/chunks/site-BwCA18Sv.js.map +1 -0
  117. package/dist/chunks/svelte-file-B3RfgVdt.js.map +1 -1
  118. package/dist/chunks/table-core-AjBpYi-y.js +127 -0
  119. package/dist/chunks/table-core-AjBpYi-y.js.map +1 -0
  120. package/dist/chunks/{taggedTemplateLiteral-Dx0fjWiw.js → taggedTemplateLiteral-CswN2AAa.js} +1 -1
  121. package/dist/chunks/{test-setup-DHEFKEHE.js → test-setup-DEmWd9Ul.js} +76 -67
  122. package/dist/chunks/test-setup-DEmWd9Ul.js.map +1 -0
  123. package/dist/chunks/{ts-morph-helpers-CeduA--o.js → ts-morph-helpers-CDW4lhox.js} +77 -63
  124. package/dist/chunks/ts-morph-helpers-CDW4lhox.js.map +1 -0
  125. package/dist/chunks/ui-DD4NltyN.js.map +1 -1
  126. package/dist/chunks/{ui-TlEuI2Sz.js → ui-X698F10c.js} +47 -47
  127. package/dist/chunks/ui-X698F10c.js.map +1 -0
  128. package/dist/chunks/{unmodify-load-jfdcVZ_a.js → unmodify-load-CyGzC1Hu.js} +2 -2
  129. package/dist/chunks/unmodify-load-CyGzC1Hu.js.map +1 -0
  130. package/dist/chunks/util-BLYliuUK.js.map +1 -1
  131. package/dist/chunks/write-result-B68lvI57.js +511 -0
  132. package/dist/chunks/write-result-B68lvI57.js.map +1 -0
  133. package/dist/index.d.ts +224 -1
  134. package/dist/index.js +2121 -2064
  135. package/dist/index.js.map +1 -1
  136. package/package.json +7 -7
  137. package/dist/chunks/_layout-B7ujvjnA.js +0 -55
  138. package/dist/chunks/_layout-B7ujvjnA.js.map +0 -1
  139. package/dist/chunks/collections-CrOvS2E7.js.map +0 -1
  140. package/dist/chunks/compose-handle-B-CkDcQD.js.map +0 -1
  141. package/dist/chunks/config-target-Bln26FJe.js.map +0 -1
  142. package/dist/chunks/constants-BYkd9jeJ.js +0 -6
  143. package/dist/chunks/constants-BYkd9jeJ.js.map +0 -1
  144. package/dist/chunks/dispatch-BRnt8PcW.js +0 -6
  145. package/dist/chunks/dispatch-BRnt8PcW.js.map +0 -1
  146. package/dist/chunks/generate-6snrlnpA.js +0 -64
  147. package/dist/chunks/generate-6snrlnpA.js.map +0 -1
  148. package/dist/chunks/generate-Ca_6FlPi.js +0 -252
  149. package/dist/chunks/generate-Ca_6FlPi.js.map +0 -1
  150. package/dist/chunks/generate-CyuY2Ci7.js.map +0 -1
  151. package/dist/chunks/generate-DQeWOEPY.js.map +0 -1
  152. package/dist/chunks/generate-DwADTUob.js.map +0 -1
  153. package/dist/chunks/generate.runtime-4FDxnvCl.js.map +0 -1
  154. package/dist/chunks/generate.runtime-AYQVW1S-.js.map +0 -1
  155. package/dist/chunks/generate.runtime-B2aFFaac.js +0 -117
  156. package/dist/chunks/generate.runtime-B2aFFaac.js.map +0 -1
  157. package/dist/chunks/generate.runtime-B45MvtYm.js.map +0 -1
  158. package/dist/chunks/generate.runtime-BFOXm2DD.js.map +0 -1
  159. package/dist/chunks/generate.runtime-BHkFmI2Y.js +0 -146
  160. package/dist/chunks/generate.runtime-BHkFmI2Y.js.map +0 -1
  161. package/dist/chunks/generate.runtime-BKiJvE8I.js.map +0 -1
  162. package/dist/chunks/generate.runtime-BSRFv4cJ.js.map +0 -1
  163. package/dist/chunks/generate.runtime-BUqsF3AF.js +0 -123
  164. package/dist/chunks/generate.runtime-BUqsF3AF.js.map +0 -1
  165. package/dist/chunks/generate.runtime-BsaSyTnU.js +0 -82
  166. package/dist/chunks/generate.runtime-BsaSyTnU.js.map +0 -1
  167. package/dist/chunks/generate.runtime-CMnvmeVt.js +0 -111
  168. package/dist/chunks/generate.runtime-CMnvmeVt.js.map +0 -1
  169. package/dist/chunks/generate.runtime-CN5c2xH8.js.map +0 -1
  170. package/dist/chunks/generate.runtime-CgoSrP55.js +0 -146
  171. package/dist/chunks/generate.runtime-CgoSrP55.js.map +0 -1
  172. package/dist/chunks/generate.runtime-D1DNAY6k.js.map +0 -1
  173. package/dist/chunks/generate.runtime-DQwSY6Nc.js +0 -38
  174. package/dist/chunks/generate.runtime-DQwSY6Nc.js.map +0 -1
  175. package/dist/chunks/generate.runtime-D_yqWLcI.js +0 -66
  176. package/dist/chunks/generate.runtime-D_yqWLcI.js.map +0 -1
  177. package/dist/chunks/generate.runtime-Drmahmdl.js +0 -313
  178. package/dist/chunks/generate.runtime-Drmahmdl.js.map +0 -1
  179. package/dist/chunks/generate.runtime-FdZw277n.js.map +0 -1
  180. package/dist/chunks/generate.runtime-Lh1cW9Tz.js +0 -94
  181. package/dist/chunks/generate.runtime-Lh1cW9Tz.js.map +0 -1
  182. package/dist/chunks/generate.runtime-QGHToXRY.js +0 -32
  183. package/dist/chunks/generate.runtime-QGHToXRY.js.map +0 -1
  184. package/dist/chunks/generate.runtime-Um77JfwC.js.map +0 -1
  185. package/dist/chunks/generate.runtime-VgVwRiiN.js.map +0 -1
  186. package/dist/chunks/generate.runtime-YyIVd4oy.js +0 -61
  187. package/dist/chunks/generate.runtime-YyIVd4oy.js.map +0 -1
  188. package/dist/chunks/generate.runtime-cQGLxuZM.js.map +0 -1
  189. package/dist/chunks/generate.runtime-n9AFWtPp.js.map +0 -1
  190. package/dist/chunks/generate.runtime-ofdnLtxS.js.map +0 -1
  191. package/dist/chunks/generate.runtime-onBnOiS7.js.map +0 -1
  192. package/dist/chunks/modify-file-Dwfv0dCI.js.map +0 -1
  193. package/dist/chunks/modify-svelte-config-remote-BUU_EaDf.js.map +0 -1
  194. package/dist/chunks/nav-user-BYI-h8Od.js +0 -6
  195. package/dist/chunks/nav-user-BYI-h8Od.js.map +0 -1
  196. package/dist/chunks/pocketbase-BkhUywtb.js.map +0 -1
  197. package/dist/chunks/providers-BL9vJP_9.js.map +0 -1
  198. package/dist/chunks/shared-C8GtNxpm.js.map +0 -1
  199. package/dist/chunks/site-BdMX8qrH.js.map +0 -1
  200. package/dist/chunks/table-core-G9Shld4F.js +0 -126
  201. package/dist/chunks/table-core-G9Shld4F.js.map +0 -1
  202. package/dist/chunks/test-setup-DHEFKEHE.js.map +0 -1
  203. package/dist/chunks/ts-morph-helpers-CeduA--o.js.map +0 -1
  204. package/dist/chunks/ui-TlEuI2Sz.js.map +0 -1
  205. package/dist/chunks/unmodify-load-jfdcVZ_a.js.map +0 -1
  206. package/dist/chunks/write-result-Djy0SZXX.js +0 -376
  207. package/dist/chunks/write-result-Djy0SZXX.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { t as e } from "./dedent-Gq6Krl4n.js";
2
2
  import { t } from "./ui-DD4NltyN.js";
3
3
  import { n } from "./logger-CQONztPm.js";
4
- import { _ as r, i, o as a, r as o } from "./ts-morph-helpers-CeduA--o.js";
5
- import { modifyOutcomeToFile as s } from "./modify-file-Dwfv0dCI.js";
4
+ import { _ as r, i, o as a, r as o } from "./ts-morph-helpers-CDW4lhox.js";
5
+ import { modifyOutcomeToFile as s } from "./modify-file-BlDeeurK.js";
6
6
  import { t as c } from "./svelte-file-B3RfgVdt.js";
7
- import { t as l } from "./compose-handle-B-CkDcQD.js";
8
- import { a as u, i as d, r as f, t as p } from "./config-target-Bln26FJe.js";
9
- import { n as ee } from "./_layout-B7ujvjnA.js";
7
+ import { t as l } from "./compose-handle-D_Rz3Fzo.js";
8
+ import { a as u, t as d } from "./config-target-Dx3w6WSk.js";
9
+ import { i as f, n as p } from "./_layout-kkgN0IF7.js";
10
10
  import m from "node:fs";
11
11
  import h from "node:path";
12
12
  import { Project as g, QuoteKind as _, SyntaxKind as v } from "ts-morph";
@@ -70,50 +70,16 @@ function x(e) {
70
70
  };
71
71
  }
72
72
  //#endregion
73
- //#region src/patterns/enable/i18n/modifies/svelte-config.ts
74
- var S = [
75
- "Add the $locales alias to your config (sveltekit() arg in vite.config, or svelte.config):",
76
- "",
77
- "alias: {",
78
- " $locales: 'src/locales',",
79
- "},"
80
- ].join("\n"), C = [
81
- "Add the $locales alias by passing config to the sveltekit() plugin in vite.config.ts:",
82
- "",
83
- "import { sveltekit } from '@sveltejs/kit/vite';",
84
- "import { defineConfig } from 'vite';",
85
- "",
86
- "export default defineConfig({",
87
- " plugins: [sveltekit({ alias: { $locales: 'src/locales' } })],",
88
- "});"
89
- ].join("\n");
90
- function w(e) {
91
- return d(e, {
92
- notFound: C,
93
- failed: S
94
- }, (e) => {
95
- let t = e.kitContainer();
96
- if (!t) return !1;
97
- let n = f(t, "alias", "{}");
98
- if (!n) return !1;
99
- let r = n.getProperty("$locales");
100
- return r ? r.getKind() === v.PropertyAssignment && (r.getInitializer()?.getText()?.replace(/['"`]/g, "") !== "src/locales" && r.setInitializer("'src/locales'"), !0) : (n.addPropertyAssignment({
101
- name: "$locales",
102
- initializer: "'src/locales'"
103
- }), !0);
104
- });
105
- }
106
- //#endregion
107
73
  //#region src/patterns/enable/i18n/modifies/hooks.server.ts
108
- var T = "handleWuchale", E = e`
74
+ var S = "handleWuchale", C = e`
109
75
  Wrap your exported handle with the wuchale i18n handler:
110
76
 
111
77
  import { sequence } from '@sveltejs/kit/hooks';
112
78
  import { runWithLocale, loadLocales } from 'wuchale/load-utils/server';
113
- import { getLocale } from '$locales/main.url';
114
- import { locales } from '$locales/data';
115
- import * as main from '$locales/main.loader.server.svelte.js';
116
- import * as js from '$locales/js.loader.server.js';
79
+ import { getLocale } from '#locales/main.url.js';
80
+ import { locales } from '#locales/data.js';
81
+ import * as main from '#locales/main.loader.server.svelte.js';
82
+ import * as js from '#locales/js.loader.server.js';
117
83
 
118
84
  loadLocales(main.key, main.loadCount, main.loadCatalog, locales);
119
85
  loadLocales(js.key, js.loadCount, js.loadCatalog, locales);
@@ -129,13 +95,13 @@ var T = "handleWuchale", E = e`
129
95
  };
130
96
 
131
97
  export const handle = sequence(handleWuchale, /* your existing handle */);
132
- `, D = e`
133
- import type { Handle } from '@sveltejs/kit';
98
+ `, w = e`
99
+ import type { Handle } from '@sveltejs/kit/hooks';
134
100
  import { runWithLocale, loadLocales } from 'wuchale/load-utils/server';
135
- import { getLocale } from '$locales/main.url';
136
- import { locales } from '$locales/data';
137
- import * as main from '$locales/main.loader.server.svelte.js';
138
- import * as js from '$locales/js.loader.server.js';
101
+ import { getLocale } from '#locales/main.url.js';
102
+ import { locales } from '#locales/data.js';
103
+ import * as main from '#locales/main.loader.server.svelte.js';
104
+ import * as js from '#locales/js.loader.server.js';
139
105
 
140
106
  loadLocales(main.key, main.loadCount, main.loadCatalog, locales);
141
107
  loadLocales(js.key, js.loadCount, js.loadCatalog, locales);
@@ -151,17 +117,17 @@ var T = "handleWuchale", E = e`
151
117
 
152
118
  export const handle = handleWuchale;
153
119
  `;
154
- function O(e, t, n) {
120
+ function T(e, t, n) {
155
121
  e.getImportDeclarations().find((e) => e.getModuleSpecifierValue() === t) || e.addImportDeclaration({
156
122
  namespaceImport: n,
157
123
  moduleSpecifier: t
158
124
  });
159
125
  }
160
- function k(t) {
126
+ function E(t) {
161
127
  if (!m.existsSync(t)) return m.existsSync(t.replace(/\.ts$/, ".js")) ? {
162
128
  status: "failed",
163
- message: E
164
- } : (m.mkdirSync(h.dirname(t), { recursive: !0 }), m.writeFileSync(t, D + "\n"), {
129
+ message: C
130
+ } : (m.mkdirSync(h.dirname(t), { recursive: !0 }), m.writeFileSync(t, w + "\n"), {
165
131
  status: "success",
166
132
  changed: !0
167
133
  });
@@ -173,18 +139,18 @@ function k(t) {
173
139
  let r = new g({
174
140
  compilerOptions: { allowJs: !0 },
175
141
  manipulationSettings: { quoteKind: _.Single }
176
- }).addSourceFileAtPath(t), o = l(r, { expression: T });
142
+ }).addSourceFileAtPath(t), o = l(r, { expression: S });
177
143
  if (o.status === "unsupported" || !o.statement) return {
178
144
  status: "failed",
179
- message: E
145
+ message: C
180
146
  };
181
147
  let s = o.statement;
182
- i(r, "wuchale/load-utils/server", "runWithLocale"), i(r, "wuchale/load-utils/server", "loadLocales"), i(r, "$locales/main.url", "getLocale"), i(r, "$locales/data", "locales"), O(r, "$locales/main.loader.server.svelte.js", "main"), O(r, "$locales/js.loader.server.js", "js");
148
+ i(r, "wuchale/load-utils/server", "runWithLocale"), i(r, "wuchale/load-utils/server", "loadLocales"), i(r, "#locales/main.url.js", "getLocale"), i(r, "#locales/data.js", "locales"), T(r, "#locales/main.loader.server.svelte.js", "main"), T(r, "#locales/js.loader.server.js", "js");
183
149
  let c = e`
184
150
  loadLocales(main.key, main.loadCount, main.loadCatalog, locales);
185
151
  loadLocales(js.key, js.loadCount, js.loadCatalog, locales);
186
152
  `, u = e`
187
- const ${T} = async ({ event, resolve }: any) => {
153
+ const ${S} = async ({ event, resolve }: any) => {
188
154
  const locale = getLocale(event.url);
189
155
  return await runWithLocale(locale, () =>
190
156
  resolve(event, {
@@ -201,16 +167,16 @@ function k(t) {
201
167
  }
202
168
  //#endregion
203
169
  //#region src/patterns/enable/i18n/modifies/hooks.ts
204
- var A = e`
170
+ var D = e`
205
171
  const rerouteDeLocalize = (url: string) => {
206
172
  const [upath, locale] = deLocalizeDefault(url, locales);
207
173
  const { path } = matchUrl(upath, locale);
208
174
  return path ?? url;
209
175
  };
210
- `, j = e`
176
+ `, O = e`
211
177
  import { deLocalizeDefault } from 'wuchale/url';
212
- import { matchUrl } from '$locales/main.url';
213
- import { locales } from '$locales/data';
178
+ import { matchUrl } from '#locales/main.url.js';
179
+ import { locales } from '#locales/data.js';
214
180
 
215
181
  const rerouteDeLocalize = (url: string) => {
216
182
  const [upath, locale] = deLocalizeDefault(url, locales);
@@ -219,12 +185,12 @@ var A = e`
219
185
  };
220
186
 
221
187
  export const reroute = ({ url }) => rerouteDeLocalize(url.pathname);
222
- `, M = e`
188
+ `, k = e`
223
189
  Compose your existing reroute in src/hooks.ts with the wuchale de-localizer:
224
190
 
225
191
  import { deLocalizeDefault } from 'wuchale/url';
226
- import { matchUrl } from '$locales/main.url';
227
- import { locales } from '$locales/data';
192
+ import { matchUrl } from '#locales/main.url.js';
193
+ import { locales } from '#locales/data.js';
228
194
 
229
195
  const rerouteDeLocalize = (url: string) => {
230
196
  const [upath, locale] = deLocalizeDefault(url, locales);
@@ -233,15 +199,15 @@ var A = e`
233
199
  };
234
200
 
235
201
  export const reroute = ({ url }) => rerouteDeLocalize(existingReroute(url.pathname));
236
- `, N = /^\(\s*\{\s*url\s*\}\s*\)\s*=>\s*negotiateReroute\(\s*url\.pathname\s*\)$/;
237
- function te(e) {
202
+ `, A = /^\(\s*\{\s*url\s*\}\s*\)\s*=>\s*negotiateReroute\(\s*url\.pathname\s*\)$/;
203
+ function j(e) {
238
204
  return e.getFunction("reroute") ? !0 : e.getExportDeclarations().some((e) => e.getNamedExports().some((e) => (e.getAliasNode()?.getText() ?? e.getName()) === "reroute"));
239
205
  }
240
- function P(e) {
241
- i(e, "wuchale/url", "deLocalizeDefault"), i(e, "$locales/main.url", "matchUrl"), i(e, "$locales/data", "locales");
206
+ function M(e) {
207
+ i(e, "wuchale/url", "deLocalizeDefault"), i(e, "#locales/main.url.js", "matchUrl"), i(e, "#locales/data.js", "locales");
242
208
  }
243
- function F(e) {
244
- if (!m.existsSync(e)) return m.mkdirSync(h.dirname(e), { recursive: !0 }), m.writeFileSync(e, j + "\n"), {
209
+ function N(e) {
210
+ if (!m.existsSync(e)) return m.mkdirSync(h.dirname(e), { recursive: !0 }), m.writeFileSync(e, O + "\n"), {
245
211
  status: "success",
246
212
  changed: !0
247
213
  };
@@ -253,36 +219,36 @@ function F(e) {
253
219
  compilerOptions: { allowJs: !0 },
254
220
  manipulationSettings: { quoteKind: _.Single }
255
221
  }).addSourceFileAtPath(e), n = t.getVariableDeclaration("reroute");
256
- if (!n) return te(t) ? {
222
+ if (!n) return j(t) ? {
257
223
  status: "failed",
258
- message: M
259
- } : (P(t), t.addStatements(`\n${A}\n\nexport const reroute = ({ url }) => rerouteDeLocalize(url.pathname);\n`), a(t), t.saveSync(), {
224
+ message: k
225
+ } : (M(t), t.addStatements(`\n${D}\n\nexport const reroute = ({ url }) => rerouteDeLocalize(url.pathname);\n`), a(t), t.saveSync(), {
260
226
  status: "success",
261
227
  changed: !0
262
228
  });
263
229
  if (!n.getFirstAncestorByKind(v.VariableStatement)?.hasExportKeyword()) return {
264
230
  status: "failed",
265
- message: M
231
+ message: k
266
232
  };
267
233
  let r = n.getInitializer();
268
- if (!r || !N.test(r.getText())) return {
234
+ if (!r || !A.test(r.getText())) return {
269
235
  status: "failed",
270
- message: M
236
+ message: k
271
237
  };
272
- P(t), n.setInitializer("({ url }) => rerouteDeLocalize(negotiateReroute(url.pathname))");
238
+ M(t), n.setInitializer("({ url }) => rerouteDeLocalize(negotiateReroute(url.pathname))");
273
239
  let i = t.getVariableStatements().find((e) => e.getDeclarations().some((e) => e.getName() === "reroute"));
274
- return t.insertText(i.getStart(!0), `${A}\n\n`), a(t), t.saveSync(), {
240
+ return t.insertText(i.getStart(!0), `${D}\n\n`), a(t), t.saveSync(), {
275
241
  status: "success",
276
242
  changed: !0
277
243
  };
278
244
  }
279
245
  //#endregion
280
246
  //#region src/patterns/enable/i18n/modifies/app-html.ts
281
- var I = [
247
+ var P = [
282
248
  "Add the sveltekit lang placeholder to the <html> tag:",
283
249
  "",
284
250
  "<html lang=\"%sveltekit.lang%\">"
285
- ].join("\n"), L = [
251
+ ].join("\n"), F = [
286
252
  "Create src/app.html with a lang placeholder:",
287
253
  "",
288
254
  "<!doctype html>",
@@ -296,10 +262,10 @@ var I = [
296
262
  " </body>",
297
263
  "</html>"
298
264
  ].join("\n");
299
- function R(e) {
265
+ function I(e) {
300
266
  if (!m.existsSync(e)) return {
301
267
  status: "not-found",
302
- message: L
268
+ message: F
303
269
  };
304
270
  let t = m.readFileSync(e, "utf8");
305
271
  if (t.includes("lang=\"%sveltekit.lang%\"") || t.includes("lang='%sveltekit.lang%'")) return {
@@ -309,7 +275,7 @@ function R(e) {
309
275
  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%\""));
310
276
  return n === t ? {
311
277
  status: "failed",
312
- message: I
278
+ message: P
313
279
  } : (m.writeFileSync(e, n), {
314
280
  status: "success",
315
281
  changed: !0
@@ -317,16 +283,16 @@ function R(e) {
317
283
  }
318
284
  //#endregion
319
285
  //#region src/patterns/enable/i18n/modifies/gitignore.ts
320
- var z = [
286
+ var L = [
321
287
  "Create a .gitignore with the wuchale cache ignored:",
322
288
  "",
323
289
  "# Wuchale",
324
290
  "src/locales/.wuchale"
325
291
  ].join("\n");
326
- function B(t) {
292
+ function R(t) {
327
293
  if (!m.existsSync(t)) return {
328
294
  status: "not-found",
329
- message: z
295
+ message: L
330
296
  };
331
297
  let n = m.readFileSync(t, "utf8");
332
298
  if (n.includes("src/locales/.wuchale")) return {
@@ -344,97 +310,97 @@ function B(t) {
344
310
  }
345
311
  //#endregion
346
312
  //#region src/patterns/enable/i18n/modifies/root-layout.svelte.ts
347
- var V = "<Navbar.Item>\n <LanguageSelect />\n </Navbar.Item>\n ", H = "<LanguageSelect />", U = e`
348
- import LanguageSelect from '$lib/components/language-select.svelte';
349
- `, W = [
313
+ var z = "<Navbar.Item>\n <LanguageSelect />\n </Navbar.Item>\n ", B = "<LanguageSelect />", V = e`
314
+ import LanguageSelect from '#lib/components/language-select.svelte';
315
+ `, H = [
350
316
  "Add the language select inside your <Navbar.List> in the root layout.",
351
317
  "",
352
318
  "Import to add to the <script> tag:",
353
319
  "",
354
- U,
320
+ V,
355
321
  "",
356
322
  "Markup to add at the end of <Navbar.List>:",
357
- V
358
- ].join("\n"), G = [
323
+ z
324
+ ].join("\n"), U = [
359
325
  "Create a root layout that includes a language select inside <Navbar.List>.",
360
326
  "",
361
327
  "Import for the <script> tag:",
362
328
  "",
363
- U,
329
+ V,
364
330
  "",
365
331
  "Markup at the end of <Navbar.List>:",
366
- V
367
- ].join("\n"), K = [
332
+ z
333
+ ].join("\n"), W = [
368
334
  "Add the language select to your root layout.",
369
335
  "",
370
336
  "Import to add to the <script> tag:",
371
337
  "",
372
- U,
338
+ V,
373
339
  "",
374
340
  "Markup to add wherever it should render, e.g. above {@render children()}:",
375
341
  "",
376
- H
377
- ].join("\n"), q = [
342
+ B
343
+ ].join("\n"), G = [
378
344
  "Create a root layout that includes the language select.",
379
345
  "",
380
346
  "Import for the <script> tag:",
381
347
  "",
382
- U,
348
+ V,
383
349
  "",
384
350
  "Markup above {@render children()}:",
385
351
  "",
386
- H
352
+ B
387
353
  ].join("\n");
388
- function J(e) {
354
+ function K(e) {
389
355
  e.modifyScript((e) => {
390
356
  let { source: t } = r(e, (e) => {
391
357
  o(e, [{
392
358
  defaultImport: "LanguageSelect",
393
- moduleSpecifier: "$lib/components/language-select.svelte"
359
+ moduleSpecifier: "#lib/components/language-select.svelte"
394
360
  }]);
395
361
  });
396
362
  return t;
397
363
  });
398
364
  }
399
- function Y(e, t = "shadcn") {
365
+ function q(e, t = "shadcn") {
400
366
  let n = t === "plain";
401
367
  if (!m.existsSync(e)) return {
402
368
  status: "not-found",
403
- message: n ? q : G
369
+ message: n ? G : U
404
370
  };
405
371
  let r = c.fromPath(e);
406
372
  return r.hasElement("LanguageSelect") ? {
407
373
  status: "success",
408
374
  changed: !1
409
- } : n ? !r.getScript() || !r.insertBeforeChildren(H) ? {
375
+ } : n ? !r.getScript() || !r.insertBeforeChildren(B) ? {
410
376
  status: "failed",
411
- message: K
412
- } : (J(r), r.writeTo(e), {
377
+ message: W
378
+ } : (K(r), r.writeTo(e), {
413
379
  status: "success",
414
380
  changed: r.hasChanged()
415
- }) : r.hasElement("Navbar.List") ? (J(r), r.insertBeforeClosingTag("Navbar.List", V), r.writeTo(e), {
381
+ }) : r.hasElement("Navbar.List") ? (K(r), r.insertBeforeClosingTag("Navbar.List", z), r.writeTo(e), {
416
382
  status: "success",
417
383
  changed: r.hasChanged()
418
384
  }) : {
419
385
  status: "failed",
420
- message: W
386
+ message: H
421
387
  };
422
388
  }
423
389
  //#endregion
424
390
  //#region src/patterns/enable/i18n/welcome-catalog.ts
425
- var X = "src/routes/+page.svelte", Z = "src/locales/es.po", ne = ["<h1>Welcome to SvelteKit</h1>", "<p>Visit <a href=\"https://svelte.dev/docs/kit\">svelte.dev/docs/kit</a> to read the documentation</p>"].join("\n"), Q = [{
426
- reference: X,
391
+ var J = "src/routes/+page.svelte", Y = "src/locales/es.po", X = ["<h1>Welcome to SvelteKit</h1>", "<p>Visit <a href=\"https://svelte.dev/docs/kit\">svelte.dev/docs/kit</a> to read the documentation</p>"].join("\n"), Z = [{
392
+ reference: J,
427
393
  msgid: "Welcome to SvelteKit",
428
394
  msgstr: "Bienvenido a SvelteKit"
429
395
  }, {
430
- reference: X,
396
+ reference: J,
431
397
  msgid: "Visit <0>svelte.dev/docs/kit</0> to read the documentation",
432
398
  msgstr: "Visita <0>svelte.dev/docs/kit</0> para leer la documentación"
433
- }], re = {
399
+ }], Q = {
434
400
  reference: "src/lib/components/language-select.svelte",
435
401
  msgid: "Language",
436
402
  msgstr: "Idioma"
437
- }, ie = [
403
+ }, ee = [
438
404
  "msgid \"\"",
439
405
  "msgstr \"\"",
440
406
  "\"Source-Language: en\\n\"",
@@ -445,13 +411,13 @@ var X = "src/routes/+page.svelte", Z = "src/locales/es.po", ne = ["<h1>Welcome t
445
411
  "\"Plural-Forms: nplurals=3\\n\"",
446
412
  "\"X-Plurals-Order: one, many, other\\n\""
447
413
  ].join("\n"), $ = (e) => e.replace(/\s+/g, "");
448
- function ae(e, t) {
449
- if (m.existsSync(h.join(e, Z))) return null;
450
- let n = h.join(e, X);
451
- return !m.existsSync(n) || $(m.readFileSync(n, "utf8")) !== $(ne) ? null : {
452
- path: Z,
414
+ function te(e, t) {
415
+ if (m.existsSync(h.join(e, Y))) return null;
416
+ let n = h.join(e, J);
417
+ return !m.existsSync(n) || $(m.readFileSync(n, "utf8")) !== $(X) ? null : {
418
+ path: Y,
453
419
  language: "text",
454
- content: [ie, ...(t === "plain" ? [...Q, re] : Q).map((e) => [
420
+ content: [ee, ...(t === "plain" ? [...Z, Q] : Z).map((e) => [
455
421
  `#: ${e.reference}`,
456
422
  `msgid "${e.msgid}"`,
457
423
  `msgstr "${e.msgstr}"`
@@ -461,35 +427,35 @@ function ae(e, t) {
461
427
  }
462
428
  //#endregion
463
429
  //#region src/patterns/enable/i18n/generate.runtime.ts
464
- async function oe(e) {
430
+ async function ne(e) {
465
431
  let r = n(e), i = [], a = (e) => {
466
432
  e && i.push(e);
467
433
  };
468
434
  r.info("Modifying vite.config");
469
- let o = u(e.root, p) ?? h.join(e.root, p[0]);
470
- a(s(o, x(o))), r.info("Modifying config for i18n alias");
471
- let c = w(e.root);
435
+ let o = u(e.root, d) ?? h.join(e.root, d[0]);
436
+ a(s(o, x(o))), r.info("Adding #locales to package.json imports");
437
+ let c = f(e.root);
472
438
  a(s(c.filePath, c.outcome)), r.info("Modifying hooks.server.ts");
473
439
  let l = h.join(e.root, "src", "hooks.server.ts");
474
- a(s(l, k(l))), r.info("Modifying hooks.ts");
475
- let d = h.join(e.root, "src", "hooks.ts");
476
- a(s(d, F(d))), r.info("Modifying app.html");
477
- let f = h.join(e.root, "src", "app.html");
478
- a(s(f, R(f))), r.info("Modifying root +layout.ts");
479
- let g = h.join(e.root, "src", "routes", "+layout.ts");
480
- a(s(g, ee(g))), r.info("Modifying root layout language select");
481
- let _ = [
440
+ a(s(l, E(l))), r.info("Modifying hooks.ts");
441
+ let g = h.join(e.root, "src", "hooks.ts");
442
+ a(s(g, N(g))), r.info("Modifying app.html");
443
+ let _ = h.join(e.root, "src", "app.html");
444
+ a(s(_, I(_))), r.info("Modifying root +layout.ts");
445
+ let v = h.join(e.root, "src", "routes", "+layout.ts");
446
+ a(s(v, p(v))), r.info("Modifying root layout language select");
447
+ let y = [
482
448
  h.join(e.root, "src", "routes", "(public)", "root-layout.svelte"),
483
449
  h.join(e.root, "src", "routes", "root-layout.svelte"),
484
450
  h.join(e.root, "src", "routes", "(public)", "+layout.svelte"),
485
451
  h.join(e.root, "src", "routes", "+layout.svelte")
486
- ], v = t(e), y = _.find((e) => m.existsSync(e)) ?? (v === "plain" ? _[3] : _[0]);
487
- a(s(y, Y(y, v))), r.info("Updating .gitignore");
488
- let b = h.join(e.root, ".gitignore");
489
- a(s(b, B(b)));
490
- let S = ae(e.root, v);
491
- return S && r.info("Translating the welcome page into Spanish"), {
492
- creates: S ? [S] : [],
452
+ ], b = t(e), S = y.find((e) => m.existsSync(e)) ?? (b === "plain" ? y[3] : y[0]);
453
+ a(s(S, q(S, b))), r.info("Updating .gitignore");
454
+ let C = h.join(e.root, ".gitignore");
455
+ a(s(C, R(C)));
456
+ let w = te(e.root, b);
457
+ return w && r.info("Translating the welcome page into Spanish"), {
458
+ creates: w ? [w] : [],
493
459
  modifies: i,
494
460
  deletes: [],
495
461
  components: [],
@@ -500,6 +466,6 @@ async function oe(e) {
500
466
  };
501
467
  }
502
468
  //#endregion
503
- export { oe as generate };
469
+ export { ne as generate };
504
470
 
505
- //# sourceMappingURL=generate.runtime-FdZw277n.js.map
471
+ //# sourceMappingURL=generate.runtime-C6bSvGMb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.runtime-C6bSvGMb.js","names":["FAILURE_HINT","NOT_FOUND_HINT","FAILURE_HINT","FAILURE_HINT","FAILURE_HINT","NOT_FOUND_HINT","NOT_FOUND_HINT","dedent","withInMemoryScript","formatLikeSource","ensureImports","SvelteFile","addHandle","probeFirstExisting","VITE_CONFIG_CANDIDATES","modifyPackageImportsI18n","ensureRootLayoutI18n","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","ensureNamedImport","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","generate","logger","getLogger","options","modifies","pushResult","modifyOutcomeToFile","imports","rootLayoutCandidates","resolveUi","rootLayoutPath","p","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 { ensureRootLayoutI18n } from \"./modifies/+layout\";\nimport { modifyRootLayoutLanguageSelect } from \"./modifies/root-layout.svelte\";\nimport { welcomePageCatalog } from \"./welcome-catalog\";\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 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;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI,GAELC,IAAiB;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI;AAEX,SAAgBoB,EAAiB,GAAuC;CACtE,IAAI,CAACJ,EAAG,WAAWK,CAAc,GAC/B,OAAO;EAAE,QAAQ;EAAa,SAASrB;CAAe;CAOxD,IAAMsB,IAAa,IAJCC,EAAQ;EAC1B,iBAAiB,EAAE,SAAS,GAAK;EACjC,sBAAsB,EAAE,WAAWC,EAAU,OAAO;CACtD,CACmB,CAAA,CAAQ,oBAAoBH,CAAc,GAEzDI,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