@velastack/patterns 0.3.1 → 0.3.3

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 (156) hide show
  1. package/README.md +42 -3
  2. package/dist/chunks/_layout-B7ujvjnA.js +55 -0
  3. package/dist/chunks/_layout-B7ujvjnA.js.map +1 -0
  4. package/dist/chunks/{collections-CgdvZXmh.js → collections-CrOvS2E7.js} +3 -3
  5. package/dist/chunks/{collections-CgdvZXmh.js.map → collections-CrOvS2E7.js.map} +1 -1
  6. package/dist/chunks/{compose-handle-Cg9jnCsS.js → compose-handle-B-CkDcQD.js} +23 -23
  7. package/dist/chunks/{compose-handle-Cg9jnCsS.js.map → compose-handle-B-CkDcQD.js.map} +1 -1
  8. package/dist/chunks/config-target-Bln26FJe.js +164 -0
  9. package/dist/chunks/config-target-Bln26FJe.js.map +1 -0
  10. package/dist/chunks/{constants-DSFKQwtP.js → constants-BYkd9jeJ.js} +2 -2
  11. package/dist/chunks/constants-BYkd9jeJ.js.map +1 -0
  12. package/dist/chunks/errors-DR3gF_7a.js +18 -0
  13. package/dist/chunks/errors-DR3gF_7a.js.map +1 -0
  14. package/dist/chunks/{format-result-Cb2hWsb8.js → format-result-DZ8De8KY.js} +19 -11
  15. package/dist/chunks/format-result-DZ8De8KY.js.map +1 -0
  16. package/dist/chunks/{generate-DRA63W0r.js → generate-6snrlnpA.js} +2 -2
  17. package/dist/chunks/{generate-DRA63W0r.js.map → generate-6snrlnpA.js.map} +1 -1
  18. package/dist/chunks/{generate-iQP31-m1.js → generate-Ca_6FlPi.js} +5 -5
  19. package/dist/chunks/{generate-iQP31-m1.js.map → generate-Ca_6FlPi.js.map} +1 -1
  20. package/dist/chunks/{generate-tOkjJFUf.js → generate-CyuY2Ci7.js} +4 -3
  21. package/dist/chunks/generate-CyuY2Ci7.js.map +1 -0
  22. package/dist/chunks/{generate-BkQ1xMDp.js → generate-DQeWOEPY.js} +4 -4
  23. package/dist/chunks/{generate-BkQ1xMDp.js.map → generate-DQeWOEPY.js.map} +1 -1
  24. package/dist/chunks/{generate-_LvrYK6i.js → generate-DwADTUob.js} +4 -4
  25. package/dist/chunks/{generate-_LvrYK6i.js.map → generate-DwADTUob.js.map} +1 -1
  26. package/dist/chunks/{generate.runtime-BbIN0tUZ.js → generate.runtime-4FDxnvCl.js} +67 -66
  27. package/dist/chunks/generate.runtime-4FDxnvCl.js.map +1 -0
  28. package/dist/chunks/{generate.runtime-B0hhtyAL.js → generate.runtime-AYQVW1S-.js} +27 -26
  29. package/dist/chunks/generate.runtime-AYQVW1S-.js.map +1 -0
  30. package/dist/chunks/{generate.runtime-wA1G3tQ4.js → generate.runtime-B2aFFaac.js} +38 -37
  31. package/dist/chunks/generate.runtime-B2aFFaac.js.map +1 -0
  32. package/dist/chunks/{generate.runtime-DhkaXTq3.js → generate.runtime-B45MvtYm.js} +61 -59
  33. package/dist/chunks/generate.runtime-B45MvtYm.js.map +1 -0
  34. package/dist/chunks/{generate.runtime-S5RIgbQx.js → generate.runtime-BFOXm2DD.js} +98 -92
  35. package/dist/chunks/generate.runtime-BFOXm2DD.js.map +1 -0
  36. package/dist/chunks/{generate.runtime-BnWE4qsu.js → generate.runtime-BHkFmI2Y.js} +55 -54
  37. package/dist/chunks/generate.runtime-BHkFmI2Y.js.map +1 -0
  38. package/dist/chunks/{generate.runtime-DNaQxed-.js → generate.runtime-BKiJvE8I.js} +84 -83
  39. package/dist/chunks/generate.runtime-BKiJvE8I.js.map +1 -0
  40. package/dist/chunks/{generate.runtime-DoZdSh9W.js → generate.runtime-BSRFv4cJ.js} +58 -57
  41. package/dist/chunks/generate.runtime-BSRFv4cJ.js.map +1 -0
  42. package/dist/chunks/{generate.runtime-B49wetSx.js → generate.runtime-BUqsF3AF.js} +43 -42
  43. package/dist/chunks/generate.runtime-BUqsF3AF.js.map +1 -0
  44. package/dist/chunks/{generate.runtime-acRmiU7e.js → generate.runtime-BsaSyTnU.js} +9 -8
  45. package/dist/chunks/{generate.runtime-acRmiU7e.js.map → generate.runtime-BsaSyTnU.js.map} +1 -1
  46. package/dist/chunks/generate.runtime-CMnvmeVt.js +111 -0
  47. package/dist/chunks/generate.runtime-CMnvmeVt.js.map +1 -0
  48. package/dist/chunks/{generate.runtime-BORbegw_.js → generate.runtime-CN5c2xH8.js} +123 -122
  49. package/dist/chunks/generate.runtime-CN5c2xH8.js.map +1 -0
  50. package/dist/chunks/{generate.runtime-flFRYzpi.js → generate.runtime-CgoSrP55.js} +62 -61
  51. package/dist/chunks/generate.runtime-CgoSrP55.js.map +1 -0
  52. package/dist/chunks/{generate.runtime-D0icLb5j.js → generate.runtime-D1DNAY6k.js} +12 -11
  53. package/dist/chunks/{generate.runtime-D0icLb5j.js.map → generate.runtime-D1DNAY6k.js.map} +1 -1
  54. package/dist/chunks/generate.runtime-DG-3G00z.js +87 -0
  55. package/dist/chunks/generate.runtime-DG-3G00z.js.map +1 -0
  56. package/dist/chunks/{generate.runtime-BKo-Nidn.js → generate.runtime-DQwSY6Nc.js} +6 -6
  57. package/dist/chunks/{generate.runtime-BKo-Nidn.js.map → generate.runtime-DQwSY6Nc.js.map} +1 -1
  58. package/dist/chunks/{generate.runtime-DSqkXvps.js → generate.runtime-D_yqWLcI.js} +15 -14
  59. package/dist/chunks/{generate.runtime-DSqkXvps.js.map → generate.runtime-D_yqWLcI.js.map} +1 -1
  60. package/dist/chunks/generate.runtime-Drmahmdl.js +313 -0
  61. package/dist/chunks/generate.runtime-Drmahmdl.js.map +1 -0
  62. package/dist/chunks/{generate.runtime-D8vgh5MH.js → generate.runtime-FdZw277n.js} +156 -76
  63. package/dist/chunks/generate.runtime-FdZw277n.js.map +1 -0
  64. package/dist/chunks/generate.runtime-Lh1cW9Tz.js +94 -0
  65. package/dist/chunks/generate.runtime-Lh1cW9Tz.js.map +1 -0
  66. package/dist/chunks/{generate.runtime-DAmYsIvF.js → generate.runtime-QGHToXRY.js} +5 -5
  67. package/dist/chunks/{generate.runtime-DAmYsIvF.js.map → generate.runtime-QGHToXRY.js.map} +1 -1
  68. package/dist/chunks/{generate.runtime-CRYjWJRe.js → generate.runtime-Um77JfwC.js} +89 -88
  69. package/dist/chunks/generate.runtime-Um77JfwC.js.map +1 -0
  70. package/dist/chunks/{generate.runtime-BwhGDnGu.js → generate.runtime-VgVwRiiN.js} +151 -150
  71. package/dist/chunks/generate.runtime-VgVwRiiN.js.map +1 -0
  72. package/dist/chunks/{generate.runtime-CcuAXuV2.js → generate.runtime-YyIVd4oy.js} +15 -14
  73. package/dist/chunks/{generate.runtime-CcuAXuV2.js.map → generate.runtime-YyIVd4oy.js.map} +1 -1
  74. package/dist/chunks/{generate.runtime-DOuufRLr.js → generate.runtime-cQGLxuZM.js} +82 -81
  75. package/dist/chunks/generate.runtime-cQGLxuZM.js.map +1 -0
  76. package/dist/chunks/generate.runtime-n9AFWtPp.js +94 -0
  77. package/dist/chunks/generate.runtime-n9AFWtPp.js.map +1 -0
  78. package/dist/chunks/generate.runtime-ofdnLtxS.js +57 -0
  79. package/dist/chunks/generate.runtime-ofdnLtxS.js.map +1 -0
  80. package/dist/chunks/generate.runtime-onBnOiS7.js +328 -0
  81. package/dist/chunks/generate.runtime-onBnOiS7.js.map +1 -0
  82. package/dist/chunks/modify-file-Dwfv0dCI.js +46 -0
  83. package/dist/chunks/modify-file-Dwfv0dCI.js.map +1 -0
  84. package/dist/chunks/{modify-svelte-config-remote-CDKs_Qi0.js → modify-svelte-config-remote-BUU_EaDf.js} +2 -2
  85. package/dist/chunks/{modify-svelte-config-remote-CDKs_Qi0.js.map → modify-svelte-config-remote-BUU_EaDf.js.map} +1 -1
  86. package/dist/chunks/{pocketbase-CeG5BMN2.js → pocketbase-BkhUywtb.js} +2 -2
  87. package/dist/chunks/{pocketbase-CeG5BMN2.js.map → pocketbase-BkhUywtb.js.map} +1 -1
  88. package/dist/chunks/{providers-DO9kMyzB.js → providers-BL9vJP_9.js} +2 -2
  89. package/dist/chunks/{providers-DO9kMyzB.js.map → providers-BL9vJP_9.js.map} +1 -1
  90. package/dist/chunks/{shared-BwHQM-a9.js → shared-C8GtNxpm.js} +2 -2
  91. package/dist/chunks/{shared-BwHQM-a9.js.map → shared-C8GtNxpm.js.map} +1 -1
  92. package/dist/chunks/{site-D027dpBm.js → site-BdMX8qrH.js} +2 -2
  93. package/dist/chunks/{site-D027dpBm.js.map → site-BdMX8qrH.js.map} +1 -1
  94. package/dist/chunks/table-core-G9Shld4F.js +126 -0
  95. package/dist/chunks/table-core-G9Shld4F.js.map +1 -0
  96. package/dist/chunks/{test-setup-B2hd8I-s.js → test-setup-DHEFKEHE.js} +23 -10
  97. package/dist/chunks/test-setup-DHEFKEHE.js.map +1 -0
  98. package/dist/chunks/ts-morph-helpers-CeduA--o.js +253 -0
  99. package/dist/chunks/ts-morph-helpers-CeduA--o.js.map +1 -0
  100. package/dist/chunks/{ui-jhXrsw4T.js → ui-DD4NltyN.js} +2 -2
  101. package/dist/chunks/{ui-jhXrsw4T.js.map → ui-DD4NltyN.js.map} +1 -1
  102. package/dist/chunks/{ui-B4Tuit-7.js → ui-TlEuI2Sz.js} +50 -49
  103. package/dist/chunks/{ui-B4Tuit-7.js.map → ui-TlEuI2Sz.js.map} +1 -1
  104. package/dist/chunks/unmodify-load-jfdcVZ_a.js +81 -0
  105. package/dist/chunks/unmodify-load-jfdcVZ_a.js.map +1 -0
  106. package/dist/chunks/write-result-Djy0SZXX.js +376 -0
  107. package/dist/chunks/write-result-Djy0SZXX.js.map +1 -0
  108. package/dist/index.d.ts +33 -1
  109. package/dist/index.js +2240 -2020
  110. package/dist/index.js.map +1 -1
  111. package/package.json +2 -2
  112. package/dist/chunks/_layout-DqH4lA_r.js +0 -47
  113. package/dist/chunks/_layout-DqH4lA_r.js.map +0 -1
  114. package/dist/chunks/config-target-Co-ij8p3.js +0 -163
  115. package/dist/chunks/config-target-Co-ij8p3.js.map +0 -1
  116. package/dist/chunks/constants-DSFKQwtP.js.map +0 -1
  117. package/dist/chunks/errors-D6gyegUK.js +0 -14
  118. package/dist/chunks/errors-D6gyegUK.js.map +0 -1
  119. package/dist/chunks/format-result-Cb2hWsb8.js.map +0 -1
  120. package/dist/chunks/generate-tOkjJFUf.js.map +0 -1
  121. package/dist/chunks/generate.runtime-B0hhtyAL.js.map +0 -1
  122. package/dist/chunks/generate.runtime-B49wetSx.js.map +0 -1
  123. package/dist/chunks/generate.runtime-B7LRx-BU.js +0 -86
  124. package/dist/chunks/generate.runtime-B7LRx-BU.js.map +0 -1
  125. package/dist/chunks/generate.runtime-BORbegw_.js.map +0 -1
  126. package/dist/chunks/generate.runtime-BbIN0tUZ.js.map +0 -1
  127. package/dist/chunks/generate.runtime-BnWE4qsu.js.map +0 -1
  128. package/dist/chunks/generate.runtime-BwhGDnGu.js.map +0 -1
  129. package/dist/chunks/generate.runtime-CCg2Pjcv.js +0 -257
  130. package/dist/chunks/generate.runtime-CCg2Pjcv.js.map +0 -1
  131. package/dist/chunks/generate.runtime-CRYjWJRe.js.map +0 -1
  132. package/dist/chunks/generate.runtime-D2e_KRj0.js +0 -56
  133. package/dist/chunks/generate.runtime-D2e_KRj0.js.map +0 -1
  134. package/dist/chunks/generate.runtime-D44gjxRA.js +0 -332
  135. package/dist/chunks/generate.runtime-D44gjxRA.js.map +0 -1
  136. package/dist/chunks/generate.runtime-D8vgh5MH.js.map +0 -1
  137. package/dist/chunks/generate.runtime-DNaQxed-.js.map +0 -1
  138. package/dist/chunks/generate.runtime-DOuufRLr.js.map +0 -1
  139. package/dist/chunks/generate.runtime-DhkaXTq3.js.map +0 -1
  140. package/dist/chunks/generate.runtime-DoZdSh9W.js.map +0 -1
  141. package/dist/chunks/generate.runtime-S5RIgbQx.js.map +0 -1
  142. package/dist/chunks/generate.runtime-WmSMWL15.js +0 -82
  143. package/dist/chunks/generate.runtime-WmSMWL15.js.map +0 -1
  144. package/dist/chunks/generate.runtime-flFRYzpi.js.map +0 -1
  145. package/dist/chunks/generate.runtime-gtpOuLNO.js +0 -110
  146. package/dist/chunks/generate.runtime-gtpOuLNO.js.map +0 -1
  147. package/dist/chunks/generate.runtime-kLxeDGnS.js +0 -93
  148. package/dist/chunks/generate.runtime-kLxeDGnS.js.map +0 -1
  149. package/dist/chunks/generate.runtime-wA1G3tQ4.js.map +0 -1
  150. package/dist/chunks/modify-file-GQD6uNgI.js +0 -254
  151. package/dist/chunks/modify-file-GQD6uNgI.js.map +0 -1
  152. package/dist/chunks/test-setup-B2hd8I-s.js.map +0 -1
  153. package/dist/chunks/unmodify-load-W1ePZQHr.js +0 -80
  154. package/dist/chunks/unmodify-load-W1ePZQHr.js.map +0 -1
  155. package/dist/chunks/write-result-DewHCNhM.js +0 -451
  156. package/dist/chunks/write-result-DewHCNhM.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"generate-_LvrYK6i.js","names":[],"sources":["../../src/patterns/disable/ai/generate.ts"],"sourcesContent":["import type { Options, Result } from \"../../../core/types\";\nimport type { EnvEdit } from \"../../../runtime/env\";\nimport { allProviderPaths } from \"../../../core/providers\";\nimport { appRelativePath } from \"../../../core/util\";\nimport { toDeleteEntry } from \"../../destroy/shared\";\nimport {\n DEMO_DIR,\n demoDir,\n envEditsFor,\n PACKAGES,\n PROVIDER_PACKAGES,\n PROVIDERS,\n} from \"../../enable/ai/generate\";\n\nconst createsRaw = import.meta.glob<string>(\"../../enable/ai/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst createsAppModeRaw = import.meta.glob<string>(\n \"../../enable/ai/creates-app-mode/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst providersRaw = import.meta.glob<string>(\"../../enable/ai/providers/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\ntype DemoOptions = Pick<Options, \"features\" | \"routeGroups\">;\n\n/**\n * Where enable-ai may have put the demo page in this project: the group it\n * picks with auth on and with it off. Auth enabled after AI leaves the page\n * in the public group, so both are candidates.\n */\nexport function demoDirs(options: DemoOptions): string[] {\n const dirs = [false, true].map((auth) =>\n demoDir({ ...options, features: { ...options.features, auth } }),\n );\n return [...new Set(dirs)];\n}\n\n/** A path enable-ai writes, with the stored demo directory moved to `dir`. */\nfunction atDemoDir(path: string, dir: string): string {\n return path.startsWith(DEMO_DIR)\n ? `${dir}/${path.slice(DEMO_DIR.length)}`\n : path;\n}\n\n/**\n * Every path enable-ai writes for this project: the model module, the\n * endpoint and its test, and the demo page in its current default group.\n * `generate.runtime.ts` adds the page in the other group when it exists.\n */\nexport function aiPaths(options: DemoOptions): string[] {\n const dir = demoDir(options);\n const paths = new Set<string>(allProviderPaths(providersRaw));\n for (const [raw, prefix] of [\n [createsRaw, \"../../enable/ai/creates/\"],\n [createsAppModeRaw, \"../../enable/ai/creates-app-mode/\"],\n ] as const) {\n for (const key of Object.keys(raw)) {\n paths.add(atDemoDir(appRelativePath(key, prefix), dir));\n }\n }\n return [...paths].sort();\n}\n\n/**\n * The `.env` lines every provider writes. Which provider was chosen is not\n * recorded, so all are removed; keys that are not there are skipped.\n */\nexport function allEnvEdits(): EnvEdit[] {\n return PROVIDERS.flatMap((provider) => envEditsFor(provider));\n}\n\nexport async function generate(options: Options) {\n return {\n creates: [],\n modifies: [],\n // Missing ones are skipped, and emptied directories (api/chat, ai) go too.\n deletes: aiPaths(options).map(toDeleteEntry),\n components: [],\n packages: [],\n // zod and the shadcn button/textarea stay: other code uses them.\n uninstalls: [...PACKAGES, ...Object.values(PROVIDER_PACKAGES).flat()],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;AAcA,IAAM,IAAa,uBAAA,OAAA;CAAA,+DAAA;CAAA,0DAAA;CAAA,8DAAA;AAIlB,CAAA,GAEK,IAAoB,uBAAA,OAAA;CAAA,mEAAA;CAAA,uEAAA;AAG1B,CAAA,GAEM,IAAe,uBAAA,OAAA;CAAA,4DAAA;CAAA,0DAAA;CAAA,yDAAA;AAIpB,CAAA;AASD,SAAgB,EAAS,GAAgC;CACvD,IAAM,IAAO,CAAC,IAAO,EAAI,CAAC,CAAC,KAAK,MAC9B,EAAQ;EAAE,GAAG;EAAS,UAAU;GAAE,GAAG,EAAQ;GAAU;EAAK;CAAE,CAAC,CACjE;CACA,OAAO,CAAC,GAAG,IAAI,IAAI,CAAI,CAAC;AAC1B;AAGA,SAAS,EAAU,GAAc,GAAqB;CACpD,OAAO,EAAK,WAAA,yBAAmB,IAC3B,GAAG,EAAI,GAAG,EAAK,MAAM,EAAS,MAAM,MACpC;AACN;AAOA,SAAgB,EAAQ,GAAgC;CACtD,IAAM,IAAM,EAAQ,CAAO,GACrB,IAAQ,IAAI,IAAY,EAAiB,CAAY,CAAC;CAC5D,KAAK,IAAM,CAAC,GAAK,MAAW,CAC1B,CAAC,GAAY,0BAA0B,GACvC,CAAC,GAAmB,mCAAmC,CACzD,GACE,KAAK,IAAM,KAAO,OAAO,KAAK,CAAG,GAC/B,EAAM,IAAI,EAAU,EAAgB,GAAK,CAAM,GAAG,CAAG,CAAC;CAG1D,OAAO,CAAC,GAAG,CAAK,CAAC,CAAC,KAAK;AACzB;AAMA,SAAgB,IAAyB;CACvC,OAAO,EAAU,SAAS,MAAa,EAAY,CAAQ,CAAC;AAC9D;AAEA,eAAsB,EAAS,GAAkB;CAC/C,OAAO;EACL,SAAS,CAAC;EACV,UAAU,CAAC;EAEX,SAAS,EAAQ,CAAO,CAAC,CAAC,IAAI,CAAa;EAC3C,YAAY,CAAC;EACb,UAAU,CAAC;EAEX,YAAY,CAAC,GAAG,GAAU,GAAG,OAAO,OAAO,CAAiB,CAAC,CAAC,KAAK,CAAC;EACpE,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
1
+ {"version":3,"file":"generate-DwADTUob.js","names":[],"sources":["../../src/patterns/disable/ai/generate.ts"],"sourcesContent":["import type { Options, Result } from \"../../../core/types\";\nimport type { EnvEdit } from \"../../../runtime/env\";\nimport { allProviderPaths } from \"../../../core/providers\";\nimport { appRelativePath } from \"../../../core/util\";\nimport { toDeleteEntry } from \"../../destroy/shared\";\nimport {\n DEMO_DIR,\n demoDir,\n envEditsFor,\n PACKAGES,\n PROVIDER_PACKAGES,\n PROVIDERS,\n} from \"../../enable/ai/generate\";\n\nconst createsRaw = import.meta.glob<string>(\"../../enable/ai/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst createsAppModeRaw = import.meta.glob<string>(\n \"../../enable/ai/creates-app-mode/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst providersRaw = import.meta.glob<string>(\"../../enable/ai/providers/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\ntype DemoOptions = Pick<Options, \"features\" | \"routeGroups\">;\n\n/**\n * Where enable-ai may have put the demo page in this project: the group it\n * picks with auth on and with it off. Auth enabled after AI leaves the page\n * in the public group, so both are candidates.\n */\nexport function demoDirs(options: DemoOptions): string[] {\n const dirs = [false, true].map((auth) =>\n demoDir({ ...options, features: { ...options.features, auth } }),\n );\n return [...new Set(dirs)];\n}\n\n/** A path enable-ai writes, with the stored demo directory moved to `dir`. */\nfunction atDemoDir(path: string, dir: string): string {\n return path.startsWith(DEMO_DIR)\n ? `${dir}/${path.slice(DEMO_DIR.length)}`\n : path;\n}\n\n/**\n * Every path enable-ai writes for this project: the model module, the\n * endpoint and its test, and the demo page in its current default group.\n * `generate.runtime.ts` adds the page in the other group when it exists.\n */\nexport function aiPaths(options: DemoOptions): string[] {\n const dir = demoDir(options);\n const paths = new Set<string>(allProviderPaths(providersRaw));\n for (const [raw, prefix] of [\n [createsRaw, \"../../enable/ai/creates/\"],\n [createsAppModeRaw, \"../../enable/ai/creates-app-mode/\"],\n ] as const) {\n for (const key of Object.keys(raw)) {\n paths.add(atDemoDir(appRelativePath(key, prefix), dir));\n }\n }\n return [...paths].sort();\n}\n\n/**\n * The `.env` lines every provider writes. Which provider was chosen is not\n * recorded, so all are removed; keys that are not there are skipped.\n */\nexport function allEnvEdits(): EnvEdit[] {\n return PROVIDERS.flatMap((provider) => envEditsFor(provider));\n}\n\nexport async function generate(options: Options) {\n return {\n creates: [],\n modifies: [],\n // Missing ones are skipped, and emptied directories (api/chat, ai) go too.\n deletes: aiPaths(options).map(toDeleteEntry),\n components: [],\n packages: [],\n // zod and the shadcn button/textarea stay: other code uses them.\n uninstalls: [...PACKAGES, ...Object.values(PROVIDER_PACKAGES).flat()],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;AAcA,IAAM,IAAa,uBAAA,OAAA;CAAA,+DAAA;CAAA,0DAAA;CAAA,8DAAA;AAIlB,CAAA,GAEK,IAAoB,uBAAA,OAAA;CAAA,mEAAA;CAAA,uEAAA;AAG1B,CAAA,GAEM,IAAe,uBAAA,OAAA;CAAA,4DAAA;CAAA,0DAAA;CAAA,yDAAA;AAIpB,CAAA;AASD,SAAgB,EAAS,GAAgC;CACvD,IAAM,IAAO,CAAC,IAAO,EAAI,CAAC,CAAC,KAAK,MAC9B,EAAQ;EAAE,GAAG;EAAS,UAAU;GAAE,GAAG,EAAQ;GAAU;EAAK;CAAE,CAAC,CACjE;CACA,OAAO,CAAC,GAAG,IAAI,IAAI,CAAI,CAAC;AAC1B;AAGA,SAAS,EAAU,GAAc,GAAqB;CACpD,OAAO,EAAK,WAAA,yBAAmB,IAC3B,GAAG,EAAI,GAAG,EAAK,MAAM,EAAS,MAAM,MACpC;AACN;AAOA,SAAgB,EAAQ,GAAgC;CACtD,IAAM,IAAM,EAAQ,CAAO,GACrB,IAAQ,IAAI,IAAY,EAAiB,CAAY,CAAC;CAC5D,KAAK,IAAM,CAAC,GAAK,MAAW,CAC1B,CAAC,GAAY,0BAA0B,GACvC,CAAC,GAAmB,mCAAmC,CACzD,GACE,KAAK,IAAM,KAAO,OAAO,KAAK,CAAG,GAC/B,EAAM,IAAI,EAAU,EAAgB,GAAK,CAAM,GAAG,CAAG,CAAC;CAG1D,OAAO,CAAC,GAAG,CAAK,CAAC,CAAC,KAAK;AACzB;AAMA,SAAgB,IAAyB;CACvC,OAAO,EAAU,SAAS,MAAa,EAAY,CAAQ,CAAC;AAC9D;AAEA,eAAsB,EAAS,GAAkB;CAC/C,OAAO;EACL,SAAS,CAAC;EACV,UAAU,CAAC;EAEX,SAAS,EAAQ,CAAO,CAAC,CAAC,IAAI,CAAa;EAC3C,YAAY,CAAC;EACb,UAAU,CAAC;EAEX,YAAY,CAAC,GAAG,GAAU,GAAG,OAAO,OAAO,CAAiB,CAAC,CAAC,KAAK,CAAC;EACpE,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
@@ -1,56 +1,57 @@
1
1
  import { t as e } from "./dedent-Gq6Krl4n.js";
2
2
  import { n as t } from "./logger-CQONztPm.js";
3
3
  import { n, r, t as i } from "./nav-user-BYI-h8Od.js";
4
- import { t as a } from "./shared-BwHQM-a9.js";
5
- import { c as o, h as s, modifyOutcomeToFile as c } from "./modify-file-GQD6uNgI.js";
6
- import { t as l } from "./svelte-file-B3RfgVdt.js";
7
- import u from "node:fs";
8
- import d from "node:path";
9
- import { SyntaxKind as f } from "ts-morph";
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";
7
+ import { t as u } from "./svelte-file-B3RfgVdt.js";
8
+ import d from "node:fs";
9
+ import f from "node:path";
10
+ import { SyntaxKind as p } from "ts-morph";
10
11
  //#region src/patterns/disable/subscriptions/modifies/modify-webhook-server.ts
11
- var p = /* @__PURE__ */ new Set([
12
+ var m = /* @__PURE__ */ new Set([
12
13
  "customer.subscription.created",
13
14
  "customer.subscription.updated",
14
15
  "customer.subscription.deleted"
15
16
  ]);
16
- function m(e) {
17
- if (!u.existsSync(e)) return {
17
+ function h(e) {
18
+ if (!d.existsSync(e)) return {
18
19
  status: "success",
19
20
  changed: !1
20
21
  };
21
- let t = u.readFileSync(e, "utf8");
22
+ let t = d.readFileSync(e, "utf8");
22
23
  if (!t.includes("handleSubscriptionCreated")) return {
23
24
  status: "success",
24
25
  changed: !1
25
26
  };
26
- let { source: n } = s(t, (e) => {
27
- o(e, "./subscription/created"), o(e, "./subscription/updated"), o(e, "./subscription/deleted");
28
- let t = e.getDescendantsOfKind(f.SwitchStatement).find((e) => e.getExpression().getText().includes("event.type"));
27
+ let { source: n } = o(t, (e) => {
28
+ c(e, "./subscription/created"), c(e, "./subscription/updated"), c(e, "./subscription/deleted");
29
+ let t = e.getDescendantsOfKind(p.SwitchStatement).find((e) => e.getExpression().getText().includes("event.type"));
29
30
  if (!t) return;
30
31
  let n = t.getCaseBlock().getClauses().filter((e) => {
31
- if (e.getKind() !== f.CaseClause) return !1;
32
- let t = e.asKindOrThrow(f.CaseClause).getExpression(), n = t.asKind(f.StringLiteral) ?? t.asKind(f.NoSubstitutionTemplateLiteral);
33
- return n ? p.has(n.getLiteralValue()) : !1;
34
- }).map((e) => e.asKindOrThrow(f.CaseClause));
32
+ if (e.getKind() !== p.CaseClause) return !1;
33
+ let t = e.asKindOrThrow(p.CaseClause).getExpression(), n = t.asKind(p.StringLiteral) ?? t.asKind(p.NoSubstitutionTemplateLiteral);
34
+ return n ? m.has(n.getLiteralValue()) : !1;
35
+ }).map((e) => e.asKindOrThrow(p.CaseClause));
35
36
  for (let e of n.reverse()) e.remove();
36
- e.formatText();
37
+ s(e);
37
38
  }), r = n.replace(/(break;)\n(\s*default:)/, "$1\n\n$2");
38
39
  return r === t ? {
39
40
  status: "success",
40
41
  changed: !1
41
- } : (u.writeFileSync(e, r, "utf8"), {
42
+ } : (d.writeFileSync(e, r, "utf8"), {
42
43
  status: "success",
43
44
  changed: !0
44
45
  });
45
46
  }
46
47
  //#endregion
47
48
  //#region src/patterns/disable/subscriptions/modifies/modify-app-layout-svelte.ts
48
- function h(e) {
49
- if (!u.existsSync(e)) return {
49
+ function g(e) {
50
+ if (!d.existsSync(e)) return {
50
51
  status: "success",
51
52
  changed: !1
52
53
  };
53
- let t = l.fromPath(e);
54
+ let t = u.fromPath(e);
54
55
  return !t.hasElement("AppSidebar") || !t.hasAttribute("AppSidebar", "subscription") || !t.removeAttribute("AppSidebar", "subscription") ? {
55
56
  status: "success",
56
57
  changed: !1
@@ -61,19 +62,19 @@ function h(e) {
61
62
  }
62
63
  //#endregion
63
64
  //#region src/patterns/disable/subscriptions/modifies/modify-app-sidebar.ts
64
- function g(e) {
65
- let { source: t } = s(e, (e) => {
65
+ function _(e) {
66
+ let { source: t } = o(e, (e) => {
66
67
  for (let t of e.getVariableDeclarations()) {
67
68
  let e = t.getInitializer();
68
69
  if (!e || e.getText() !== "$props()") continue;
69
70
  let n = t.getNameNode();
70
- if (n.getKind() !== f.ObjectBindingPattern) continue;
71
- let r = n.asKindOrThrow(f.ObjectBindingPattern), i = r.getElements(), a = i.some((e) => e.getName() === "subscription"), o = t.getTypeNode();
72
- if (o?.getKind() === f.IntersectionType) {
73
- let e = o.asKindOrThrow(f.IntersectionType);
71
+ if (n.getKind() !== p.ObjectBindingPattern) continue;
72
+ let r = n.asKindOrThrow(p.ObjectBindingPattern), i = r.getElements(), a = i.some((e) => e.getName() === "subscription"), o = t.getTypeNode();
73
+ if (o?.getKind() === p.IntersectionType) {
74
+ let e = o.asKindOrThrow(p.IntersectionType);
74
75
  for (let t of e.getTypeNodes()) {
75
- if (t.getKind() !== f.TypeLiteral) continue;
76
- let e = t.asKindOrThrow(f.TypeLiteral), n = e.getProperties().map((e) => e.getText().replace(/[;,]\s*$/, "")).filter((e) => !/^\s*subscription\??\s*:/.test(e));
76
+ if (t.getKind() !== p.TypeLiteral) continue;
77
+ let e = t.asKindOrThrow(p.TypeLiteral), n = e.getProperties().map((e) => e.getText().replace(/[;,]\s*$/, "")).filter((e) => !/^\s*subscription\??\s*:/.test(e));
77
78
  e.replaceWithText(n.length ? `{ ${n.join("; ")}; }` : "{}");
78
79
  break;
79
80
  }
@@ -83,32 +84,32 @@ function g(e) {
83
84
  r.replaceWithText(`{ ${e.join(", ")} }`);
84
85
  }
85
86
  }
86
- e.formatText();
87
+ s(e);
87
88
  });
88
89
  return t;
89
90
  }
90
- function _(e) {
91
- if (!u.existsSync(e)) return {
91
+ function v(e) {
92
+ if (!d.existsSync(e)) return {
92
93
  status: "success",
93
94
  changed: !1
94
95
  };
95
- let t = u.readFileSync(e, "utf8"), n = /subscription\??\s*:\s*\{/.test(t), r = /\bsubscription\s*=\s*null\b/.test(t), i = new l(t), a = i.hasElement("NavUser") && i.hasAttribute("NavUser", "subscription");
96
+ let t = d.readFileSync(e, "utf8"), n = /subscription\??\s*:\s*\{/.test(t), r = /\bsubscription\s*=\s*null\b/.test(t), i = new u(t), a = i.hasElement("NavUser") && i.hasAttribute("NavUser", "subscription");
96
97
  return !n && !r && !a ? {
97
98
  status: "success",
98
99
  changed: !1
99
- } : ((n || r) && i.modifyScript(g), a && i.removeAttribute("NavUser", "subscription"), i.writeTo(e), {
100
+ } : ((n || r) && i.modifyScript(_), a && i.removeAttribute("NavUser", "subscription"), i.writeTo(e), {
100
101
  status: "success",
101
102
  changed: i.hasChanged()
102
103
  });
103
104
  }
104
105
  //#endregion
105
106
  //#region src/patterns/disable/subscriptions/modifies/revert-by-template.ts
106
- function v(e, t, n) {
107
- if (!u.existsSync(e)) return {
107
+ function y(e, t, n) {
108
+ if (!d.existsSync(e)) return {
108
109
  status: "success",
109
110
  changed: !1
110
111
  };
111
- let r = u.readFileSync(e, "utf8");
112
+ let r = d.readFileSync(e, "utf8");
112
113
  if (!r.includes(n)) return {
113
114
  status: "success",
114
115
  changed: !1
@@ -117,14 +118,14 @@ function v(e, t, n) {
117
118
  return r === i ? {
118
119
  status: "success",
119
120
  changed: !1
120
- } : (u.writeFileSync(e, i, "utf8"), {
121
+ } : (d.writeFileSync(e, i, "utf8"), {
121
122
  status: "success",
122
123
  changed: !0
123
124
  });
124
125
  }
125
126
  //#endregion
126
127
  //#region src/patterns/disable/subscriptions/modifies/modify-app-layout-server.ts
127
- var y = e`
128
+ var b = e`
128
129
  export const load = ({ locals }) => {
129
130
  \tconst user = locals.pb.authStore.record!;
130
131
  \tconst breadcrumbs = [{ title: 'Home', url: '/dashboard' }];
@@ -132,45 +133,45 @@ var y = e`
132
133
  \treturn { user, breadcrumbs };
133
134
  };
134
135
  ` + "\n";
135
- function b(e) {
136
- return v(e, y, "loadActiveSubscription");
136
+ function x(e) {
137
+ return y(e, b, "loadActiveSubscription");
137
138
  }
138
139
  //#endregion
139
140
  //#region src/patterns/disable/subscriptions/modifies/modify-nav-user.ts
140
- function x(e, t) {
141
- return v(e, t, "planLabel");
141
+ function S(e, t) {
142
+ return y(e, t, "planLabel");
142
143
  }
143
144
  //#endregion
144
145
  //#region src/patterns/disable/subscriptions/modifies/modify-billing-page-server.ts
145
- function S(e, t) {
146
- return v(e, t, "selectPlan");
146
+ function C(e, t) {
147
+ return y(e, t, "selectPlan");
147
148
  }
148
149
  //#endregion
149
150
  //#region src/patterns/disable/subscriptions/modifies/modify-billing-page-svelte.ts
150
- function C(e, t) {
151
- return v(e, t, "availablePlans");
151
+ function w(e, t) {
152
+ return y(e, t, "availablePlans");
152
153
  }
153
154
  //#endregion
154
155
  //#region src/patterns/disable/subscriptions/generate.runtime.ts
155
- async function w(e) {
156
- let o = t(e), s = [], l = (e) => {
156
+ async function T(e) {
157
+ let o = t(e), s = [], c = (e) => {
157
158
  e && s.push(e);
158
159
  };
159
160
  o.info("Reverting webhooks/stripe/handlers/dispatch.ts");
160
- let u = d.join(e.root, "src", "routes", "webhooks", "stripe", "handlers", "dispatch.ts");
161
- l(c(u, m(u))), o.info("Reverting (app)/+layout.server.ts");
162
- let f = d.join(e.root, "src", "routes", "(app)", "+layout.server.ts");
163
- l(c(f, b(f))), o.info("Reverting (app)/+layout.svelte");
164
- let p = d.join(e.root, "src", "routes", "(app)", "+layout.svelte");
165
- l(c(p, h(p))), o.info("Reverting app-sidebar.svelte");
166
- let g = d.join(e.root, "src", "lib", "components", "app-sidebar.svelte");
167
- l(c(g, _(g))), o.info("Reverting nav-user.svelte");
168
- let v = d.join(e.root, "src", "lib", "components", "nav-user.svelte");
169
- l(c(v, x(v, i))), o.info("Reverting billing/+page.server.ts");
170
- let y = d.join(e.root, "src", "routes", "(app)", "billing", "+page.server.ts");
171
- l(c(y, S(y, r))), o.info("Reverting billing/+page.svelte");
172
- let w = d.join(e.root, "src", "routes", "(app)", "billing", "+page.svelte");
173
- return l(c(w, C(w, n))), {
161
+ let u = f.join(e.root, "src", "routes", "webhooks", "stripe", "handlers", "dispatch.ts");
162
+ c(l(u, h(u))), o.info("Reverting (app)/+layout.server.ts");
163
+ let d = f.join(e.root, "src", "routes", "(app)", "+layout.server.ts");
164
+ c(l(d, x(d))), o.info("Reverting (app)/+layout.svelte");
165
+ let p = f.join(e.root, "src", "routes", "(app)", "+layout.svelte");
166
+ c(l(p, g(p))), o.info("Reverting app-sidebar.svelte");
167
+ let m = f.join(e.root, "src", "lib", "components", "app-sidebar.svelte");
168
+ c(l(m, v(m))), o.info("Reverting nav-user.svelte");
169
+ let _ = f.join(e.root, "src", "lib", "components", "nav-user.svelte");
170
+ c(l(_, S(_, i))), o.info("Reverting billing/+page.server.ts");
171
+ let y = f.join(e.root, "src", "routes", "(app)", "billing", "+page.server.ts");
172
+ c(l(y, C(y, r))), o.info("Reverting billing/+page.svelte");
173
+ let b = f.join(e.root, "src", "routes", "(app)", "billing", "+page.svelte");
174
+ return c(l(b, w(b, n))), {
174
175
  creates: [],
175
176
  modifies: s,
176
177
  deletes: [],
@@ -182,6 +183,6 @@ async function w(e) {
182
183
  };
183
184
  }
184
185
  //#endregion
185
- export { w as generate };
186
+ export { T as generate };
186
187
 
187
- //# sourceMappingURL=generate.runtime-BbIN0tUZ.js.map
188
+ //# sourceMappingURL=generate.runtime-4FDxnvCl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.runtime-4FDxnvCl.js","names":[],"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,IAAM,oBAA2B,IAAI,IAAI;CACvC;CACA;CACA;AACF,CAAC;AAED,SAAgB,EAAsB,GAAiC;CACrE,IAAI,CAAC,EAAG,WAAW,CAAQ,GACzB,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAE7C,IAAM,IAAW,EAAG,aAAa,GAAU,MAAM;CACjD,IAAI,CAAC,EAAS,SAAS,2BAA2B,GAChD,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAM,EAAE,cAAW,EAAmB,IAAW,MAAO;EAGtD,AAFA,EAA8B,GAAI,wBAAwB,GAC1D,EAA8B,GAAI,wBAAwB,GAC1D,EAA8B,GAAI,wBAAwB;EAE1D,IAAM,IAAa,EAChB,qBAAqB,EAAW,eAAe,CAAC,CAChD,MAAM,MAAS,EAAK,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,YAAY,CAAC;EACvE,IAAI,CAAC,GAAY;EAIjB,IAAM,IAFY,EAAW,aAEZ,CAAA,CACd,WAAW,CAAC,CACZ,QAAQ,MAAW;GAClB,IAAI,EAAO,QAAQ,MAAM,EAAW,YAAY,OAAO;GAEvD,IAAM,IADa,EAAO,cAAc,EAAW,UACtC,CAAA,CAAW,cAAc,GAChC,IACJ,EAAK,OAAO,EAAW,aAAa,KACpC,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GAEA,EAAO,KAAK,gCAAgC;CAC5C,IAAM,IAAsB,EAAK,KAC/B,EAAQ,MACR,OACA,UACA,SACA,gBACF;CAQA,AAPA,EACE,EACE,GACA,EAAwB,CAAmB,CAC7C,CACF,GAEA,EAAO,KAAK,8BAA8B;CAC1C,IAAM,IAAiB,EAAK,KAC1B,EAAQ,MACR,OACA,OACA,cACA,oBACF;CAKA,AAJA,EACE,EAAoB,GAAgB,EAAmB,CAAc,CAAC,CACxE,GAEA,EAAO,KAAK,2BAA2B;CACvC,IAAM,IAAc,EAAK,KACvB,EAAQ,MACR,OACA,OACA,cACA,iBACF;CAQA,AAPA,EACE,EACE,GACA,EAAgB,GAAa,CAAuB,CACtD,CACF,GAEA,EAAO,KAAK,mCAAmC;CAC/C,IAAM,IAAwB,EAAK,KACjC,EAAQ,MACR,OACA,UACA,SACA,WACA,iBACF;CAWA,AAVA,EACE,EACE,GACA,EACE,GACA,CACF,CACF,CACF,GAEA,EAAO,KAAK,gCAAgC;CAC5C,IAAM,IAAwB,EAAK,KACjC,EAAQ,MACR,OACA,UACA,SACA,WACA,cACF;CAgBA,OAfA,EACE,EACE,GACA,EACE,GACA,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,MAb4B,EAC5B,CAAC,sBAAsB,GACvB,CACF;CAWA;AACF"}
@@ -1,14 +1,15 @@
1
1
  import { t as e } from "./dedent-Gq6Krl4n.js";
2
2
  import { n as t } from "./logger-CQONztPm.js";
3
- import { modifyOutcomeToFile as n } from "./modify-file-GQD6uNgI.js";
4
- import r from "node:fs";
5
- import i from "node:path";
6
- import { Project as a, QuoteKind as o } from "ts-morph";
3
+ import { o as n } from "./ts-morph-helpers-CeduA--o.js";
4
+ import { modifyOutcomeToFile as r } from "./modify-file-Dwfv0dCI.js";
5
+ import i from "node:fs";
6
+ import a from "node:path";
7
+ import { Project as o, QuoteKind as s } from "ts-morph";
7
8
  //#region src/patterns/enable/workflows/modifies/hooks.server.ts
8
- var s = e`
9
+ var c = e`
9
10
  // Runs once when the server starts: executes the workflows in src/lib/workflows.
10
11
  export const init: ServerInit = () => startWorker();
11
- `, c = e`
12
+ `, l = e`
12
13
  src/hooks.server.ts already exports an init hook. Start the workflow worker from it:
13
14
 
14
15
  import { startWorker } from '$lib/server/workflows';
@@ -17,7 +18,7 @@ var s = e`
17
18
  await startWorker();
18
19
  // ...the rest of your init
19
20
  };
20
- `, l = e`
21
+ `, u = e`
21
22
  Create src/hooks.server.ts and start the workflow worker from its init hook:
22
23
 
23
24
  import type { ServerInit } from '@sveltejs/kit';
@@ -25,7 +26,7 @@ var s = e`
25
26
 
26
27
  export const init: ServerInit = () => startWorker();
27
28
  `;
28
- function u(e, t, n, r = !1) {
29
+ function d(e, t, n, r = !1) {
29
30
  let i = e.getImportDeclarations().find((e) => e.getModuleSpecifierValue() === t);
30
31
  if (!i) {
31
32
  e.addImportDeclaration({
@@ -40,39 +41,39 @@ function u(e, t, n, r = !1) {
40
41
  isTypeOnly: !0
41
42
  } : n);
42
43
  }
43
- function d(e) {
44
+ function f(e) {
44
45
  return e.getVariableDeclaration("init") || e.getFunction("init") ? !0 : e.getExportDeclarations().some((e) => e.getNamedExports().some((e) => e.getName() === "init"));
45
46
  }
46
- function f(e) {
47
- if (!r.existsSync(e)) return {
47
+ function p(e) {
48
+ if (!i.existsSync(e)) return {
48
49
  status: "not-found",
49
- message: l
50
+ message: u
50
51
  };
51
- if (r.readFileSync(e, "utf8").includes("startWorker")) return {
52
+ if (i.readFileSync(e, "utf8").includes("startWorker")) return {
52
53
  status: "success",
53
54
  changed: !1
54
55
  };
55
- let t = new a({
56
+ let t = new o({
56
57
  compilerOptions: { allowJs: !0 },
57
- manipulationSettings: { quoteKind: o.Single }
58
+ manipulationSettings: { quoteKind: s.Single }
58
59
  }).addSourceFileAtPath(e);
59
- return d(t) ? {
60
+ return f(t) ? {
60
61
  status: "failed",
61
- message: c
62
- } : (u(t, "@sveltejs/kit", "ServerInit", !0), u(t, "$lib/server/workflows", "startWorker"), t.addStatements(`\n${s}`), t.formatText(), t.saveSync(), {
62
+ message: l
63
+ } : (d(t, "@sveltejs/kit", "ServerInit", !0), d(t, "$lib/server/workflows", "startWorker"), t.addStatements(`\n${c}`), n(t), t.saveSync(), {
63
64
  status: "success",
64
65
  changed: !0
65
66
  });
66
67
  }
67
68
  //#endregion
68
69
  //#region src/patterns/enable/workflows/generate.runtime.ts
69
- async function p(e) {
70
- let r = t(e), a = [];
71
- r.info("Modifying hooks.server.ts");
72
- let o = i.join(e.root, "src", "hooks.server.ts"), s = n(o, f(o));
73
- return s && a.push(s), {
70
+ async function m(e) {
71
+ let n = t(e), i = [];
72
+ n.info("Modifying hooks.server.ts");
73
+ let o = a.join(e.root, "src", "hooks.server.ts"), s = r(o, p(o));
74
+ return s && i.push(s), {
74
75
  creates: [],
75
- modifies: a,
76
+ modifies: i,
76
77
  deletes: [],
77
78
  components: [],
78
79
  packages: [],
@@ -82,6 +83,6 @@ async function p(e) {
82
83
  };
83
84
  }
84
85
  //#endregion
85
- export { p as generate };
86
+ export { m as generate };
86
87
 
87
- //# sourceMappingURL=generate.runtime-B0hhtyAL.js.map
88
+ //# sourceMappingURL=generate.runtime-AYQVW1S-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.runtime-AYQVW1S-.js","names":[],"sources":["../../src/patterns/enable/workflows/modifies/hooks.server.ts","../../src/patterns/enable/workflows/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst INIT_SNIPPET = dedent`\n // Runs once when the server starts: executes the workflows in src/lib/workflows.\n export const init: ServerInit = () => startWorker();\n`;\n\nconst FAILURE_HINT = dedent`\n src/hooks.server.ts already exports an init hook. Start the workflow worker from it:\n\n import { startWorker } from '$lib/server/workflows';\n\n export const init: ServerInit = async () => {\n await startWorker();\n // ...the rest of your init\n };\n`;\n\nconst NOT_FOUND_HINT = dedent`\n Create src/hooks.server.ts and start the workflow worker from its init hook:\n\n import type { ServerInit } from '@sveltejs/kit';\n import { startWorker } from '$lib/server/workflows';\n\n export const init: ServerInit = () => startWorker();\n`;\n\nfunction ensureNamedImport(\n sourceFile: SourceFile,\n moduleSpecifier: string,\n name: string,\n typeOnly = false,\n) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === moduleSpecifier);\n if (!existing) {\n sourceFile.addImportDeclaration({\n isTypeOnly: typeOnly,\n namedImports: [name],\n moduleSpecifier,\n });\n return;\n }\n if (existing.getNamedImports().some((ni) => ni.getName() === name)) return;\n // A declaration that is already `import type` covers the new name; a value\n // import takes the name as an inline `type` specifier.\n existing.addNamedImport(\n typeOnly && !existing.isTypeOnly() ? { name, isTypeOnly: true } : name,\n );\n}\n\nfunction hasInitExport(sourceFile: SourceFile): boolean {\n if (sourceFile.getVariableDeclaration(\"init\")) return true;\n if (sourceFile.getFunction(\"init\")) return true;\n return sourceFile\n .getExportDeclarations()\n .some((d) => d.getNamedExports().some((e) => e.getName() === \"init\"));\n}\n\n/**\n * Adds the `init` hook that starts the workflow worker. Projects created from\n * the base template already have it; this is the upgrade path for older ones.\n */\nexport function modifyHooksServerWorkflows(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (original.includes(\"startWorker\")) {\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 if (hasInitExport(sourceFile)) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n ensureNamedImport(sourceFile, \"@sveltejs/kit\", \"ServerInit\", true);\n ensureNamedImport(sourceFile, \"$lib/server/workflows\", \"startWorker\");\n\n // After everything else, so the hook reads as the last thing the server does on start.\n sourceFile.addStatements(`\\n${INIT_SNIPPET}`);\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\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 { modifyHooksServerWorkflows } from \"./modifies/hooks.server\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n logger.info(\"Modifying hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n const hooksFile = modifyOutcomeToFile(\n hooksServerPath,\n modifyHooksServerWorkflows(hooksServerPath),\n );\n if (hooksFile) modifies.push(hooksFile);\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;AAMA,IAAM,IAAe,CAAM;;;GAKrB,IAAe,CAAM;;;;;;;;;GAWrB,IAAiB,CAAM;;;;;;;;AAS7B,SAAS,EACP,GACA,GACA,GACA,IAAW,IACX;CACA,IAAM,IAAW,EACd,sBAAsB,CAAC,CACvB,MAAM,MAAM,EAAE,wBAAwB,MAAM,CAAe;CAC9D,IAAI,CAAC,GAAU;EACb,EAAW,qBAAqB;GAC9B,YAAY;GACZ,cAAc,CAAC,CAAI;GACnB;EACF,CAAC;EACD;CACF;CACI,EAAS,gBAAgB,CAAC,CAAC,MAAM,MAAO,EAAG,QAAQ,MAAM,CAAI,KAGjE,EAAS,eACP,KAAY,CAAC,EAAS,WAAW,IAAI;EAAE;EAAM,YAAY;CAAK,IAAI,CACpE;AACF;AA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  import { n as e } from "./logger-CQONztPm.js";
2
- import { t } from "./shared-BwHQM-a9.js";
2
+ import { t } from "./shared-C8GtNxpm.js";
3
3
  import { n } from "./env-BPfk1VAw.js";
4
- import { modifyOutcomeToFile as r, u as i } from "./modify-file-GQD6uNgI.js";
5
- import { t as a } from "./svelte-file-B3RfgVdt.js";
6
- import o from "node:fs";
7
- import s from "node:path";
8
- import { Project as c, QuoteKind as l, SyntaxKind as u } from "ts-morph";
4
+ import { f as r, o as i } from "./ts-morph-helpers-CeduA--o.js";
5
+ import { modifyOutcomeToFile as a } from "./modify-file-Dwfv0dCI.js";
6
+ import { t as o } from "./svelte-file-B3RfgVdt.js";
7
+ import s from "node:fs";
8
+ import c from "node:path";
9
+ import { Project as l, QuoteKind as u, SyntaxKind as d } from "ts-morph";
9
10
  //#region src/patterns/disable/payments/modifies/modify-nav-user.ts
10
- function d(e) {
11
- if (!o.existsSync(e)) return {
11
+ function f(e) {
12
+ if (!s.existsSync(e)) return {
12
13
  status: "success",
13
14
  changed: !1
14
15
  };
15
- let t = o.readFileSync(e, "utf8");
16
+ let t = s.readFileSync(e, "utf8");
16
17
  if (!t.includes("/billing")) return {
17
18
  status: "success",
18
19
  changed: !1
19
20
  };
20
- let n = new a(t), r = !1, s = (e) => {
21
- r || e((e) => {
22
- let t = i(e, "Billing", "@lucide/svelte/icons/credit-card");
23
- return t.wasRemoved && (r = !0), t.source;
21
+ let n = new o(t), i = !1, a = (e) => {
22
+ i || e((e) => {
23
+ let t = r(e, "Billing", "@lucide/svelte/icons/credit-card");
24
+ return t.wasRemoved && (i = !0), t.source;
24
25
  });
25
26
  };
26
- return s((e) => n.modifyModuleScript(e)), r || s((e) => n.modifyScript(e)), r ? (o.writeFileSync(e, n.toString(), "utf8"), {
27
+ return a((e) => n.modifyModuleScript(e)), i || a((e) => n.modifyScript(e)), i ? (s.writeFileSync(e, n.toString(), "utf8"), {
27
28
  status: "success",
28
29
  changed: !0
29
30
  }) : {
@@ -33,39 +34,39 @@ function d(e) {
33
34
  }
34
35
  //#endregion
35
36
  //#region src/patterns/disable/payments/modifies/modify-user-signup.ts
36
- var f = /* @__PURE__ */ new Set(["linkStripeCustomer.run", "linkStripeCustomer"]);
37
- function p(e) {
38
- if (!o.existsSync(e)) return {
37
+ var p = /* @__PURE__ */ new Set(["linkStripeCustomer.run", "linkStripeCustomer"]);
38
+ function m(e) {
39
+ if (!s.existsSync(e)) return {
39
40
  status: "success",
40
41
  changed: !1
41
42
  };
42
- let t = o.readFileSync(e, "utf8");
43
+ let t = s.readFileSync(e, "utf8");
43
44
  if (!t.includes("linkStripeCustomer")) return {
44
45
  status: "success",
45
46
  changed: !1
46
47
  };
47
- let n = new c({ manipulationSettings: { quoteKind: l.Single } }).addSourceFileAtPath(e);
48
+ let n = new l({ manipulationSettings: { quoteKind: u.Single } }).addSourceFileAtPath(e);
48
49
  for (let e of ["$lib/workflows/link-stripe-customer", "$lib/stripe"]) {
49
50
  let t = n.getImportDeclarations().find((t) => t.getModuleSpecifierValue() === e);
50
51
  t && t.remove();
51
52
  }
52
53
  let r = n.getVariableStatement((e) => e.getDeclarations().some((e) => e.getName() === "linkStripeCustomer"));
53
54
  r && r.remove();
54
- let i = n.getDescendantsOfKind(u.CallExpression).filter((e) => f.has(e.getExpression().getText()));
55
- for (let e of i) {
56
- let t = e.getFirstAncestorByKind(u.ExpressionStatement);
55
+ let a = n.getDescendantsOfKind(d.CallExpression).filter((e) => p.has(e.getExpression().getText()));
56
+ for (let e of a) {
57
+ let t = e.getFirstAncestorByKind(d.ExpressionStatement);
57
58
  t && t.remove();
58
59
  }
59
- return n.formatText(), n.saveSync(), {
60
+ return i(n), n.saveSync(), {
60
61
  status: "success",
61
62
  changed: n.getFullText() !== t
62
63
  };
63
64
  }
64
65
  //#endregion
65
66
  //#region src/patterns/disable/payments/generate.runtime.ts
66
- async function m(i) {
67
- let a = i.features.auth, o = e(i), c = [], l = (e) => {
68
- e && c.push(e);
67
+ async function h(r) {
68
+ let i = r.features.auth, o = e(r), s = [], l = (e) => {
69
+ e && s.push(e);
69
70
  };
70
71
  o.info("Stripping Stripe credentials from .env");
71
72
  let u = [
@@ -85,32 +86,32 @@ async function m(i) {
85
86
  type: "var",
86
87
  key: "STRIPE_WEBHOOK_SECRET"
87
88
  }
88
- ], f = s.join(i.root, ".env");
89
- if (l(r(f, n(f, u))), a) {
89
+ ], d = c.join(r.root, ".env");
90
+ if (l(a(d, n(d, u))), i) {
90
91
  o.info("Reverting nav-user.svelte");
91
- let e = s.join(i.root, "src", "lib", "components", "nav-user.svelte");
92
- l(r(e, d(e))), o.info("Reverting signup +page.server.ts");
93
- let t = s.join(i.root, "src", "routes", "(public)", "(auth)", "signup", "+page.server.ts");
94
- l(r(t, p(t)));
92
+ let e = c.join(r.root, "src", "lib", "components", "nav-user.svelte");
93
+ l(a(e, f(e))), o.info("Reverting signup +page.server.ts");
94
+ let t = c.join(r.root, "src", "routes", "(public)", "(auth)", "signup", "+page.server.ts");
95
+ l(a(t, m(t)));
95
96
  }
96
97
  return {
97
98
  creates: [],
98
- modifies: c,
99
+ modifies: s,
99
100
  deletes: [],
100
101
  components: [],
101
102
  packages: [],
102
103
  collections: [],
103
104
  collectionPatches: [],
104
- collectionDrops: await t(a ? [
105
+ collectionDrops: await t(i ? [
105
106
  "transactions",
106
107
  "stripe_customers",
107
108
  "stripe_payment_methods",
108
109
  "stripe_prices",
109
110
  "stripe_products"
110
- ] : ["stripe_prices", "stripe_products"], i)
111
+ ] : ["stripe_prices", "stripe_products"], r)
111
112
  };
112
113
  }
113
114
  //#endregion
114
- export { m as generate };
115
+ export { h as generate };
115
116
 
116
- //# sourceMappingURL=generate.runtime-wA1G3tQ4.js.map
117
+ //# sourceMappingURL=generate.runtime-B2aFFaac.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.runtime-B2aFFaac.js","names":[],"sources":["../../src/patterns/disable/payments/modifies/modify-nav-user.ts","../../src/patterns/disable/payments/modifies/modify-user-signup.ts","../../src/patterns/disable/payments/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport { removeNavItemFromScript } from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyNavUser(navUserPath: string): ModifyOutcome {\n if (!fs.existsSync(navUserPath)) {\n return { status: \"success\", changed: false };\n }\n\n const source = fs.readFileSync(navUserPath, \"utf8\");\n if (!source.includes(\"/billing\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = new SvelteFile(source);\n let wasRemoved = false;\n\n const tryRemove = (run: (fn: (s: string) => string) => boolean) => {\n if (wasRemoved) return;\n run((src) => {\n const result = removeNavItemFromScript(\n src,\n \"Billing\",\n \"@lucide/svelte/icons/credit-card\",\n );\n if (result.wasRemoved) wasRemoved = true;\n return result.source;\n });\n };\n\n tryRemove((fn) => file.modifyModuleScript(fn));\n if (!wasRemoved) tryRemove((fn) => file.modifyScript(fn));\n\n if (!wasRemoved) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(navUserPath, file.toString(), \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst CALL_EXPRESSIONS = new Set([\n \"linkStripeCustomer.run\",\n // Projects from before the workflow: an inline helper called directly.\n \"linkStripeCustomer\",\n]);\n\nexport function unmodifyUserSignup(userSignupPath: string): ModifyOutcome {\n if (!fs.existsSync(userSignupPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(userSignupPath, \"utf8\");\n if (!originalSource.includes(\"linkStripeCustomer\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(userSignupPath);\n\n for (const specifier of [\n \"$lib/workflows/link-stripe-customer\",\n \"$lib/stripe\",\n ]) {\n const decl = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === specifier);\n if (decl) decl.remove();\n }\n\n const linkFn = sourceFile.getVariableStatement((s) =>\n s.getDeclarations().some((d) => d.getName() === \"linkStripeCustomer\"),\n );\n if (linkFn) linkFn.remove();\n\n const callStatements = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .filter((ce) => CALL_EXPRESSIONS.has(ce.getExpression().getText()));\n for (const call of callStatements) {\n const stmt = call.getFirstAncestorByKind(SyntaxKind.ExpressionStatement);\n if (stmt) stmt.remove();\n }\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyEnvRemove, type EnvEdit } from \"../../../runtime/env\";\nimport { unmodifyNavUser } from \"./modifies/modify-nav-user\";\nimport { unmodifyUserSignup } from \"./modifies/modify-user-signup\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\n\nexport async function generate(options: Options) {\n const isAppMode = options.features.auth;\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(\"Stripping Stripe credentials from .env\");\n const envEdits: EnvEdit[] = [\n { type: \"comment\", key: \"Stripe credentials\" },\n { type: \"var\", key: \"STRIPE_SECRET_KEY\" },\n { type: \"var\", key: \"PUBLIC_STRIPE_PUBLISHABLE_KEY\" },\n { type: \"var\", key: \"STRIPE_WEBHOOK_SECRET\" },\n ];\n const envPath = path.join(options.root, \".env\");\n pushResult(modifyOutcomeToFile(envPath, modifyEnvRemove(envPath, envEdits)));\n\n if (isAppMode) {\n logger.info(\"Reverting nav-user.svelte\");\n const navUserPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"nav-user.svelte\",\n );\n pushResult(modifyOutcomeToFile(navUserPath, unmodifyNavUser(navUserPath)));\n\n logger.info(\"Reverting signup +page.server.ts\");\n const userSignupPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"(auth)\",\n \"signup\",\n \"+page.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(userSignupPath, unmodifyUserSignup(userSignupPath)),\n );\n }\n\n const collectionNames = [\n \"transactions\",\n \"stripe_customers\",\n \"stripe_payment_methods\",\n \"stripe_prices\",\n \"stripe_products\",\n ];\n const collectionDrops = await planDropsForCollections(\n isAppMode ? collectionNames : [\"stripe_prices\", \"stripe_products\"],\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,SAAgB,EAAgB,GAAoC;CAClE,IAAI,CAAC,EAAG,WAAW,CAAW,GAC5B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAM,IAAS,EAAG,aAAa,GAAa,MAAM;CAClD,IAAI,CAAC,EAAO,SAAS,UAAU,GAC7B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAM,IAAO,IAAI,EAAW,CAAM,GAC9B,IAAa,IAEX,KAAa,MAAgD;EAC7D,KACJ,GAAK,MAAQ;GACX,IAAM,IAAS,EACb,GACA,WACA,kCACF;GAEA,OADI,EAAO,eAAY,IAAa,KAC7B,EAAO;EAChB,CAAC;CACH;CAUA,OARA,GAAW,MAAO,EAAK,mBAAmB,CAAE,CAAC,GACxC,KAAY,GAAW,MAAO,EAAK,aAAa,CAAE,CAAC,GAEnD,KAIL,EAAG,cAAc,GAAa,EAAK,SAAS,GAAG,MAAM,GAC9C;EAAE,QAAQ;EAAW,SAAS;CAAK,KAJjC;EAAE,QAAQ;EAAW,SAAS;CAA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