@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 @@
1
+ {"version":3,"file":"write-result-B68lvI57.js","names":["__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","__import_glob__0_5_","__import_glob__0_6_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_17_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","__import_glob__0_39_","__import_glob__0_40_","__import_glob__0_41_","__import_glob__0_42_","__import_glob__0_43_","__import_glob__0_44_","__import_glob__0_45_","__import_glob__0_46_","__import_glob__0_47_","__import_glob__0_48_","__import_glob__0_49_","__import_glob__0_50_","__import_glob__0_51_","__import_glob__0_52_","__import_glob__0_53_","__import_glob__0_54_","__import_glob__0_55_","__exportAll","MissingShadcnError","RegistryUnavailableError","InvalidArgumentError","FORMSNAP","TANSTACK_TABLE_CORE","FORMSNAP_OVERRIDES","formatSource","getLogger","NOOP_LOGGER","resolveUiDir","readComponentsConfig","fetchRegistryIndex","assertTableCorePackage","ensurePackageOverrides","path","spawn","os","auth_menu_content_default","auth_menu_group_default","auth_menu_item_default","auth_menu_label_default","auth_menu_separator_default","auth_menu_trigger_default","auth_menu_default$1","context_default","auth_menu_default","autodate_default","bool_default","date_default","editor_default","email_default","file_default","geoPoint_default","cells_default","json_default","number_default","password_default","relation_default","select_default","text_default","url_default","column_header_default$1","column_header_default","data_table_svelte_default","flex_render_default","data_table_default","render_helpers_default","faceted_filter_default$1","faceted_filter_default","file_field_default","file_input_default","file_multiple_default","file_single_default","file_thumb_default","file_form_default","shared_default","coordinate_default","geopoint_default","input_default$1","toggle_map_default","leaflet_default$1","leaflet_default","chip_default","content_default","field_default","multiselect_default","input_default","item_default","trigger_default","pagination_default$1","pagination_default","row_actions_default$1","row_actions_default","write_result_exports","ensureSvelteKitSync","executeCommand","formatPaths","getAllCustomComponents","installComponents","installedComponents","installedPackagesFromProject","isCustomComponent","isExactSpec","packageName","restoreDowngradedDependencies","writeResult","customDependencies","customNpmPackages","customComponentAssets","componentNameFromAssetPath","parts","assetPath","componentRelativeAssetPath","index","toTargetPath","filePath","root","toRelativePath","writeFile","mkdirSync","writeFileSync","content","removeFile","existsSync","rmSync","pruneEmptyDirectories","stop","current","dir","readdirSync","EXACT_FLAG","executeWithDetectedPackageManager","packageManager","detect","resolved","resolveCommand","operation","args","commandArgs","exactFlag","options","child","reject","code","restoreTypes","preserveSvelteKitTypes","cwd","runtime","packageJsonPath","packageJson","readFileSync","at","spec","name","ensureFormsnapOverride","names","toInstall","formsnap","installed","touched","outcome","logger","appDir","saved","mkdtempSync","cpSync","error","DEPENDENCY_BLOCKS","rangeFloor","match","part","value","compareFloors","i","a","b","pkg","after","restored","previous","block","before","entries","old","oldFloor","newFloor","readPackageJson","file","installPackages","packages","exact","ranged","uninstallPackages","toRemove","component","customNpmPackagesFor","components","copyCustomComponent","targetDir","targetComponentsDir","relativePath","outputPath","FORMATTABLE_EXTENSIONS","filesUnder","target","statSync","entry","context","changed","paths","formatted","uiDir","BARE_ITEM_NAME","assertKnownRegistryItems","bare","known","item","unknown","style","requested","componentsDir","isPresent","skipped","overwrite","customToInstall","publicToInstall","dependency","customList","publicList","indent","recorded","had","installedList","writtenResult","dropMigrationCreates","result","dropCollections","isPackageJson","packageInstalls","componentInstalls","packageUninstalls"],"sources":["../../src/runtime/write-result.ts"],"sourcesContent":["import {\n cpSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { detect } from \"package-manager-detector\";\nimport { resolveCommand } from \"package-manager-detector/commands\";\nimport spawn from \"cross-spawn\";\nimport type {\n Component,\n ExecuteCommandOptions,\n InstallComponentsOptions,\n InstallComponentsResult,\n Options,\n PackageManagerOperation,\n Result,\n WriteResultRuntime,\n} from \"../core/types\";\nimport {\n InvalidArgumentError,\n MissingShadcnError,\n RegistryUnavailableError,\n} from \"../core/errors\";\nimport { getLogger, NOOP_LOGGER, type Logger } from \"../core/logger\";\nimport { formatSource } from \"../core/format-result\";\nimport {\n FORMSNAP,\n FORMSNAP_OVERRIDES,\n TANSTACK_TABLE_CORE,\n} from \"../core/constants\";\nimport {\n fetchRegistryIndex,\n readComponentsConfig,\n resolveUiDir,\n} from \"./registry\";\nimport { assertTableCorePackage } from \"./table-core\";\nimport { ensurePackageOverrides } from \"./package-imports\";\n\nexport { resolveUiDir };\n\ntype CustomNpmPackages = Record<string, string[]>;\n\n/**\n * The components under `src/ui/components` are copied into a project rather\n * than fetched from the shadcn-svelte registry, so their dependencies have to\n * be declared here: every shadcn-svelte component a bundled one imports\n * (`#lib/components/ui/<x>/index.js`) must appear in `customDependencies`, and\n * every npm package that no shadcn item installs for it must appear in\n * `customNpmPackages`.\n */\nconst customDependencies: Record<string, string[]> = {\n \"file-form\": [\"input\"],\n multiselect: [\"command\", \"popover\", \"button\"],\n geopoint: [\"button\", \"leaflet\"],\n cells: [\"badge\"],\n \"data-table\": [],\n \"column-header\": [\"dropdown-menu\", \"button\"],\n \"faceted-filter\": [\"command\", \"popover\", \"button\", \"separator\", \"badge\"],\n pagination: [\"button\", \"select\"],\n \"row-actions\": [\"dropdown-menu\", \"button\"],\n leaflet: [],\n \"auth-menu\": [\"dropdown-menu\", \"button\"],\n};\n\nconst customNpmPackages: CustomNpmPackages = {\n \"file-form\": [FORMSNAP],\n multiselect: [FORMSNAP],\n geopoint: [],\n cells: [],\n // shadcn-svelte >= 1.2.0 resolves items from the style-scoped registry\n // (/registry/styles/<style>/), which has no `data-table` item, so the\n // TanStack helpers ship from here instead.\n \"data-table\": [TANSTACK_TABLE_CORE],\n \"column-header\": [TANSTACK_TABLE_CORE],\n \"faceted-filter\": [TANSTACK_TABLE_CORE],\n pagination: [TANSTACK_TABLE_CORE],\n \"row-actions\": [],\n leaflet: [\"leaflet\", \"@types/leaflet\"],\n};\n\nconst customComponentAssets = import.meta.glob<string>(\"../ui/components/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n/** The components this package ships, by directory name, sorted. */\nexport function getAllCustomComponents(): Component[] {\n return [\n ...new Set(\n Object.keys(customComponentAssets).map(componentNameFromAssetPath),\n ),\n ]\n .filter(Boolean)\n .sort();\n}\n\nfunction componentNameFromAssetPath(assetPath: string): string {\n const parts = assetPath.split(\"/\");\n const index = parts.indexOf(\"components\");\n return parts[index + 1] ?? \"\";\n}\n\nfunction componentRelativeAssetPath(assetPath: string): string {\n const parts = assetPath.split(\"/\");\n const index = parts.indexOf(\"components\");\n return parts.slice(index + 2).join(\"/\");\n}\n\nfunction toTargetPath(root: string, filePath: string): string {\n if (path.isAbsolute(filePath)) {\n return filePath;\n }\n return path.join(root, filePath);\n}\n\nfunction toRelativePath(root: string, filePath: string): string {\n if (path.isAbsolute(filePath)) {\n return path.relative(root, filePath);\n }\n return filePath;\n}\n\nfunction writeFile(filePath: string, content: string): void {\n mkdirSync(path.dirname(filePath), { recursive: true });\n writeFileSync(filePath, content, \"utf8\");\n}\n\nfunction removeFile(filePath: string, root: string): void {\n if (!existsSync(filePath)) {\n return;\n }\n\n rmSync(filePath, { force: true, recursive: true });\n pruneEmptyDirectories(path.dirname(filePath), root);\n}\n\n/**\n * Deleting a feature's files must also delete the directories it added, up\n * to the first one that still has content. The CLI detects features by\n * directory (`src/routes/(app)` means auth is on), so an empty leftover\n * directory keeps a disabled feature \"enabled\".\n */\nfunction pruneEmptyDirectories(dir: string, root: string): void {\n const stop = path.resolve(root);\n let current = path.resolve(dir);\n while (current !== stop && current.startsWith(stop)) {\n if (!existsSync(current) || readdirSync(current).length > 0) {\n return;\n }\n rmSync(current, { recursive: true, force: true });\n current = path.dirname(current);\n }\n}\n\n/** Each package manager's flag for saving the exact version instead of a range. */\nconst EXACT_FLAG: Record<string, string> = {\n npm: \"--save-exact\",\n pnpm: \"--save-exact\",\n yarn: \"--exact\",\n bun: \"--exact\",\n};\n\nasync function executeWithDetectedPackageManager(\n cwd: string,\n operation: PackageManagerOperation,\n args: string[],\n options: ExecuteCommandOptions = {},\n): Promise<void> {\n const packageManager = (await detect({ cwd }))?.name ?? \"npm\";\n // Adding named packages is `add` (`npm i`, `pnpm add`, `yarn add`):\n // `yarn install <pkg>` is an error.\n const resolved = resolveCommand(\n packageManager,\n operation === \"install\" && args.length > 0 ? \"add\" : operation,\n args,\n );\n if (!resolved) {\n throw new Error(\n `Unable to resolve ${operation} command for ${packageManager}`,\n );\n }\n\n const commandArgs = [...resolved.args];\n if (packageManager === \"npm\") {\n commandArgs.unshift(\"--yes\");\n }\n const exactFlag = EXACT_FLAG[packageManager];\n if (options.exact && exactFlag) {\n commandArgs.push(exactFlag);\n }\n\n await new Promise<void>((resolve, reject) => {\n const child = spawn(resolved.command, commandArgs, {\n cwd,\n stdio: \"inherit\",\n });\n child.on(\"error\", reject);\n child.on(\"exit\", (code) => {\n if (code === 0) {\n resolve();\n return;\n }\n reject(\n new Error(`${resolved.command} exited with code ${code ?? \"unknown\"}`),\n );\n });\n });\n}\n\nexport async function executeCommand(\n cwd: string,\n operation: PackageManagerOperation,\n args: string[],\n runtime?: WriteResultRuntime,\n options?: ExecuteCommandOptions,\n): Promise<void> {\n const restoreTypes =\n operation === \"execute\" ? null : preserveSvelteKitTypes(cwd);\n try {\n if (runtime?.executeCommand) {\n await (options\n ? runtime.executeCommand(cwd, operation, args, options)\n : runtime.executeCommand(cwd, operation, args));\n return;\n }\n\n await executeWithDetectedPackageManager(cwd, operation, args, options);\n } finally {\n restoreTypes?.();\n }\n}\n\n/** Package names `package.json` records, whichever dependency block they sit in. */\nexport function installedPackagesFromProject(root: string): Set<string> {\n const packageJsonPath = path.join(root, \"package.json\");\n if (!existsSync(packageJsonPath)) {\n return new Set();\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n };\n\n return new Set([\n ...Object.keys(packageJson.dependencies ?? {}),\n ...Object.keys(packageJson.devDependencies ?? {}),\n ...Object.keys(packageJson.optionalDependencies ?? {}),\n ...Object.keys(packageJson.peerDependencies ?? {}),\n ]);\n}\n\n/**\n * Splits an npm install spec into its package name, dropping any range.\n * `wuchale@^0.26.3` -> `wuchale`, `@wuchale/svelte@^0.21.1` -> `@wuchale/svelte`.\n *\n * The name is what `package.json` records, so it -- not the full spec -- is what\n * the already-installed check has to compare against.\n */\nexport function packageName(spec: string): string {\n const at = spec.indexOf(\"@\", spec.startsWith(\"@\") ? 1 : 0);\n return at === -1 ? spec : spec.slice(0, at);\n}\n\n/**\n * A spec naming one exact version (`sveltekit-superforms@3.0.0-next.1`),\n * which is saved as written. Package managers otherwise save a caret, and a\n * caret on a prerelease follows every later `next` build.\n */\nexport function isExactSpec(spec: string): boolean {\n const name = packageName(spec);\n return /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$/.test(\n spec.slice(name.length + 1),\n );\n}\n\n/**\n * formsnap 2 peers superforms ^2 and projects run superforms 3, so the\n * override has to be in package.json before an install that brings either in\n * next to formsnap, or npm stops with ERESOLVE.\n */\nfunction ensureFormsnapOverride(\n root: string,\n installed: Set<string>,\n toInstall: string[],\n logger: Logger,\n): void {\n const names = new Set(toInstall.map(packageName));\n const formsnap = names.has(\"formsnap\") || installed.has(\"formsnap\");\n const touched = names.has(\"formsnap\") || names.has(\"sveltekit-superforms\");\n if (!formsnap || !touched) {\n return;\n }\n const { outcome } = ensurePackageOverrides(root, FORMSNAP_OVERRIDES);\n if (outcome.status === \"failed\") {\n logger.info(outcome.message);\n } else if (outcome.status === \"success\" && outcome.changed) {\n logger.info(\"Added the formsnap override for sveltekit-superforms\");\n }\n}\n\n/**\n * SvelteKit 3's tsconfig extends `$app/tsconfig`, which `svelte-kit sync`\n * writes to `node_modules/$app`. A package-manager install prunes that folder\n * (it is no package) and only an argument-less npm install's `prepare` writes\n * it back, so after `npm install <pkg>` every tool that reads the tsconfig\n * (shadcn-svelte, svelte-check without sync, the editor) fails on the missing\n * `extends`. Syncing again is no fix mid-pattern: it loads vite.config, which\n * may already name a plugin whose own config the pattern has not written yet.\n * So the folder is copied aside before an install and put back after.\n */\nfunction preserveSvelteKitTypes(root: string): (() => void) | null {\n const appDir = path.join(root, \"node_modules\", \"$app\");\n if (!existsSync(appDir)) {\n return null;\n }\n const saved = mkdtempSync(path.join(os.tmpdir(), \"vela-app-types-\"));\n cpSync(appDir, path.join(saved, \"$app\"), { recursive: true });\n return () => {\n try {\n if (!existsSync(appDir) && existsSync(path.join(root, \"node_modules\"))) {\n cpSync(path.join(saved, \"$app\"), appDir, { recursive: true });\n }\n } finally {\n rmSync(saved, { recursive: true, force: true });\n }\n };\n}\n\n/**\n * Run `svelte-kit sync` when SvelteKit is installed but `node_modules/$app`\n * is missing (a fresh copy of `node_modules`, or an install made outside\n * vela), so shadcn-svelte can read the tsconfig. Best effort: a sync that\n * fails is reported and left to shadcn-svelte to complain about.\n */\nexport async function ensureSvelteKitSync(\n root: string,\n runtime?: WriteResultRuntime,\n logger: Logger = NOOP_LOGGER,\n): Promise<boolean> {\n if (!existsSync(path.join(root, \"node_modules\", \"@sveltejs\", \"kit\"))) {\n return false;\n }\n if (existsSync(path.join(root, \"node_modules\", \"$app\", \"tsconfig.json\"))) {\n return false;\n }\n try {\n await executeCommand(root, \"execute\", [\"svelte-kit\", \"sync\"], runtime);\n return true;\n } catch (error) {\n logger.info(\n `svelte-kit sync failed (${error instanceof Error ? error.message : String(error)}); node_modules/$app is missing`,\n );\n return false;\n }\n}\n\ntype DependencyBlocks = Record<string, Record<string, string> | undefined>;\n\nconst DEPENDENCY_BLOCKS = [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n] as const;\n\n/** The lowest version a range names, as numbers, or null when it is no semver range. */\nfunction rangeFloor(spec: string): number[] | null {\n const match = spec\n .trim()\n .match(\n /^(?:[\\^~=v]|>=?)?\\s*(\\d+)(?:\\.(\\d+|[xX*]))?(?:\\.(\\d+|[xX*]))?(-[0-9A-Za-z.-]+)?$/,\n );\n if (!match) {\n return null;\n }\n const part = (value: string | undefined) =>\n value === undefined || /[xX*]/.test(value) ? 0 : Number(value);\n // A prerelease sorts below its release.\n return [part(match[1]), part(match[2]), part(match[3]), match[4] ? 0 : 1];\n}\n\nfunction compareFloors(a: number[], b: number[]): number {\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return a[i]! - b[i]!;\n }\n }\n return 0;\n}\n\n/**\n * The dependency entries `shadcn-svelte add` changed that have to go back:\n * shadcn replaces any range its registry item's own range does not cover,\n * downgrades included. The form item still asks for `sveltekit-superforms`\n * ^2, which SvelteKit 3 cannot install, over the project's 3.x pin. So an\n * entry the project already had is restored when shadcn moved it below\n * where it was, or when it is not a semver range at all (file:, git,\n * workspace:). A raised floor and every new entry are kept.\n */\nexport function restoreDowngradedDependencies(\n before: DependencyBlocks,\n after: DependencyBlocks,\n): { pkg: DependencyBlocks; restored: string[] } {\n const pkg: DependencyBlocks = { ...after };\n const restored: string[] = [];\n const previous = new Map<string, string>();\n for (const block of DEPENDENCY_BLOCKS) {\n for (const [name, spec] of Object.entries(before[block] ?? {})) {\n previous.set(name, spec);\n }\n }\n for (const block of DEPENDENCY_BLOCKS) {\n const entries = after[block];\n if (!entries) {\n continue;\n }\n for (const [name, spec] of Object.entries(entries)) {\n const old = previous.get(name);\n if (old === undefined || old === spec) {\n continue;\n }\n const oldFloor = rangeFloor(old);\n const newFloor = rangeFloor(spec);\n const keep =\n oldFloor !== null &&\n newFloor !== null &&\n compareFloors(newFloor, oldFloor) >= 0;\n if (keep) {\n continue;\n }\n pkg[block] = { ...(pkg[block] as Record<string, string>), [name]: old };\n restored.push(`${name}@${old}`);\n }\n }\n return { pkg, restored };\n}\n\nfunction readPackageJson(root: string): Record<string, unknown> | null {\n const file = path.join(root, \"package.json\");\n if (!existsSync(file)) {\n return null;\n }\n return JSON.parse(readFileSync(file, \"utf8\")) as Record<string, unknown>;\n}\n\nasync function installPackages(\n root: string,\n packages: string[],\n runtime?: WriteResultRuntime,\n logger: Logger = NOOP_LOGGER,\n): Promise<string[]> {\n if (packages.length === 0) {\n return [];\n }\n\n const installed = installedPackagesFromProject(root);\n const toInstall = [...new Set(packages)].filter(\n (pkg) => !installed.has(packageName(pkg)),\n );\n if (toInstall.length === 0) {\n return [];\n }\n\n ensureFormsnapOverride(root, installed, toInstall, logger);\n\n logger.info(`Installing packages: ${toInstall.join(\", \")}`);\n // `--save-exact` applies to a whole command, so exact pins go in their own.\n const exact = toInstall.filter(isExactSpec);\n const ranged = toInstall.filter((spec) => !isExactSpec(spec));\n if (exact.length > 0) {\n await executeCommand(root, \"install\", exact, runtime, { exact: true });\n }\n if (ranged.length > 0) {\n await executeCommand(root, \"install\", ranged, runtime);\n }\n return toInstall;\n}\n\n/**\n * `npm uninstall` for the listed packages that `package.json` records. The\n * inverse of `installPackages`: names not present are skipped, so a disable\n * pattern can name everything its enable counterpart installed.\n */\nasync function uninstallPackages(\n root: string,\n packages: string[],\n runtime?: WriteResultRuntime,\n logger: Logger = NOOP_LOGGER,\n): Promise<string[]> {\n if (packages.length === 0) {\n return [];\n }\n\n const installed = installedPackagesFromProject(root);\n const toRemove = [...new Set(packages.map(packageName))].filter((pkg) =>\n installed.has(pkg),\n );\n if (toRemove.length === 0) {\n return [];\n }\n\n logger.info(`Removing packages: ${toRemove.join(\", \")}`);\n await executeCommand(root, \"uninstall\", toRemove, runtime);\n return toRemove;\n}\n\nexport function isCustomComponent(component: string): boolean {\n return getAllCustomComponents().includes(component);\n}\n\nfunction customNpmPackagesFor(components: string[]): string[] {\n return [\n ...new Set(\n components.flatMap((component) => customNpmPackages[component] ?? []),\n ),\n ];\n}\n\nfunction copyCustomComponent(\n component: string,\n targetComponentsDir: string,\n): void {\n const targetDir = path.join(targetComponentsDir, component);\n mkdirSync(targetDir, { recursive: true });\n\n for (const [assetPath, content] of Object.entries(customComponentAssets)) {\n if (componentNameFromAssetPath(assetPath) !== component) {\n continue;\n }\n const relativePath = componentRelativeAssetPath(assetPath);\n if (!relativePath) {\n continue;\n }\n\n const outputPath = path.join(targetDir, relativePath);\n mkdirSync(path.dirname(outputPath), { recursive: true });\n writeFileSync(outputPath, content, \"utf8\");\n }\n}\n\nconst FORMATTABLE_EXTENSIONS = new Set([\n \".ts\",\n \".js\",\n \".svelte\",\n \".json\",\n \".css\",\n]);\n\nfunction* filesUnder(target: string): Generator<string> {\n if (!existsSync(target)) {\n return;\n }\n if (statSync(target).isFile()) {\n yield target;\n return;\n }\n const entries = readdirSync(target, { recursive: true, withFileTypes: true });\n for (const entry of entries) {\n if (entry.isFile()) {\n yield path.join(entry.parentPath, entry.name);\n }\n }\n}\n\n/**\n * `shadcn-svelte add` and `apply` write files in the registry's style and the\n * bundled components carry this repo's; the project's `npm run lint` expects\n * its own. Runs the project's prettier over the given files and directories\n * (relative to the root or absolute) and returns the relative paths it\n * changed. Paths that do not exist are skipped.\n */\nexport async function formatPaths(\n root: string,\n paths: string[],\n): Promise<string[]> {\n const context = { env: \"runtime\" as const, root };\n const changed: string[] = [];\n for (const target of paths) {\n for (const filePath of filesUnder(toTargetPath(root, target))) {\n if (!FORMATTABLE_EXTENSIONS.has(path.extname(filePath))) {\n continue;\n }\n const content = readFileSync(filePath, \"utf8\");\n const formatted = await formatSource(content, filePath, context);\n if (formatted !== content) {\n writeFileSync(filePath, formatted, \"utf8\");\n changed.push(path.relative(root, filePath));\n }\n }\n }\n return changed;\n}\n\n/** The component directories a project has, sorted. */\nexport function installedComponents(root: string): Component[] {\n const uiDir = resolveUiDir(root);\n if (!existsSync(uiDir)) {\n return [];\n }\n return readdirSync(uiDir, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => entry.name)\n .sort();\n}\n\n/** Bare item names are checked against the index; URLs and `@scope/item` are shadcn's to resolve. */\nconst BARE_ITEM_NAME = /^[a-z0-9][a-z0-9-]*$/i;\n\n/**\n * A name the style's registry does not list would otherwise reach\n * `shadcn-svelte add`, which fails after a fetch with a message that never\n * mentions the style. Skipped when the registry cannot be read: shadcn will\n * report that itself.\n */\nasync function assertKnownRegistryItems(\n root: string,\n components: Component[],\n runtime: WriteResultRuntime | undefined,\n logger: Logger,\n): Promise<void> {\n const bare = components.filter((component) => BARE_ITEM_NAME.test(component));\n if (bare.length === 0) {\n return;\n }\n let known: Set<string>;\n try {\n const index = await fetchRegistryIndex(root, { runtime });\n known = new Set(index.map((item) => item.name));\n } catch (error) {\n if (!(error instanceof RegistryUnavailableError)) throw error;\n logger.info(`${error.message}; leaving component names to shadcn-svelte`);\n return;\n }\n const unknown = bare.filter((component) => !known.has(component));\n if (unknown.length === 0) {\n return;\n }\n const { style } = readComponentsConfig(root);\n const names = unknown.map((component) => `\"${component}\"`).join(\", \");\n throw new InvalidArgumentError(\n `Unknown component${unknown.length > 1 ? \"s\" : \"\"} ${names} for style ${style}. Run \\`vela ui list\\` to see what is available.`,\n );\n}\n\nexport async function installComponents(\n options: InstallComponentsOptions,\n runtime?: WriteResultRuntime,\n): Promise<InstallComponentsResult> {\n const { root, components, overwrite = false } = options;\n const logger = getLogger(options);\n\n const requested = [...new Set(components)];\n if (requested.length === 0) {\n return { installed: [], skipped: [], packages: [] };\n }\n\n // `shadcn-svelte add` exits 1 without a `components.json`, after the custom\n // components and their packages are already in. Checked first, so a project\n // without shadcn-svelte is refused whole rather than left half-written.\n if (!existsSync(path.join(root, \"components.json\"))) {\n throw new MissingShadcnError(\n `Adding ${requested.length > 1 ? \"components\" : \"a component\"} (${requested.join(\", \")})`,\n );\n }\n\n const componentsDir = resolveUiDir(root);\n mkdirSync(componentsDir, { recursive: true });\n const isPresent = (component: string) =>\n existsSync(path.join(componentsDir, component));\n\n const skipped = overwrite ? [] : requested.filter(isPresent);\n const toInstall = requested.filter(\n (component) => !skipped.includes(component),\n );\n if (skipped.length > 0) {\n logger.info(`Already present: ${skipped.join(\", \")}`);\n }\n if (toInstall.length === 0) {\n return { installed: [], skipped, packages: [] };\n }\n\n const customToInstall = new Set(toInstall.filter(isCustomComponent));\n const publicToInstall = new Set(\n toInstall.filter((component) => !isCustomComponent(component)),\n );\n\n // Dependencies are added only when missing, even under `overwrite`:\n // re-adding `button` because `pagination` was re-added would clobber edits\n // the user never asked to lose.\n for (const component of [...customToInstall]) {\n for (const dependency of customDependencies[component] ?? []) {\n if (isPresent(dependency)) {\n continue;\n }\n if (isCustomComponent(dependency)) {\n customToInstall.add(dependency);\n } else {\n publicToInstall.add(dependency);\n }\n }\n }\n\n // `installPackages` keeps an existing @tanstack/table-core whatever its range.\n assertTableCorePackage(root, [...customToInstall]);\n\n const installed: string[] = [];\n const customList = [...customToInstall].sort();\n if (customList.length > 0) {\n logger.info(`Installing custom components: ${customList.join(\", \")}`);\n }\n for (const component of customList) {\n copyCustomComponent(component, componentsDir);\n installed.push(component);\n publicToInstall.delete(component);\n }\n\n const packages = await installPackages(\n root,\n customNpmPackagesFor(customList),\n runtime,\n logger,\n );\n\n const publicList = [...publicToInstall].sort();\n if (publicList.length > 0) {\n await assertKnownRegistryItems(root, publicList, runtime, logger);\n logger.info(\n `Installing shadcn-svelte components: ${publicList.join(\", \")}`,\n );\n // shadcn-svelte reads the tsconfig, whose `extends` an install may have pruned.\n await ensureSvelteKitSync(root, runtime, logger);\n // shadcn only records its packages; they are installed below, once any\n // pin it moved backwards is put back.\n const before = readPackageJson(root);\n await executeCommand(\n root,\n \"execute\",\n [\n \"shadcn-svelte\",\n \"add\",\n \"--yes\",\n \"--overwrite\",\n \"--no-deps-install\",\n ...publicList,\n ],\n runtime,\n );\n installed.push(...publicList);\n const after = readPackageJson(root);\n if (before && after && JSON.stringify(before) !== JSON.stringify(after)) {\n const { pkg, restored } = restoreDowngradedDependencies(\n before as DependencyBlocks,\n after as DependencyBlocks,\n );\n if (restored.length > 0) {\n logger.info(\n `Kept ${restored.join(\", \")} (shadcn-svelte asked for an older range)`,\n );\n const file = path.join(root, \"package.json\");\n const indent =\n readFileSync(file, \"utf8\").match(/^[{]\\s*\\n([\\t ]+)/)?.[1] ?? \"\\t\";\n writeFileSync(file, `${JSON.stringify(pkg, null, indent)}\\n`, \"utf8\");\n }\n const recorded = (pkg: Record<string, unknown>) =>\n new Set(\n DEPENDENCY_BLOCKS.flatMap((block) =>\n Object.keys((pkg[block] as Record<string, string>) ?? {}),\n ),\n );\n const had = recorded(before);\n const added = [...recorded(after)].filter((name) => !had.has(name));\n ensureFormsnapOverride(root, had, added, logger);\n await executeCommand(root, \"install\", [], runtime);\n }\n }\n\n const installedList = [...new Set(installed)].sort();\n await formatPaths(\n root,\n installedList.map((component) => path.join(componentsDir, component)),\n );\n\n return { installed: installedList, skipped, packages };\n}\n\nexport async function writeResult(\n result: Result,\n options: Options,\n runtime?: WriteResultRuntime,\n): Promise<Result> {\n const logger = getLogger(options);\n\n const writtenResult: Result = {\n creates: [],\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n };\n\n let dropMigrationCreates: Result[\"creates\"] = [];\n if (result.collectionDrops.length > 0) {\n const { dropCollections } = await import(\"./collections\");\n dropMigrationCreates = await dropCollections(\n result.collectionDrops,\n options,\n );\n }\n\n // A package.json edit lands before the package manager runs, so the install\n // builds on it. Written after, its content (read before the install) would\n // take back every dependency the install just recorded.\n const packageJsonPath = path.resolve(options.root, \"package.json\");\n const isPackageJson = (file: Result[\"modifies\"][number]) =>\n file.status === \"success\" &&\n path.resolve(toTargetPath(options.root, file.path)) === packageJsonPath;\n for (const file of result.modifies.filter(isPackageJson)) {\n writeFile(packageJsonPath, file.content);\n }\n\n const packageInstalls = await installPackages(\n options.root,\n result.packages,\n runtime,\n logger,\n );\n\n const componentInstalls = await installComponents(\n { root: options.root, components: result.components, logger },\n runtime,\n );\n\n const packageUninstalls = await uninstallPackages(\n options.root,\n result.uninstalls ?? [],\n runtime,\n logger,\n );\n\n for (const file of [...result.creates, ...dropMigrationCreates]) {\n if (file.status !== \"success\") {\n // A modifier that could not recognise the file it was asked to edit\n // reports `failed` / `not-found` with a paste-ready remediation snippet.\n // Nothing is written, but the entry has to survive into the result: this\n // loop used to `continue` before pushing, so the entry never reached the\n // caller at all and the snippet was lost. The pattern reported success\n // and simply said nothing about the file it had given up on.\n writtenResult.creates.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n const target = toTargetPath(options.root, file.path);\n if (!existsSync(target)) {\n writeFile(target, file.content);\n writtenResult.creates.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n if (readFileSync(target, \"utf8\") !== file.content) {\n writeFile(target, file.content);\n writtenResult.modifies.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n }\n }\n\n for (const file of result.modifies) {\n if (isPackageJson(file)) {\n writtenResult.modifies.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n if (file.status !== \"success\") {\n // Carried through unwritten, so the caller can report the failure. See\n // the note in the creates loop above.\n writtenResult.modifies.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n writeFile(toTargetPath(options.root, file.path), file.content);\n writtenResult.modifies.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n }\n\n for (const file of result.deletes) {\n if (file.status !== \"success\") {\n writtenResult.deletes.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n if (existsSync(toTargetPath(options.root, file.path))) {\n removeFile(toTargetPath(options.root, file.path), options.root);\n writtenResult.deletes.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n }\n }\n\n return {\n ...result,\n creates: writtenResult.creates,\n modifies: writtenResult.modifies,\n deletes: writtenResult.deletes,\n components: componentInstalls.installed,\n packages: [...new Set([...packageInstalls, ...componentInstalls.packages])],\n ...(packageUninstalls.length > 0 ? { uninstalls: packageUninstalls } : {}),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0DM+I,KAA+C;CACnD,aAAa,CAAC,OAAO;CACrB,aAAa;EAAC;EAAW;EAAW;CAAQ;CAC5C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+ export declare const ADAPTER_NODE = "@sveltejs/adapter-node@^6.0.0";
3
+
4
+ /** The adapter a static project builds with (`vela disable backend`). */
5
+ export declare const ADAPTER_STATIC = "@sveltejs/adapter-static@^4.0.0";
6
+
1
7
  /** Sets the base palette through `shadcn-svelte apply`. */
2
8
  export declare function applyBaseColor(options: ApplyBaseColorOptions, runtime?: WriteResultRuntime): Promise<ApplyColorsResult>;
3
9
 
@@ -1393,12 +1399,63 @@ declare interface CollectionSpec {
1393
1399
 
1394
1400
  export declare type Component = string;
1395
1401
 
1402
+ /** Add missing package.json `imports` entries; never overwrites a different value. */
1403
+ export declare function ensurePackageImports(root: string, entries: Record<string, string>): Promise<PackageJsonEditResult>;
1404
+
1405
+ /** Deep-merge package.json `overrides`; never overwrites a different version. */
1406
+ export declare function ensurePackageOverrides(root: string, overrides: Record<string, OverrideValue>): Promise<PackageJsonEditResult>;
1407
+
1408
+ /** Where SvelteKit 3 looks for the `variables` declarations, in order. */
1409
+ export declare const ENV_DECL_CANDIDATES: string[];
1410
+
1411
+ /**
1412
+ * One `NAME: { ... }` property, without a trailing comma. Nested lines are
1413
+ * indented with `indent`, one level deeper than the property itself.
1414
+ */
1415
+ export declare function envVarEntry(spec: EnvVarSpec, options?: {
1416
+ quote?: "'" | '"';
1417
+ indent?: string;
1418
+ }): string;
1419
+
1420
+ /**
1421
+ * A new `src/env.ts` declaring `specs`, written the way the CLI's templates
1422
+ * write theirs: tabs, single quotes, one documented `defineEnvVars` call.
1423
+ */
1424
+ export declare function envVarsFile(specs: EnvVarSpec[]): string;
1425
+
1426
+ /** One variable to declare in `src/env.ts`. */
1427
+ export declare interface EnvVarSpec {
1428
+ /** The variable's name, as `.env` and `$app/env/*` spell it. */
1429
+ name: string;
1430
+ /** Importable from `$app/env/public` (and so sent to the browser). */
1431
+ public?: boolean;
1432
+ /** Inlined at build time rather than read when the app starts. */
1433
+ static?: boolean;
1434
+ /**
1435
+ * Default `true`: declared with `schema: (value) => value ?? ''`, so a
1436
+ * missing value reads as `''` and the app builds and starts with an empty
1437
+ * `.env`. `false` leaves the schema out, which SvelteKit treats as required.
1438
+ */
1439
+ optional?: boolean;
1440
+ /** Shown on hover where the variable is imported. */
1441
+ description?: string;
1442
+ }
1443
+
1396
1444
  declare interface Example {
1397
1445
  command: string;
1398
1446
  description: string;
1399
1447
  }
1400
1448
 
1401
- declare type ExecuteCommand = (cwd: string, operation: PackageManagerOperation, args: string[]) => Promise<void>;
1449
+ /** `options` is passed only when set, so a seam may ignore it. */
1450
+ export declare type ExecuteCommand = (cwd: string, operation: PackageManagerOperation, args: string[], options?: ExecuteCommandOptions) => Promise<void>;
1451
+
1452
+ export declare interface ExecuteCommandOptions {
1453
+ /**
1454
+ * Save the exact version installed rather than a range (`--save-exact`,
1455
+ * or the package manager's equivalent). Set for specs that name one version.
1456
+ */
1457
+ exact?: boolean;
1458
+ }
1402
1459
 
1403
1460
  declare interface Features {
1404
1461
  auth: boolean;
@@ -1445,9 +1502,28 @@ declare interface File_2 {
1445
1502
  status: FileStatus;
1446
1503
  message?: string;
1447
1504
  }
1505
+ export { File_2 as File }
1448
1506
 
1449
1507
  declare type FileStatus = "success" | "failed" | "not-found";
1450
1508
 
1509
+ /** The flash-message release that supports SvelteKit 3; installed exactly, like superforms. */
1510
+ export declare const FLASH = "sveltekit-flash-message@3.0.0-next.0";
1511
+
1512
+ /** `file-form` and `multiselect` build on formsnap's field context. */
1513
+ export declare const FORMSNAP = "formsnap@^2.0.1";
1514
+
1515
+ /**
1516
+ * formsnap 2 peers `sveltekit-superforms ^2`, so every project that installs
1517
+ * it needs this npm override, or `npm install` fails with ERESOLVE. The value
1518
+ * is the literal version: `$sveltekit-superforms` breaks on npm 10.
1519
+ * `writeResult` adds it before any install that brings formsnap in.
1520
+ */
1521
+ export declare const FORMSNAP_OVERRIDES: {
1522
+ formsnap: {
1523
+ "sveltekit-superforms": string;
1524
+ };
1525
+ };
1526
+
1451
1527
  declare function generate(options: Options): Promise< Result>;
1452
1528
 
1453
1529
  /**
@@ -1488,6 +1564,47 @@ export declare class InvalidArgumentError extends Error {
1488
1564
  constructor(message: string);
1489
1565
  }
1490
1566
 
1567
+ /**
1568
+ * Whether `spec` imports `relPath` under `src/lib`: `#lib/x.js`, `#lib/x.ts`,
1569
+ * `#lib/x/index.js`, or the `$lib/x` a project from before SvelteKit 3 still
1570
+ * has. `relPath` is written either way (`site`, `site.ts`,
1571
+ * `components/ui/avatar`, `components/notifications-bell.svelte`).
1572
+ */
1573
+ export declare function isLibSpecifier(spec: string, relPath: string): boolean;
1574
+
1575
+ /**
1576
+ * The directory under `src/lib` a `components.json` alias names: `#lib` and
1577
+ * `#lib/components/ui` (what shadcn-svelte writes for a SvelteKit 3 project),
1578
+ * or the `$lib` forms of a project from before it. Aliases name directories,
1579
+ * so no extension is involved. `""` is `src/lib` itself; anything else (a
1580
+ * custom alias) is null.
1581
+ */
1582
+ export declare function libAliasPath(alias: string): string | null;
1583
+
1584
+ /** `isLibSpecifier` bound to one path, for the import helpers' module matchers. */
1585
+ export declare function libModule(relPath: string): (spec: string) => boolean;
1586
+
1587
+ /**
1588
+ * `#lib` specifiers, written the way `sv migrate sveltekit-3` (sv 1.0.1, the
1589
+ * `lib-alias` task) writes them. SvelteKit 3 drops `$lib`; projects map
1590
+ * `"#lib/*": "./src/lib/*"` in package.json `imports`, and Node subpath
1591
+ * imports don't add extensions or resolve directories, so every specifier
1592
+ * names the file the import loads:
1593
+ *
1594
+ * - a `.ts` or `.js` module gets `.js` (`site.ts` → `#lib/site.js`,
1595
+ * `x.svelte.ts` → `#lib/x.svelte.js`);
1596
+ * - a directory gets `/index.js` (`components/ui/button` →
1597
+ * `#lib/components/ui/button/index.js`);
1598
+ * - `.svelte`, `.svg`, `.svx`, `.css` and `.json` files keep their name.
1599
+ */
1600
+ /**
1601
+ * The `#lib` specifier for a path under `src/lib`. `rel` names a file by its
1602
+ * name on disk (`site.ts`, `components/app-sidebar.svelte`) or, when its last
1603
+ * segment has none of the extensions above, a directory imported through its
1604
+ * `index` (`components/ui/button`). `""` is `src/lib` itself: `#lib`.
1605
+ */
1606
+ export declare function libSpecifier(relPathUnderSrcLib: string): string;
1607
+
1491
1608
  /**
1492
1609
  * What a project has installed, what this package can copy in, and what the
1493
1610
  * configured style's registry offers. Node-only, loaded on first call like
@@ -1525,6 +1642,38 @@ export declare class MissingShadcnError extends Error {
1525
1642
  constructor(what: string);
1526
1643
  }
1527
1644
 
1645
+ /**
1646
+ * Declare `specs` in `src/env.ts` (or `src/env.js`); existing entries are
1647
+ * never touched. Without a declaration file, `create` holds a new
1648
+ * `src/env.ts` for the caller to write. An edited file is saved in place and
1649
+ * reported in `modify`; one that can't be edited safely fails with the
1650
+ * entries to paste.
1651
+ */
1652
+ export declare function modifyEnvVars(root: string, specs: EnvVarSpec[]): Promise<ModifyEnvVarsResult>;
1653
+
1654
+ export declare interface ModifyEnvVarsResult {
1655
+ /** `src/env.ts` to create, when the project has no declaration file. */
1656
+ create?: File_2;
1657
+ /** The existing declaration file, already saved when `outcome` changed it. */
1658
+ modify?: {
1659
+ filePath: string;
1660
+ outcome: ModifyOutcome;
1661
+ };
1662
+ }
1663
+
1664
+ export declare type ModifyOutcome = {
1665
+ status: "success";
1666
+ changed: boolean;
1667
+ } | {
1668
+ status: "failed";
1669
+ message: string;
1670
+ } | {
1671
+ status: "not-found";
1672
+ message: string;
1673
+ };
1674
+
1675
+ export declare const NEGOTIATE = "sveltekit-negotiate@^0.3.0";
1676
+
1528
1677
  export declare interface Options {
1529
1678
  argv: string[];
1530
1679
  env: "runtime" | "preview";
@@ -1579,6 +1728,11 @@ export declare interface Options {
1579
1728
  logger?: Logger;
1580
1729
  }
1581
1730
 
1731
+ /** An `overrides` value: a version, or nested overrides (npm's `"."` is the package itself). */
1732
+ export declare type OverrideValue = string | {
1733
+ [key: string]: OverrideValue;
1734
+ };
1735
+
1582
1736
  /**
1583
1737
  * An npm install spec: either a bare name (`wuchale`, `@wuchale/svelte`) or a
1584
1738
  * name with a range (`wuchale@^0.26.3`). Ranges pin what a pattern installs;
@@ -1586,6 +1740,18 @@ export declare interface Options {
1586
1740
  */
1587
1741
  export declare type Package = string;
1588
1742
 
1743
+ /**
1744
+ * Edits to the project's `package.json` that npm has no command for: the
1745
+ * `imports` map SvelteKit 3 resolves `#lib` (and `#locales`) through, and
1746
+ * `overrides`. The file is rewritten with the indentation and trailing
1747
+ * newline it had, and a key that already holds a different value is never
1748
+ * overwritten: it is the project's, and the outcome says what to change.
1749
+ */
1750
+ export declare interface PackageJsonEditResult {
1751
+ filePath: string;
1752
+ outcome: ModifyOutcome;
1753
+ }
1754
+
1589
1755
  declare type PackageManagerOperation = "execute" | "install" | "uninstall";
1590
1756
 
1591
1757
  export declare interface Pattern {
@@ -2942,8 +3108,20 @@ export declare interface ProviderEnvVar {
2942
3108
  * it back. Written to `.env` like any other value.
2943
3109
  */
2944
3110
  secret?: boolean;
3111
+ /**
3112
+ * Read in the browser: declared `public: true` in `src/env.ts`, so it is
3113
+ * imported from `$app/env/public`. SvelteKit 3 goes by this declaration,
3114
+ * not by a `PUBLIC_` prefix.
3115
+ */
3116
+ public?: boolean;
2945
3117
  }
2946
3118
 
3119
+ /**
3120
+ * The `src/env.ts` declarations for a provider's env vars: optional, so an
3121
+ * empty `.env` still builds, and public only where the provider says so.
3122
+ */
3123
+ export declare function providerEnvVars(provider: Provider): EnvVarSpec[];
3124
+
2947
3125
  /** `--provider <id>` or `--provider=<id>`, for callers that hand flags through in argv. */
2948
3126
  export declare function providerFromArgv(argv: string[]): string | undefined;
2949
3127
 
@@ -2967,6 +3145,12 @@ export declare class RegistryUnavailableError extends Error {
2967
3145
  constructor(url: string, reason: string);
2968
3146
  }
2969
3147
 
3148
+ /**
3149
+ * Remove package.json `imports` keys (only those still equal to `expected`,
3150
+ * when given), dropping an `imports` left empty.
3151
+ */
3152
+ export declare function removePackageImports(root: string, keys: string[], expected?: Record<string, string>): Promise<PackageJsonEditResult>;
3153
+
2970
3154
  /**
2971
3155
  * The provider a generate call should produce, from `input.provider` or
2972
3156
  * `--provider` in argv.
@@ -3008,6 +3192,19 @@ declare interface RouteGroups {
3008
3192
 
3009
3193
  export declare type Slug = PatternEntry["slug"];
3010
3194
 
3195
+ /**
3196
+ * What a generated superforms page needs. Vela's templates already carry
3197
+ * both; a project vela did not create may have neither.
3198
+ */
3199
+ export declare const SUPERFORMS = "sveltekit-superforms@3.0.0-next.1";
3200
+
3201
+ /**
3202
+ * The superforms release that supports SvelteKit 3 (its `latest` accepts
3203
+ * only Kit 1 and 2). Installed exactly, not with a caret: a caret on a
3204
+ * prerelease would follow later `next` builds.
3205
+ */
3206
+ export declare const SUPERFORMS_VERSION = "3.0.0-next.1";
3207
+
3011
3208
  /** Moves a project to another shadcn-svelte style, re-adding its registry components. */
3012
3209
  export declare function switchStyle(options: SwitchStyleOptions, runtime?: WriteResultRuntime): Promise<SwitchStyleResult>;
3013
3210
 
@@ -3045,6 +3242,32 @@ export declare interface SwitchStyleResult {
3045
3242
 
3046
3243
  export declare function unknownProviderMessage(name: string, raw: string, providers: Provider[]): string;
3047
3244
 
3245
+ /**
3246
+ * Remove the declarations of `names` from `src/env.ts`. `deleted` means only
3247
+ * the import and an empty `variables` are left (the emptied file is saved;
3248
+ * delete it).
3249
+ */
3250
+ export declare function unmodifyEnvVars(root: string, names: string[]): Promise<UnmodifyEnvVarsResult>;
3251
+
3252
+ export declare interface UnmodifyEnvVarsResult {
3253
+ filePath: string;
3254
+ outcome: ModifyOutcome;
3255
+ /**
3256
+ * The revert left nothing but the `defineEnvVars` import and an empty
3257
+ * `variables`. The emptied file has been saved; the caller reports it as a
3258
+ * delete (`toDeleteEntry(filePath)`) instead of a modify, as
3259
+ * {@link unmodifyEnvVarsFiles} does.
3260
+ */
3261
+ deleted: boolean;
3262
+ }
3263
+
3264
+ export declare const VELASTACK_CMS = "@velastack/cms@^0.6.0";
3265
+
3266
+ /** The VelaStack libraries' SvelteKit 3 releases. */
3267
+ export declare const VELASTACK_KIT = "@velastack/kit@^0.4.0";
3268
+
3269
+ export declare const VELASTACK_POCKETBASE = "@velastack/pocketbase@^0.4.0";
3270
+
3048
3271
  export declare const version: string;
3049
3272
 
3050
3273
  /**