@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
@@ -0,0 +1,147 @@
1
+ import { r as e } from "./lib-specifier-Cngo1zF_.js";
2
+ import { n as t } from "./logger-CQONztPm.js";
3
+ import { t as n } from "./shared-CZC4d7Uj.js";
4
+ import { _ as r, f as i, n as a, o, u as s } from "./ts-morph-helpers-CDW4lhox.js";
5
+ import { modifyOutcomeToFile as c } from "./modify-file-BlDeeurK.js";
6
+ import { t as l } from "./svelte-file-B3RfgVdt.js";
7
+ import { t as u } from "./unmodify-load-CyGzC1Hu.js";
8
+ import d from "node:fs";
9
+ import f from "node:path";
10
+ import { SyntaxKind as p } from "ts-morph";
11
+ //#region src/patterns/disable/teams/modifies/modify-nav-user.ts
12
+ function m(e) {
13
+ if (!d.existsSync(e)) return {
14
+ status: "success",
15
+ changed: !1
16
+ };
17
+ let t = d.readFileSync(e, "utf8");
18
+ if (!t.includes("/teams")) return {
19
+ status: "success",
20
+ changed: !1
21
+ };
22
+ let n = new l(t), r = !1, a = (e) => {
23
+ r || e((e) => {
24
+ let t = i(e, "Teams", "@lucide/svelte/icons/users");
25
+ return t.wasRemoved && (r = !0), t.source;
26
+ });
27
+ };
28
+ return a((e) => n.modifyModuleScript(e)), r || a((e) => n.modifyScript(e)), r ? (d.writeFileSync(e, n.toString(), "utf8"), {
29
+ status: "success",
30
+ changed: !0
31
+ }) : {
32
+ status: "success",
33
+ changed: !1
34
+ };
35
+ }
36
+ //#endregion
37
+ //#region src/patterns/disable/teams/modifies/+layout.server.ts
38
+ function h(e) {
39
+ return u(e, {
40
+ variables: ["team", "teams"],
41
+ dependsKeys: ["app:team"],
42
+ returnProps: ["team", "teams"]
43
+ });
44
+ }
45
+ //#endregion
46
+ //#region src/patterns/disable/teams/modifies/modify-app-layout.ts
47
+ function g(e) {
48
+ if (!d.existsSync(e)) return {
49
+ status: "success",
50
+ changed: !1
51
+ };
52
+ let t = l.fromPath(e);
53
+ return !t.hasElement("AppSidebar") || (t.removeAttribute("AppSidebar", "team"), t.removeAttribute("AppSidebar", "teams"), !t.hasChanged()) ? {
54
+ status: "success",
55
+ changed: !1
56
+ } : (t.writeTo(e), {
57
+ status: "success",
58
+ changed: !0
59
+ });
60
+ }
61
+ //#endregion
62
+ //#region src/patterns/disable/teams/modifies/modify-app-sidebar.ts
63
+ var _ = "<Sidebar.Header>\n <Sidebar.Menu>\n <Sidebar.MenuItem>\n <Sidebar.MenuButton size=\"lg\">\n {#snippet child({ props })}\n <a href=\"/dashboard\" {...props}>\n <div\n class=\"bg-sidebar-accent text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg\"\n >\n <img src={favicon} alt=\"logo\" class=\"size-6\" />\n </div>\n <div class=\"grid flex-1 text-left text-sm leading-tight\">\n <span class=\"truncate font-medium\">{site.name}</span>\n </div>\n </a>\n {/snippet}\n </Sidebar.MenuButton>\n </Sidebar.MenuItem>\n </Sidebar.Menu>\n </Sidebar.Header>", v = "{meta.appName}", y = [
64
+ ["TeamSwitcher", e("components/team-switcher.svelte")],
65
+ ["ChevronsUpDownIcon", "@lucide/svelte/icons/chevrons-up-down"],
66
+ ["Avatar", e("components/ui/avatar")]
67
+ ], b = ["team", "teams"];
68
+ function x(e) {
69
+ return e.replace(/<script[\s\S]*?<\/script>/g, "");
70
+ }
71
+ function S(e, t) {
72
+ let { source: n } = r(e, (e) => {
73
+ for (let t of e.getVariableDeclarations()) {
74
+ let e = t.getInitializer();
75
+ if (!e || e.getText() !== "$props()") continue;
76
+ let n = t.getNameNode();
77
+ if (n.getKind() !== p.ObjectBindingPattern) continue;
78
+ let r = t.getTypeNode();
79
+ if (r?.getKind() === p.IntersectionType) for (let e of r.asKindOrThrow(p.IntersectionType).getTypeNodes()) {
80
+ if (e.getKind() !== p.TypeLiteral) continue;
81
+ let t = e.asKindOrThrow(p.TypeLiteral), n = t.getProperties().length;
82
+ for (let e of b) t.getProperty(e)?.remove();
83
+ if (t.getProperties().length !== n) {
84
+ let e = t.getProperties().map((e) => e.getText().replace(/[;,]\s*$/, ""));
85
+ t.replaceWithText(`{ ${e.join("; ")} }`);
86
+ }
87
+ }
88
+ let i = n.asKindOrThrow(p.ObjectBindingPattern), a = i.getElements(), o = a.filter((e) => !b.includes(e.getName())).map((e) => e.getText());
89
+ o.length !== a.length && i.replaceWithText(`{ ${o.join(", ")} }`);
90
+ }
91
+ for (let [n, r] of y) RegExp(`\\b${n}\\b`).test(t) || s(e, r);
92
+ o(e), a(e);
93
+ });
94
+ return n;
95
+ }
96
+ function C(e) {
97
+ if (!d.existsSync(e)) return {
98
+ status: "success",
99
+ changed: !1
100
+ };
101
+ let t = l.fromPath(e);
102
+ if (!t.hasElement("TeamSwitcher")) return {
103
+ status: "success",
104
+ changed: !1
105
+ };
106
+ t.replaceElement("Sidebar.Header", t.toString().includes(v) ? _.replace("{site.name}", v) : _);
107
+ let n = x(t.toString());
108
+ return t.modifyScript((e) => S(e, n)), t.writeTo(e), {
109
+ status: "success",
110
+ changed: t.hasChanged()
111
+ };
112
+ }
113
+ //#endregion
114
+ //#region src/patterns/disable/teams/generate.runtime.ts
115
+ async function w(e) {
116
+ let r = t(e), i = [], a = (e) => {
117
+ e && i.push(e);
118
+ };
119
+ r.info("Reverting nav-user.svelte");
120
+ let o = [f.join(e.root, "src", "lib", "components", "nav-user.svelte")], s = o.find((e) => d.existsSync(e)) ?? o[0];
121
+ a(c(s, m(s))), r.info("Reverting (app) +layout.server.ts");
122
+ let l = f.join(e.root, "src", "routes", "(app)", "+layout.server.ts");
123
+ a(c(l, h(l))), r.info("Reverting (app) +layout.svelte");
124
+ let u = f.join(e.root, "src", "routes", "(app)", "+layout.svelte");
125
+ a(c(u, g(u))), r.info("Reverting app-sidebar.svelte");
126
+ let p = f.join(e.root, "src", "lib", "components", "app-sidebar.svelte");
127
+ return a(c(p, C(p))), {
128
+ creates: [],
129
+ modifies: i,
130
+ deletes: [],
131
+ components: [],
132
+ packages: [],
133
+ collections: [],
134
+ collectionPatches: [],
135
+ collectionDrops: await n([
136
+ "team_users",
137
+ "team_invite_links",
138
+ "team_invites",
139
+ "team_memberships",
140
+ "teams"
141
+ ], e)
142
+ };
143
+ }
144
+ //#endregion
145
+ export { w as generate };
146
+
147
+ //# sourceMappingURL=generate.runtime-BA3tDKnn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.runtime-BA3tDKnn.js","names":["libModule","getLogger","planDropsForCollections","withInMemoryScript","removeNavItemFromScript","ensureBlankLineAfterImports","removeImportByModuleSpecifier","SvelteFile","removeFromLoad","fs","path","unmodifyNavUser","navUserPath","source","file","wasRemoved","tryRemove","run","result","src","fn","unmodifyLayoutServer","layoutServerPath","unmodifyAppLayoutSvelte","layoutPath","ORIGINAL_HEADER","LEGACY_NAME","TEAM_IMPORTS","TEAM_PROPS","markupOf","revertAppSidebarScript","out","decl","sf","init","nameNode","SyntaxKind","typeNode","member","literal","before","name","remaining","p","pattern","elements","kept","el","moduleSpecifier","markup","formatLikeSource","unmodifyAppSidebar","appSidebarPath","generate","logger","options","modifies","pushResult","navUserCandidates","modifyOutcomeToFile","appLayoutPath"],"sources":["../../src/patterns/disable/teams/modifies/modify-nav-user.ts","../../src/patterns/disable/teams/modifies/+layout.server.ts","../../src/patterns/disable/teams/modifies/modify-app-layout.ts","../../src/patterns/disable/teams/modifies/modify-app-sidebar.ts","../../src/patterns/disable/teams/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport { removeNavItemFromScript } from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyNavUser(navUserPath: string): ModifyOutcome {\n if (!fs.existsSync(navUserPath)) {\n return { status: \"success\", changed: false };\n }\n\n const source = fs.readFileSync(navUserPath, \"utf8\");\n if (!source.includes(\"/teams\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = new SvelteFile(source);\n let wasRemoved = false;\n\n const tryRemove = (run: (fn: (s: string) => string) => boolean) => {\n if (wasRemoved) return;\n run((src) => {\n const result = removeNavItemFromScript(\n src,\n \"Teams\",\n \"@lucide/svelte/icons/users\",\n );\n if (result.wasRemoved) wasRemoved = true;\n return result.source;\n });\n };\n\n tryRemove((fn) => file.modifyModuleScript(fn));\n if (!wasRemoved) tryRemove((fn) => file.modifyScript(fn));\n\n if (!wasRemoved) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(navUserPath, file.toString(), \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import type { ModifyOutcome } from \"../../../../core/types\";\nimport { removeFromLoad } from \"../../../../runtime/unmodify-load\";\n\n/** Take the team loader back out of the (app) layout's load. */\nexport function unmodifyLayoutServer(layoutServerPath: string): ModifyOutcome {\n return removeFromLoad(layoutServerPath, {\n variables: [\"team\", \"teams\"],\n dependsKeys: [\"app:team\"],\n returnProps: [\"team\", \"teams\"],\n });\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\n/** Drop the team props enable-teams passed to <AppSidebar>. */\nexport function unmodifyAppLayoutSvelte(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n if (!file.hasElement(\"AppSidebar\")) {\n return { status: \"success\", changed: false };\n }\n\n file.removeAttribute(\"AppSidebar\", \"team\");\n file.removeAttribute(\"AppSidebar\", \"teams\");\n if (!file.hasChanged()) {\n return { status: \"success\", changed: false };\n }\n\n file.writeTo(layoutPath);\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { SyntaxKind } from \"ts-morph\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n withInMemoryScript,\n formatLikeSource,\n type ModuleMatch,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\n\n/** The header enable-auth ships, which the team switcher replaced. */\nconst ORIGINAL_HEADER = `<Sidebar.Header>\n\t\t<Sidebar.Menu>\n\t\t\t<Sidebar.MenuItem>\n\t\t\t\t<Sidebar.MenuButton size=\"lg\">\n\t\t\t\t\t{#snippet child({ props })}\n\t\t\t\t\t\t<a href=\"/dashboard\" {...props}>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclass=\"bg-sidebar-accent text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<img src={favicon} alt=\"logo\" class=\"size-6\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"grid flex-1 text-left text-sm leading-tight\">\n\t\t\t\t\t\t\t\t<span class=\"truncate font-medium\">{site.name}</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t{/snippet}\n\t\t\t\t</Sidebar.MenuButton>\n\t\t\t</Sidebar.MenuItem>\n\t\t</Sidebar.Menu>\n\t</Sidebar.Header>`;\n\n/**\n * A sidebar from before `#lib/site.js` names the app with a `meta` prop; the\n * header goes back to whichever the team switcher's fallback used.\n */\nconst LEGACY_NAME = \"{meta.appName}\";\n\n/** Imports enable-teams added, dropped once the markup no longer uses them. */\nconst TEAM_IMPORTS: [name: string, module: ModuleMatch][] = [\n [\"TeamSwitcher\", libModule(\"components/team-switcher.svelte\")],\n [\"ChevronsUpDownIcon\", \"@lucide/svelte/icons/chevrons-up-down\"],\n [\"Avatar\", libModule(\"components/ui/avatar\")],\n];\n\nconst TEAM_PROPS = [\"team\", \"teams\"];\n\nfunction markupOf(source: string): string {\n return source.replace(/<script[\\s\\S]*?<\\/script>/g, \"\");\n}\n\nfunction revertAppSidebarScript(source: string, markup: string): string {\n const { source: out } = withInMemoryScript(source, (sf) => {\n for (const decl of sf.getVariableDeclarations()) {\n const init = decl.getInitializer();\n if (!init || init.getText() !== \"$props()\") continue;\n\n const nameNode = decl.getNameNode();\n if (nameNode.getKind() !== SyntaxKind.ObjectBindingPattern) continue;\n\n // Type first: rewriting the binding pattern shifts what follows.\n const typeNode = decl.getTypeNode();\n if (typeNode?.getKind() === SyntaxKind.IntersectionType) {\n for (const member of typeNode\n .asKindOrThrow(SyntaxKind.IntersectionType)\n .getTypeNodes()) {\n if (member.getKind() !== SyntaxKind.TypeLiteral) continue;\n const literal = member.asKindOrThrow(SyntaxKind.TypeLiteral);\n const before = literal.getProperties().length;\n for (const name of TEAM_PROPS) {\n literal.getProperty(name)?.remove();\n }\n if (literal.getProperties().length !== before) {\n // Collapse to one line, as enable-auth writes it; prettier keeps\n // whichever shape it finds.\n const remaining = literal\n .getProperties()\n .map((p) => p.getText().replace(/[;,]\\s*$/, \"\"));\n literal.replaceWithText(`{ ${remaining.join(\"; \")} }`);\n }\n }\n }\n\n const pattern = nameNode.asKindOrThrow(SyntaxKind.ObjectBindingPattern);\n const elements = pattern.getElements();\n const kept = elements\n .filter((el) => !TEAM_PROPS.includes(el.getName()))\n .map((el) => el.getText());\n if (kept.length !== elements.length) {\n pattern.replaceWithText(`{ ${kept.join(\", \")} }`);\n }\n }\n\n for (const [name, moduleSpecifier] of TEAM_IMPORTS) {\n if (!new RegExp(`\\\\b${name}\\\\b`).test(markup)) {\n removeImportByModuleSpecifier(sf, moduleSpecifier);\n }\n }\n formatLikeSource(sf);\n ensureBlankLineAfterImports(sf);\n });\n return out;\n}\n\n/** Put the plain app-name header back in place of the team switcher. */\nexport function unmodifyAppSidebar(appSidebarPath: string): ModifyOutcome {\n if (!fs.existsSync(appSidebarPath)) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(appSidebarPath);\n if (!file.hasElement(\"TeamSwitcher\")) {\n return { status: \"success\", changed: false };\n }\n\n file.replaceElement(\n \"Sidebar.Header\",\n file.toString().includes(LEGACY_NAME)\n ? ORIGINAL_HEADER.replace(\"{site.name}\", LEGACY_NAME)\n : ORIGINAL_HEADER,\n );\n const markup = markupOf(file.toString());\n file.modifyScript((source) => revertAppSidebarScript(source, markup));\n file.writeTo(appSidebarPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import path from \"node:path\";\nimport fs from \"node:fs\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { unmodifyNavUser } from \"./modifies/modify-nav-user\";\nimport { unmodifyLayoutServer } from \"./modifies/+layout.server\";\nimport { unmodifyAppLayoutSvelte } from \"./modifies/modify-app-layout\";\nimport { unmodifyAppSidebar } from \"./modifies/modify-app-sidebar\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Reverting nav-user.svelte\");\n const navUserCandidates = [\n path.join(options.root, \"src\", \"lib\", \"components\", \"nav-user.svelte\"),\n ];\n const navUserPath =\n navUserCandidates.find((p) => fs.existsSync(p)) ?? navUserCandidates[0];\n pushResult(modifyOutcomeToFile(navUserPath, unmodifyNavUser(navUserPath)));\n\n logger.info(\"Reverting (app) +layout.server.ts\");\n const layoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"+layout.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n layoutServerPath,\n unmodifyLayoutServer(layoutServerPath),\n ),\n );\n\n logger.info(\"Reverting (app) +layout.svelte\");\n const appLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(appLayoutPath, unmodifyAppLayoutSvelte(appLayoutPath)),\n );\n\n logger.info(\"Reverting app-sidebar.svelte\");\n const appSidebarPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"app-sidebar.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(appSidebarPath, unmodifyAppSidebar(appSidebarPath)),\n );\n\n const collectionDrops = await planDropsForCollections(\n // team_users is a view over teams, so it has to go first or PocketBase\n // refuses to drop teams (\"existing reference in team_users\").\n [\n \"team_users\",\n \"team_invite_links\",\n \"team_invites\",\n \"team_memberships\",\n \"teams\",\n ],\n options,\n );\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops,\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;;AAKA,SAAgBW,EAAgB,GAAoC;CAClE,IAAI,CAACF,EAAG,WAAWG,CAAW,G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ACvE,GACM3C,IACJ8C,EAAkB,MAAM,MAAMjD,EAAG,WAAWkC,CAAC,CAAC,KAAKe,EAAkB;CAGvE,AAFAD,EAAWE,EAAoB/C,GAAaD,EAAgBC,CAAW,CAAC,CAAC,GAEzE0C,EAAO,KAAK,mCAAmC;CAC/C,IAAMhC,IAAmBZ,EAAK,KAC5B6C,EAAQ,MACR,OACA,UACA,SACA,mBACF;CAQA,AAPAE,EACEE,EACErC,GACAD,EAAqBC,CAAgB,CACvC,CACF,GAEAgC,EAAO,KAAK,gCAAgC;CAC5C,IAAMM,IAAgBlD,EAAK,KACzB6C,EAAQ,MACR,OACA,UACA,SACA,gBACF;CAKA,AAJAE,EACEE,EAAoBC,GAAerC,EAAwBqC,CAAa,CAAC,CAC3E,GAEAN,EAAO,KAAK,8BAA8B;CAC1C,IAAMF,IAAiB1C,EAAK,KAC1B6C,EAAQ,MACR,OACA,OACA,cACA,oBACF;CAkBA,OAjBAE,EACEE,EAAoBP,GAAgBD,EAAmBC,CAAc,CAAC,CACxE,GAeO;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAA,MArB4BlD,EAG5B;GACE;GACA;GACA;GACA;GACA;EACF,GACAqD,CACF;CAWA;AACF"}
@@ -1,9 +1,9 @@
1
1
  import { t as e } from "./dedent-Gq6Krl4n.js";
2
2
  import { n as t } from "./logger-CQONztPm.js";
3
- import { n, r, t as i } from "./nav-user-BYI-h8Od.js";
4
- import { t as a } from "./shared-C8GtNxpm.js";
5
- import { _ as o, o as s, u as c } from "./ts-morph-helpers-CeduA--o.js";
6
- import { modifyOutcomeToFile as l } from "./modify-file-Dwfv0dCI.js";
3
+ import { n, r, t as i } from "./nav-user-BRIHOOpG.js";
4
+ import { t as a } from "./shared-CZC4d7Uj.js";
5
+ import { _ as o, o as s, u as c } from "./ts-morph-helpers-CDW4lhox.js";
6
+ import { modifyOutcomeToFile as l } from "./modify-file-BlDeeurK.js";
7
7
  import { t as u } from "./svelte-file-B3RfgVdt.js";
8
8
  import d from "node:fs";
9
9
  import f from "node:path";
@@ -185,4 +185,4 @@ async function T(e) {
185
185
  //#endregion
186
186
  export { T as generate };
187
187
 
188
- //# sourceMappingURL=generate.runtime-4FDxnvCl.js.map
188
+ //# sourceMappingURL=generate.runtime-BO778G0r.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.runtime-BO778G0r.js","names":["paymentsNavUserTemplate","paymentsBillingPageServerTemplate","paymentsBillingPageSvelteTemplate","dedent","getLogger","nav_user_default","planDropsForCollections","withInMemoryScript","formatLikeSource","removeImportByModuleSpecifier","SvelteFile","fs","path","SUBSCRIPTION_CASE_VALUES","unmodifyWebhookServer","filePath","original","sf","switchStmt","SyntaxKind","stmt","toRemove","clause","expr","literal","c","spaced","source","unmodifyAppLayoutSvelte","file","updateScript","out","decl","init","nameNode","pattern","elements","hasSub","typeNode","intersection","member","lit","propTexts","p","t","remaining","unmodifyAppSidebar","hasSubPropType","hasSubProp","hasNavUserSubAttr","revertByTemplate","current","enabledMarker","stripped","template","BASELINE","unmodifyAppLayoutServer","unmodifyNavUser","paymentsNavUserTemplate","unmodifyBillingPageServer","paymentsBillingPageServerTemplate","unmodifyBillingPageSvelte","paymentsBillingPageSvelteTemplate","generate","logger","options","modifies","pushResult","webhookServerPath","modifyOutcomeToFile","appLayoutServerPath","appLayoutSveltePath","appSidebarPath","navUserPath","billingPageServerPath","_page_server_default","billingPageSveltePath","_page_default"],"sources":["../../src/patterns/disable/subscriptions/modifies/modify-webhook-server.ts","../../src/patterns/disable/subscriptions/modifies/modify-app-layout-svelte.ts","../../src/patterns/disable/subscriptions/modifies/modify-app-sidebar.ts","../../src/patterns/disable/subscriptions/modifies/revert-by-template.ts","../../src/patterns/disable/subscriptions/modifies/modify-app-layout-server.ts","../../src/patterns/disable/subscriptions/modifies/modify-nav-user.ts","../../src/patterns/disable/subscriptions/modifies/modify-billing-page-server.ts","../../src/patterns/disable/subscriptions/modifies/modify-billing-page-svelte.ts","../../src/patterns/disable/subscriptions/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n removeImportByModuleSpecifier,\n withInMemoryScript,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nconst SUBSCRIPTION_CASE_VALUES = new Set([\n \"customer.subscription.created\",\n \"customer.subscription.updated\",\n \"customer.subscription.deleted\",\n]);\n\nexport function unmodifyWebhookServer(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"success\", changed: false };\n }\n const original = fs.readFileSync(filePath, \"utf8\");\n if (!original.includes(\"handleSubscriptionCreated\")) {\n return { status: \"success\", changed: false };\n }\n\n const { source } = withInMemoryScript(original, (sf) => {\n removeImportByModuleSpecifier(sf, \"./subscription/created\");\n removeImportByModuleSpecifier(sf, \"./subscription/updated\");\n removeImportByModuleSpecifier(sf, \"./subscription/deleted\");\n\n const switchStmt = sf\n .getDescendantsOfKind(SyntaxKind.SwitchStatement)\n .find((stmt) => stmt.getExpression().getText().includes(\"event.type\"));\n if (!switchStmt) return;\n\n const caseBlock = switchStmt.getCaseBlock();\n // Collect matching case clauses first — removing invalidates node refs.\n const toRemove = caseBlock\n .getClauses()\n .filter((clause) => {\n if (clause.getKind() !== SyntaxKind.CaseClause) return false;\n const caseClause = clause.asKindOrThrow(SyntaxKind.CaseClause);\n const expr = caseClause.getExpression();\n const literal =\n expr.asKind(SyntaxKind.StringLiteral) ??\n expr.asKind(SyntaxKind.NoSubstitutionTemplateLiteral);\n if (!literal) return false;\n return SUBSCRIPTION_CASE_VALUES.has(literal.getLiteralValue());\n })\n .map((c) => c.asKindOrThrow(SyntaxKind.CaseClause));\n\n for (const clause of toRemove.reverse()) {\n clause.remove();\n }\n\n formatLikeSource(sf);\n });\n\n // Removing the clauses takes the blank line before `default:` with them.\n const spaced = source.replace(/(break;)\\n(\\s*default:)/, \"$1\\n\\n$2\");\n\n if (spaced === original) {\n return { status: \"success\", changed: false };\n }\n fs.writeFileSync(filePath, spaced, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyAppLayoutSvelte(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(filePath);\n if (!file.hasElement(\"AppSidebar\")) {\n return { status: \"success\", changed: false };\n }\n if (!file.hasAttribute(\"AppSidebar\", \"subscription\")) {\n return { status: \"success\", changed: false };\n }\n\n const removed = file.removeAttribute(\"AppSidebar\", \"subscription\");\n if (!removed) {\n return { status: \"success\", changed: false };\n }\n\n file.writeTo(filePath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport { SyntaxKind } from \"ts-morph\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n withInMemoryScript,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nfunction updateScript(source: string): string {\n const { source: out } = withInMemoryScript(source, (sf) => {\n for (const decl of sf.getVariableDeclarations()) {\n const init = decl.getInitializer();\n if (!init || init.getText() !== \"$props()\") continue;\n\n const nameNode = decl.getNameNode();\n if (nameNode.getKind() !== SyntaxKind.ObjectBindingPattern) continue;\n const pattern = nameNode.asKindOrThrow(SyntaxKind.ObjectBindingPattern);\n const elements = pattern.getElements();\n const hasSub = elements.some((e) => e.getName() === \"subscription\");\n\n // Strip subscription from the props type literal (the specific type\n // added by enable-subscriptions — leave unrelated `subscription` props\n // alone).\n const typeNode = decl.getTypeNode();\n if (typeNode?.getKind() === SyntaxKind.IntersectionType) {\n const intersection = typeNode.asKindOrThrow(\n SyntaxKind.IntersectionType,\n );\n for (const member of intersection.getTypeNodes()) {\n if (member.getKind() !== SyntaxKind.TypeLiteral) continue;\n const lit = member.asKindOrThrow(SyntaxKind.TypeLiteral);\n const propTexts = lit\n .getProperties()\n .map((p) => p.getText().replace(/[;,]\\s*$/, \"\"))\n .filter((t) => !/^\\s*subscription\\??\\s*:/.test(t));\n lit.replaceWithText(\n propTexts.length ? `{ ${propTexts.join(\"; \")}; }` : \"{}\",\n );\n break;\n }\n }\n\n if (hasSub) {\n const remaining = elements\n .filter((e) => e.getName() !== \"subscription\")\n .map((e) => e.getText());\n pattern.replaceWithText(`{ ${remaining.join(\", \")} }`);\n }\n }\n formatLikeSource(sf);\n });\n return out;\n}\n\nexport function unmodifyAppSidebar(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"success\", changed: false };\n }\n\n const source = fs.readFileSync(filePath, \"utf8\");\n const hasSubPropType = /subscription\\??\\s*:\\s*\\{/.test(source);\n const hasSubProp = /\\bsubscription\\s*=\\s*null\\b/.test(source);\n\n const file = new SvelteFile(source);\n const hasNavUserSubAttr =\n file.hasElement(\"NavUser\") && file.hasAttribute(\"NavUser\", \"subscription\");\n\n if (!hasSubPropType && !hasSubProp && !hasNavUserSubAttr) {\n return { status: \"success\", changed: false };\n }\n\n if (hasSubPropType || hasSubProp) {\n file.modifyScript(updateScript);\n }\n if (hasNavUserSubAttr) {\n file.removeAttribute(\"NavUser\", \"subscription\");\n }\n\n file.writeTo(filePath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\n/**\n * Rewrites a file to the given `template` if the current content still shows\n * the `enabledMarker` (meaning enable-subscriptions is applied). If the marker\n * is absent (already reverted or never applied), it's a no-op.\n *\n * Strips leading `// [!code highlight:N]` / `<!-- [!code highlight:N] -->`\n * lines so templates can be pulled from `preview-modifies/` directories which\n * use those for documentation highlighting.\n */\nexport function revertByTemplate(\n filePath: string,\n template: string,\n enabledMarker: string,\n): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"success\", changed: false };\n }\n const current = fs.readFileSync(filePath, \"utf8\");\n if (!current.includes(enabledMarker)) {\n return { status: \"success\", changed: false };\n }\n const stripped = template\n .replace(/^[ \\t]*\\/\\/[ \\t]*\\[!code highlight:\\d+\\][ \\t]*\\r?\\n/gm, \"\")\n .replace(\n /^[ \\t]*<!--[ \\t]*\\[!code highlight:\\d+\\][ \\t]*-->[ \\t]*\\r?\\n/gm,\n \"\",\n );\n if (current === stripped) {\n return { status: \"success\", changed: false };\n }\n fs.writeFileSync(filePath, stripped, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import dedent from \"dedent\";\nimport { revertByTemplate } from \"./revert-by-template\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\n// Baseline velastack-auth (app)/+layout.server.ts — the state of the file\n// before enable-subscriptions wrapped it with loadActiveSubscription.\nconst BASELINE =\n dedent`\n export const load = ({ locals }) => {\n \\tconst user = locals.pb.authStore.record!;\n \\tconst breadcrumbs = [{ title: 'Home', url: '/dashboard' }];\n\n \\treturn { user, breadcrumbs };\n };\n` + \"\\n\";\n\nexport function unmodifyAppLayoutServer(filePath: string): ModifyOutcome {\n return revertByTemplate(filePath, BASELINE, \"loadActiveSubscription\");\n}\n","import { revertByTemplate } from \"./revert-by-template\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyNavUser(\n filePath: string,\n paymentsNavUserTemplate: string,\n): ModifyOutcome {\n return revertByTemplate(filePath, paymentsNavUserTemplate, \"planLabel\");\n}\n","import { revertByTemplate } from \"./revert-by-template\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyBillingPageServer(\n filePath: string,\n paymentsBillingPageServerTemplate: string,\n): ModifyOutcome {\n return revertByTemplate(\n filePath,\n paymentsBillingPageServerTemplate,\n \"selectPlan\",\n );\n}\n","import { revertByTemplate } from \"./revert-by-template\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyBillingPageSvelte(\n filePath: string,\n paymentsBillingPageSvelteTemplate: string,\n): ModifyOutcome {\n return revertByTemplate(\n filePath,\n paymentsBillingPageSvelteTemplate,\n \"availablePlans\",\n );\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\nimport { unmodifyWebhookServer } from \"./modifies/modify-webhook-server\";\nimport { unmodifyAppLayoutSvelte } from \"./modifies/modify-app-layout-svelte\";\nimport { unmodifyAppSidebar } from \"./modifies/modify-app-sidebar\";\nimport { unmodifyAppLayoutServer } from \"./modifies/modify-app-layout-server\";\nimport { unmodifyNavUser } from \"./modifies/modify-nav-user\";\nimport { unmodifyBillingPageServer } from \"./modifies/modify-billing-page-server\";\nimport { unmodifyBillingPageSvelte } from \"./modifies/modify-billing-page-svelte\";\n\n// Pull the \"post-payments\" state of files that enable-subscriptions fully\n// overwrote. For the billing pages, that's exactly what enable-payments\n// writes in creates-app-mode; for nav-user it's the payments preview-modifies\n// snapshot (with highlight annotations stripped by the revert helper).\nimport paymentsNavUserTemplate from \"../../enable/payments/preview-modifies/src/lib/components/nav-user.svelte?raw\";\nimport paymentsBillingPageServerTemplate from \"../../enable/payments/creates-app-mode/src/routes/(app)/billing/+page.server.ts?raw\";\nimport paymentsBillingPageSvelteTemplate from \"../../enable/payments/creates-app-mode/src/routes/(app)/billing/+page.svelte?raw\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Reverting webhooks/stripe/handlers/dispatch.ts\");\n const webhookServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"webhooks\",\n \"stripe\",\n \"handlers\",\n \"dispatch.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n webhookServerPath,\n unmodifyWebhookServer(webhookServerPath),\n ),\n );\n\n logger.info(\"Reverting (app)/+layout.server.ts\");\n const appLayoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"+layout.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n appLayoutServerPath,\n unmodifyAppLayoutServer(appLayoutServerPath),\n ),\n );\n\n logger.info(\"Reverting (app)/+layout.svelte\");\n const appLayoutSveltePath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n appLayoutSveltePath,\n unmodifyAppLayoutSvelte(appLayoutSveltePath),\n ),\n );\n\n logger.info(\"Reverting app-sidebar.svelte\");\n const appSidebarPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"app-sidebar.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(appSidebarPath, unmodifyAppSidebar(appSidebarPath)),\n );\n\n logger.info(\"Reverting nav-user.svelte\");\n const navUserPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"nav-user.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n navUserPath,\n unmodifyNavUser(navUserPath, paymentsNavUserTemplate),\n ),\n );\n\n logger.info(\"Reverting billing/+page.server.ts\");\n const billingPageServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"billing\",\n \"+page.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n billingPageServerPath,\n unmodifyBillingPageServer(\n billingPageServerPath,\n paymentsBillingPageServerTemplate,\n ),\n ),\n );\n\n logger.info(\"Reverting billing/+page.svelte\");\n const billingPageSveltePath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"billing\",\n \"+page.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n billingPageSveltePath,\n unmodifyBillingPageSvelte(\n billingPageSveltePath,\n paymentsBillingPageSvelteTemplate,\n ),\n ),\n );\n\n const collectionDrops = await planDropsForCollections(\n [\"stripe_subscriptions\"],\n options,\n );\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops,\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;;AASA,IAAMa,oBAA2B,IAAI,IAAI;CACvC;CACA;CACA;AACF,CAAC;AAED,SAAgBC,EAAsB,GAAiC;CACrE,IAAI,CAACH,EAAG,WAAWI,CAAQ,GACzB,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAE7C,IAAMC,IAAWL,EAAG,aAAaI,GAAU,MAAM;CACjD,IAAI,CAACC,EAAS,SAAS,2BAA2B,GAChD,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAM,EAAE,cAAWT,EAAmBS,IAAW,MAAO;EAGtD,AAFAP,EAA8BQ,GAAI,wBAAwB,GAC1DR,EAA8BQ,GAAI,wBAAwB,GAC1DR,EAA8BQ,GAAI,wBAAwB;EAE1D,IAAMC,IAAaD,EAChB,qBAAqBE,EAAW,eAAe,CAAC,CAChD,MAAM,MAASC,EAAK,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,YAAY,CAAC;EACvE,IAAI,CAACF,GAAY;EAIjB,IAAMG,IAFYH,EAAW,aAEZ,CAAA,CACd,WAAW,CAAC,CACZ,QAAQ,MAAW;GAClB,IAAII,EAAO,QAAQ,MAAMH,EAAW,YAAY,OAAO;GAEvD,IAAMI,IADaD,EAAO,cAAcH,EAAW,UACtC,CAAA,CAAW,cAAc,GAChCK,IACJD,EAAK,OAAOJ,EAAW,aAAa,KACpCI,EAAK,OAAOJ,EAAW,6BAA6B;GAEtD,OADKK,IACEX,EAAyB,IAAIW,EAAQ,gBAAgB,CAAC,IADxC;EAEvB,CAAC,CAAC,CACD,KAAK,MAAMC,EAAE,cAAcN,EAAW,UAAU,CAAC;EAEpD,KAAK,IAAMG,KAAUD,EAAS,QAAQ,GACpC,EAAO,OAAO;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AC7C,CACF,GAEAN,EAAO,KAAK,gCAAgC;CAC5C,IAAMO,IAAsB3D,EAAK,KAC/BqD,EAAQ,MACR,OACA,UACA,SACA,gBACF;CAQA,AAPAE,EACEE,EACEE,GACA3C,EAAwB2C,CAAmB,CAC7C,CACF,GAEAP,EAAO,KAAK,8BAA8B;CAC1C,IAAMQ,IAAiB5D,EAAK,KAC1BqD,EAAQ,MACR,OACA,OACA,cACA,oBACF;CAKA,AAJAE,EACEE,EAAoBG,GAAgB1B,EAAmB0B,CAAc,CAAC,CACxE,GAEAR,EAAO,KAAK,2BAA2B;CACvC,IAAMS,IAAc7D,EAAK,KACvBqD,EAAQ,MACR,OACA,OACA,cACA,iBACF;CAQA,AAPAE,EACEE,EACEI,GACAhB,EAAgBgB,GAAazE,CAAuB,CACtD,CACF,GAEAgE,EAAO,KAAK,mCAAmC;CAC/C,IAAMU,IAAwB9D,EAAK,KACjCqD,EAAQ,MACR,OACA,UACA,SACA,WACA,iBACF;CAWA,AAVAE,EACEE,EACEK,GACAf,EACEe,GACAzE,CACF,CACF,CACF,GAEA+D,EAAO,KAAK,gCAAgC;CAC5C,IAAMY,IAAwBhE,EAAK,KACjCqD,EAAQ,MACR,OACA,UACA,SACA,WACA,cACF;CAgBA,OAfAE,EACEE,EACEO,GACAf,EACEe,GACA1E,CACF,CACF,CACF,GAOO;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAA,MAb4BI,EAC5B,CAAC,sBAAsB,GACvB2D,CACF;CAWA;AACF"}
@@ -2,18 +2,18 @@ import { a as e } from "./util-BLYliuUK.js";
2
2
  import { t } from "./dedent-Gq6Krl4n.js";
3
3
  import { n } from "./logger-CQONztPm.js";
4
4
  import { t as r } from "./pocketbase-DpudAAmd.js";
5
- import { _ as i, o as a, r as o } from "./ts-morph-helpers-CeduA--o.js";
6
- import { modifyOutcomeToFile as s } from "./modify-file-Dwfv0dCI.js";
5
+ import { _ as i, o as a, r as o } from "./ts-morph-helpers-CDW4lhox.js";
6
+ import { modifyOutcomeToFile as s } from "./modify-file-BlDeeurK.js";
7
7
  import { t as c } from "./svelte-file-B3RfgVdt.js";
8
- import { i as l, n as u, t as d } from "./pocketbase-BkhUywtb.js";
8
+ import { i as l, n as u, t as d } from "./pocketbase-Dry6ry17.js";
9
9
  import { t as f } from "./modify-utils-Cw-on_cL.js";
10
- import { applyCollectionRulePatches as p, createCollectionIdempotent as m } from "./collections-CrOvS2E7.js";
10
+ import { applyCollectionRulePatches as p, createCollectionIdempotent as m } from "./collections-Dz2fvKnz.js";
11
11
  import h from "node:fs";
12
12
  import g from "node:path";
13
13
  import { Project as _, SyntaxKind as v } from "ts-morph";
14
14
  //#region src/patterns/enable/notifications/modifies/modify-app-layout.ts
15
15
  var y = "\n <div class=\"ml-auto px-4\">\n <NotificationsBell />\n </div>\n ", b = t`
16
- import NotificationsBell from '$lib/components/notifications-bell.svelte';
16
+ import NotificationsBell from '#lib/components/notifications-bell.svelte';
17
17
  `, x = [
18
18
  "Add the notifications bell inside the (app) layout's <header>.",
19
19
  "",
@@ -46,7 +46,7 @@ function C(e) {
46
46
  let { source: t } = i(e, (e) => {
47
47
  o(e, [{
48
48
  defaultImport: "NotificationsBell",
49
- moduleSpecifier: "$lib/components/notifications-bell.svelte"
49
+ moduleSpecifier: "#lib/components/notifications-bell.svelte"
50
50
  }]);
51
51
  });
52
52
  return t;
@@ -289,4 +289,4 @@ async function k(e) {
289
289
  //#endregion
290
290
  export { k as generate };
291
291
 
292
- //# sourceMappingURL=generate.runtime-Um77JfwC.js.map
292
+ //# sourceMappingURL=generate.runtime-B_UVGa3q.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.runtime-B_UVGa3q.js","names":["languageFromPath","NOTIFICATION_RULE_PATCHES","withInMemoryScript","formatLikeSource","ensureImports","SvelteFile","withPocketbase","migrationDelay","getMigrationFile","modifyUtils","fs","path","BELL_SNIPPET","IMPORT_SNIPPET","FAILURE_HINT","NOT_FOUND_HINT","modifyAppLayout","layoutPath","file","out","source","sf","FETCH_STATEMENT","NOTIFICATIONS_STATEMENT","DEPENDS_STATEMENT","modifyLayoutServer","layoutServerPath","snippet","originalSource","sourceFile","Project","addProperty","obj","name","initializer","loadArrow","loadFn","varDecl","SyntaxKind","directArrow","init","innerArrow","innerFnExpr","maybeFn","fnLike","params","first","original","nameNode","obp","elementNames","el","hasDepends","hasLocals","existingParts","parts","currentName","body","blockBody","statements","declaresVar","stmt","d","hasDependsCall","ce","args","argText","hasNotificationsList","hasNotifications","returnIdx","s","insertAt","augmentReturnObject","augmentReturns","expr","ret","inner","arrowBody","bodyExpr","fnBody","pushMigrationCreates","created","migrationFile","collectionName","options","creates","generate","logger","getLogger","userCollection","pb","create","createCollectionIdempotent","spec","result","ruleMigrations","applyCollectionRulePatches","modifies","pushResult","appLayoutPath","modifyOutcomeToFile","appLayoutServerPath","utilsPath"],"sources":["../../src/patterns/enable/notifications/modifies/modify-app-layout.ts","../../src/patterns/enable/notifications/modifies/+layout.server.ts","../../src/patterns/enable/notifications/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureImports,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst BELL_SNIPPET = `\n\t\t<div class=\"ml-auto px-4\">\n\t\t\t<NotificationsBell />\n\t\t</div>\n\t`;\n\nconst IMPORT_SNIPPET = dedent`\n import NotificationsBell from '#lib/components/notifications-bell.svelte';\n`;\n\nconst FAILURE_HINT = [\n \"Add the notifications bell inside the (app) layout's <header>.\",\n \"\",\n \"Imports to add to the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup to add inside <header>:\",\n BELL_SNIPPET,\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create src/routes/(app)/+layout.svelte with a <header> that includes the bell.\",\n \"\",\n \"Imports for the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup inside <header>:\",\n BELL_SNIPPET,\n].join(\"\\n\");\n\nexport function modifyAppLayout(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n if (!file.hasElement(\"header\")) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n if (file.hasElement(\"NotificationsBell\")) {\n return { status: \"success\", changed: false };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n {\n defaultImport: \"NotificationsBell\",\n moduleSpecifier: \"#lib/components/notifications-bell.svelte\",\n },\n ]);\n });\n return out;\n });\n\n file.insertBeforeClosingTag(\"header\", BELL_SNIPPET);\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst FETCH_STATEMENT = dedent`\n const notificationsList = await locals.pb\n .collection(\"notifications\")\n .getList(1, 5, {\n filter: \\`user = \"\\${locals.pb.authStore.record!.id}\" && read = false\\`,\n sort: \"-created\",\n });\n`;\n\nconst NOTIFICATIONS_STATEMENT =\n \"const notifications = { count: notificationsList.totalItems, items: notificationsList.items };\";\n\nconst DEPENDS_STATEMENT = 'depends(\"app:notifications\");';\n\nexport function modifyLayoutServer(layoutServerPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutServerPath)) {\n const snippet = dedent`\n export const load = async ({ locals, depends }) => {\n ${FETCH_STATEMENT}\n ${NOTIFICATIONS_STATEMENT}\n ${DEPENDS_STATEMENT}\n return { notifications };\n };\n `;\n fs.writeFileSync(layoutServerPath, snippet);\n return { status: \"success\", changed: true };\n }\n\n const originalSource = fs.readFileSync(layoutServerPath, \"utf8\");\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(layoutServerPath);\n\n const addProperty = (\n obj: import(\"ts-morph\").ObjectLiteralExpression,\n name: string,\n initializer: string,\n ) => {\n if (obj.getProperty(name)) return;\n if (name === initializer) {\n obj.addShorthandPropertyAssignment({ name });\n } else {\n obj.addPropertyAssignment({ name, initializer });\n }\n };\n\n let loadArrow: import(\"ts-morph\").ArrowFunction | undefined;\n let loadFn:\n | import(\"ts-morph\").FunctionDeclaration\n | import(\"ts-morph\").FunctionExpression\n | undefined;\n\n const varDecl = sourceFile.getVariableDeclaration(\"load\");\n if (varDecl) {\n const vs = varDecl.getFirstAncestorByKind(SyntaxKind.VariableStatement);\n if (vs?.hasExportKeyword()) {\n const directArrow = varDecl.getInitializerIfKind(\n SyntaxKind.ArrowFunction,\n );\n if (directArrow) {\n loadArrow = directArrow;\n } else {\n const init = varDecl.getInitializer();\n if (init) {\n const innerArrow = init.getFirstDescendantByKind(\n SyntaxKind.ArrowFunction,\n );\n if (innerArrow) {\n loadArrow = innerArrow;\n } else {\n const innerFnExpr = init.getFirstDescendantByKind(\n SyntaxKind.FunctionExpression,\n );\n if (innerFnExpr) loadFn = innerFnExpr;\n }\n }\n }\n }\n }\n\n if (!loadArrow && !loadFn) {\n const maybeFn = sourceFile.getFunction(\"load\");\n if (maybeFn && maybeFn.isExported()) loadFn = maybeFn;\n }\n\n if (!loadArrow && !loadFn) {\n sourceFile.addFunction({\n isExported: true,\n isAsync: true,\n name: \"load\",\n parameters: [{ name: \"{ locals, depends }\" }],\n statements: [\n FETCH_STATEMENT,\n NOTIFICATIONS_STATEMENT,\n DEPENDS_STATEMENT,\n \"return { notifications };\",\n ],\n });\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n }\n\n const fnLike = (loadArrow ?? loadFn!) as\n | import(\"ts-morph\").ArrowFunction\n | import(\"ts-morph\").FunctionDeclaration\n | import(\"ts-morph\").FunctionExpression;\n\n // Ensure first param destructures { locals, depends }\n const params = fnLike.getParameters();\n if (params.length === 0) {\n fnLike.insertParameter(0, { name: \"{ locals, depends }\" });\n } else {\n const first = params[0];\n const original = first.getStructure();\n const nameNode = first.getNameNode();\n if (nameNode.getKind() === SyntaxKind.ObjectBindingPattern) {\n const obp = nameNode as import(\"ts-morph\").ObjectBindingPattern;\n const elementNames = obp.getElements().map((el) => el.getName());\n const hasDepends = elementNames.includes(\"depends\");\n const hasLocals = elementNames.includes(\"locals\");\n\n if (!hasDepends || !hasLocals) {\n const existingParts = obp\n .getElements()\n .map((el) => el.getText())\n .filter(Boolean);\n const parts: string[] = hasLocals ? [] : [\"locals\"];\n parts.push(...existingParts);\n if (!hasDepends) parts.push(\"depends\");\n first.set({\n name: `{ ${parts.join(\", \")} }`,\n type: original.type,\n initializer: (original as { initializer?: string }).initializer,\n });\n }\n } else {\n const currentName = first.getName();\n if (currentName !== \"locals\") {\n first.set({\n name: `{ locals, depends, ...${currentName} }`,\n type: original.type,\n initializer: (original as { initializer?: string }).initializer,\n });\n } else {\n first.set({\n name: `{ locals, depends }`,\n type: original.type,\n initializer: (original as { initializer?: string }).initializer,\n });\n }\n }\n }\n\n if (loadArrow && !loadArrow.isAsync()) loadArrow.setIsAsync(true);\n else if (loadFn && !loadFn.isAsync()) loadFn.setIsAsync(true);\n\n const body = fnLike.getBody();\n if (body && body.getKind() === SyntaxKind.Block) {\n const blockBody = body as import(\"ts-morph\").Block;\n const statements = blockBody.getStatements();\n\n const declaresVar = (name: string) =>\n statements.some((stmt) => {\n if (stmt.getKind() !== SyntaxKind.VariableStatement) return false;\n return (stmt as import(\"ts-morph\").VariableStatement)\n .getDeclarations()\n .some((d) => d.getName() === name);\n });\n\n const hasDependsCall = statements.some(\n (stmt) =>\n stmt.getKind() === SyntaxKind.ExpressionStatement &&\n stmt.getDescendantsOfKind(SyntaxKind.CallExpression).some((ce) => {\n if (ce.getExpression().getText() !== \"depends\") return false;\n const args = ce.getArguments();\n const argText = args[0]?.getText() ?? \"\";\n return (\n args.length === 1 &&\n (argText === \"'app:notifications'\" ||\n argText === '\"app:notifications\"')\n );\n }),\n );\n\n const hasNotificationsList = declaresVar(\"notificationsList\");\n const hasNotifications = declaresVar(\"notifications\");\n\n const returnIdx = statements.findIndex(\n (s) => s.getKind() === SyntaxKind.ReturnStatement,\n );\n let insertAt = returnIdx >= 0 ? returnIdx : statements.length;\n\n if (!hasNotificationsList) {\n blockBody.insertStatements(insertAt, FETCH_STATEMENT);\n insertAt++;\n }\n if (!hasNotifications) {\n blockBody.insertStatements(insertAt, NOTIFICATIONS_STATEMENT);\n insertAt++;\n }\n if (!hasDependsCall) {\n blockBody.insertStatements(insertAt, DEPENDS_STATEMENT);\n }\n }\n\n const augmentReturnObject = (\n obj: import(\"ts-morph\").ObjectLiteralExpression,\n ) => {\n addProperty(obj, \"notifications\", \"notifications\");\n };\n\n const augmentReturns = (target: import(\"ts-morph\").Node) => {\n const returns = target.getDescendantsOfKind(SyntaxKind.ReturnStatement);\n returns.forEach((ret) => {\n const expr = ret.getExpression();\n if (!expr) return;\n if (expr.getKind() === SyntaxKind.ObjectLiteralExpression) {\n augmentReturnObject(expr as import(\"ts-morph\").ObjectLiteralExpression);\n } else if (expr.getKind() === SyntaxKind.ParenthesizedExpression) {\n const inner = (\n expr as import(\"ts-morph\").ParenthesizedExpression\n ).getExpression();\n if (inner.getKind() === SyntaxKind.ObjectLiteralExpression) {\n augmentReturnObject(\n inner as import(\"ts-morph\").ObjectLiteralExpression,\n );\n }\n }\n });\n };\n\n if (loadArrow) {\n const arrowBody = loadArrow.getBody();\n if (arrowBody.getKind() === SyntaxKind.Block) {\n augmentReturns(arrowBody);\n } else {\n const bodyExpr = arrowBody as import(\"ts-morph\").Expression;\n if (bodyExpr.getKind() === SyntaxKind.ParenthesizedExpression) {\n const inner = (\n bodyExpr as import(\"ts-morph\").ParenthesizedExpression\n ).getExpression();\n if (inner.getKind() === SyntaxKind.ObjectLiteralExpression) {\n augmentReturnObject(\n inner as import(\"ts-morph\").ObjectLiteralExpression,\n );\n }\n } else if (bodyExpr.getKind() === SyntaxKind.ObjectLiteralExpression) {\n augmentReturnObject(\n bodyExpr as import(\"ts-morph\").ObjectLiteralExpression,\n );\n }\n }\n } else if (loadFn) {\n const fnBody = loadFn.getBody();\n if (fnBody) augmentReturns(fnBody);\n }\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\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 { languageFromPath } from \"../../../core/util\";\nimport {\n applyCollectionRulePatches,\n createCollectionIdempotent,\n} from \"../../../runtime/collections\";\nimport {\n getMigrationFile,\n migrationDelay,\n withPocketbase,\n} from \"../../../runtime/pocketbase\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyUtils } from \"../../../runtime/modify-utils\";\nimport { modifyAppLayout } from \"./modifies/modify-app-layout\";\nimport { modifyLayoutServer } from \"./modifies/+layout.server\";\nimport { NOTIFICATION_RULE_PATCHES } from \"./runtime/pocketbase\";\n\nasync function pushMigrationCreates(\n creates: File[],\n collectionName: string,\n options: Options,\n created = true,\n) {\n if (!created) return;\n await migrationDelay();\n const migrationFile = getMigrationFile(collectionName, \"created\", options);\n if (!migrationFile) return;\n creates.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: fs.readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n}\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const creates: File[] = [];\n\n await withPocketbase(options.root, async (pb) => {\n const userCollection = await pb.collections.getOne(\"users\");\n const create = (spec: Parameters<typeof createCollectionIdempotent>[1]) =>\n createCollectionIdempotent(pb, spec, logger);\n\n logger.info(\"Creating notifications collection\");\n const result = await create({\n name: \"notifications\",\n type: \"base\",\n fields: [\n {\n name: \"id\",\n type: \"text\",\n primaryKey: true,\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n required: true,\n },\n {\n name: \"user\",\n type: \"relation\",\n cascadeDelete: true,\n collectionId: userCollection.id,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n },\n {\n name: \"title\",\n type: \"text\",\n required: true,\n },\n {\n name: \"body\",\n type: \"text\",\n },\n {\n name: \"read\",\n type: \"bool\",\n },\n {\n name: \"created\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: false,\n },\n {\n name: \"updated\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: true,\n },\n ],\n indexes: [\n \"CREATE INDEX `idx_notifications_user_read_created` ON `notifications` (`user`, `read`, `created` DESC)\",\n ],\n });\n await pushMigrationCreates(\n creates,\n \"notifications\",\n options,\n result.created,\n );\n\n logger.info(\"Applying notifications rule patches\");\n const ruleMigrations = await applyCollectionRulePatches(\n pb,\n NOTIFICATION_RULE_PATCHES,\n options,\n logger,\n );\n creates.push(...ruleMigrations);\n });\n\n const modifies: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Modifying (app) +layout.svelte\");\n const appLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(appLayoutPath, modifyAppLayout(appLayoutPath)),\n );\n\n logger.info(\"Modifying (app) +layout.server.ts\");\n const appLayoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"+layout.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n appLayoutServerPath,\n modifyLayoutServer(appLayoutServerPath),\n ),\n );\n\n logger.info(\"Modifying utils.ts\");\n const utilsPath = path.join(options.root, \"src\", \"lib\", \"utils.ts\");\n pushResult(modifyOutcomeToFile(utilsPath, modifyUtils(utilsPath)));\n\n return {\n creates,\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;;;;;AASA,IAAMY,IAAe,2EAMfC,IAAiB,CAAM;;GAIvBC,IAAe;CACnB;CACA;CACA;CACA;CACAD;CACA;CACA;CACAD;AACF,CAAC,CAAC,KAAK,IAAI,GAELG,IAAiB;CACrB;CACA;CACA;CACA;CACAF;CACA;CACA;CACAD;AACF,CAAC,CAAC,KAAK,IAAI;AAEX,SAAgBI,EAAgB,GAAmC;CACjE,IAAI,CAACN,EAAG,WAAWO,CAAU,GAC3B,OAAO;EAAE,QAAQ;EAAa,SAASF;CAAe;CAGxD,IAAMG,IAAOb,EAAW,SAASY,CAAU;CAsB3C,OArBKC,EAAK,WAAW,QAAQ,IAGzBA,EAAK,WAAW,mBAAmB,IAC9B;EAAE,QAAQ;EAAW,SAAS;CAAM,KAG7CA,EAAK,cAAc,MAAW;EAC5B,IAAM,EAAE,QAAQC,MAAQjB,EAAmBkB,IAAS,MAAO;GACzD,EAAcC,GAAI,CAChB;IACE,eAAe;IACf,iBAAiB;GACnB,CACF,CAAC;EACH,CAAC;EACD,OAAOF;CACT,CAAC,GAEDD,EAAK,uBAAuB,UAAUN,CAAY,GAClDM,EAAK,QAAQD,CAAU,GAChB;EAAE,QAAQ;EAAW,SAASC,EAAK,WAAW;CAAE,KApB9C;EAAE,QAAQ;EAAU,SAASJ;CAAa;AAqBrD;;;AC/DA,IAAMQ,IAAkB,CAAM;;;;;;;GASxBC,IACJ,kGAEIC,IAAoB;AAE1B,SAAgBC,EAAmB,GAAyC;CAC1E,IAAI,CAACf,EAAG,WAAWgB,CAAgB,GAAG;EACpC,IAAMC,IAAU,CAAM;;UAEhBL,EAAgB;UAChBC,EAAwB;UACxBC,EAAkB;;;;EAKxB,OADAd,EAAG,cAAcgB,GAAkBC,CAAO,GACnC;GAAE,QAAQ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