@powerlines/plugin-alloy 0.19.13 → 0.19.14

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 (377) hide show
  1. package/dist/builtin-file-BJKPEOF7.mjs +62 -0
  2. package/dist/builtin-file-BJKPEOF7.mjs.map +1 -0
  3. package/dist/builtin-file-BghS0Iup.cjs +67 -0
  4. package/dist/builtin-file-CiW4-UYI.d.mts +35 -0
  5. package/dist/builtin-file-CiW4-UYI.d.mts.map +1 -0
  6. package/dist/builtin-file-DLGZvvC3.d.cts +35 -0
  7. package/dist/builtin-file-DLGZvvC3.d.cts.map +1 -0
  8. package/dist/builtin-file-Dj3eVgvv.d.cts +35 -0
  9. package/dist/builtin-file-Dj3eVgvv.d.cts.map +1 -0
  10. package/dist/builtin-file-RXdRpQs-.d.mts +35 -0
  11. package/dist/builtin-file-RXdRpQs-.d.mts.map +1 -0
  12. package/dist/capnp-CRMDa2Ok.d.mts +88 -0
  13. package/dist/capnp-CRMDa2Ok.d.mts.map +1 -0
  14. package/dist/capnp-ClfqI-5t.cjs +356 -0
  15. package/dist/capnp-CnQcwo0s.mjs +260 -0
  16. package/dist/capnp-CnQcwo0s.mjs.map +1 -0
  17. package/dist/capnp-YnGBPkLK.d.cts +88 -0
  18. package/dist/capnp-YnGBPkLK.d.cts.map +1 -0
  19. package/dist/{_virtual/rolldown_runtime.cjs → chunk-CbDLau6x.cjs} +6 -1
  20. package/dist/components-B0evB5xd.cjs +0 -0
  21. package/dist/components-BNK9p5AE.cjs +0 -0
  22. package/dist/components-C_Rnle_h.mjs +1 -0
  23. package/dist/components-CpjG2zC9.mjs +1 -0
  24. package/dist/components-CrWk5KiP.mjs +1 -0
  25. package/dist/components-CyQi7RHT.mjs +1 -0
  26. package/dist/components-DPKSrvP-.cjs +0 -0
  27. package/dist/components-IRVnipN0.d.cts +143 -0
  28. package/dist/components-IRVnipN0.d.cts.map +1 -0
  29. package/dist/components-ISRFDWTF.cjs +0 -0
  30. package/dist/components-oHSM7vmp.d.mts +143 -0
  31. package/dist/components-oHSM7vmp.d.mts.map +1 -0
  32. package/dist/context-AhzykdKC.mjs +51 -0
  33. package/dist/context-AhzykdKC.mjs.map +1 -0
  34. package/dist/context-Ctw077Cx.cjs +79 -0
  35. package/dist/context-Du_bVzRZ.d.mts +67 -0
  36. package/dist/context-Du_bVzRZ.d.mts.map +1 -0
  37. package/dist/context-Gqs3Ru42.d.cts +67 -0
  38. package/dist/context-Gqs3Ru42.d.cts.map +1 -0
  39. package/dist/contexts-DezKayEz.cjs +0 -0
  40. package/dist/contexts-J643Nrrt.cjs +0 -0
  41. package/dist/contexts-_jq-yJQG.mjs +1 -0
  42. package/dist/contexts-juWSyBfb.mjs +1 -0
  43. package/dist/core/components/index.cjs +11 -6
  44. package/dist/core/components/index.d.cts +6 -3
  45. package/dist/core/components/index.d.mts +6 -3
  46. package/dist/core/components/index.mjs +8 -3
  47. package/dist/core/components/output.cjs +2 -32
  48. package/dist/core/components/output.d.cts +2 -22
  49. package/dist/core/components/output.d.mts +2 -22
  50. package/dist/core/components/output.mjs +1 -30
  51. package/dist/core/components/single-line-comment.cjs +2 -21
  52. package/dist/core/components/single-line-comment.d.cts +2 -21
  53. package/dist/core/components/single-line-comment.d.mts +2 -21
  54. package/dist/core/components/single-line-comment.mjs +1 -19
  55. package/dist/core/components/source-file.cjs +6 -63
  56. package/dist/core/components/source-file.d.cts +2 -31
  57. package/dist/core/components/source-file.d.mts +2 -31
  58. package/dist/core/components/source-file.mjs +5 -60
  59. package/dist/core/contexts/context.cjs +7 -53
  60. package/dist/core/contexts/context.d.cts +1 -65
  61. package/dist/core/contexts/context.d.mts +1 -65
  62. package/dist/core/contexts/context.mjs +2 -48
  63. package/dist/core/contexts/index.cjs +17 -15
  64. package/dist/core/contexts/index.d.cts +4 -2
  65. package/dist/core/contexts/index.d.mts +4 -2
  66. package/dist/core/contexts/index.mjs +4 -2
  67. package/dist/core/contexts/reflection.cjs +9 -67
  68. package/dist/core/contexts/reflection.d.cts +2 -51
  69. package/dist/core/contexts/reflection.d.mts +2 -51
  70. package/dist/core/contexts/reflection.mjs +1 -58
  71. package/dist/core/index.cjs +24 -23
  72. package/dist/core/index.d.cts +8 -7
  73. package/dist/core/index.d.mts +8 -7
  74. package/dist/core/index.mjs +8 -7
  75. package/dist/create-builtin-BiKyN2s2.cjs +24 -0
  76. package/dist/create-builtin-DFiWd6Zc.d.cts +16 -0
  77. package/dist/create-builtin-DFiWd6Zc.d.cts.map +1 -0
  78. package/dist/create-builtin-DQuJyeZw.mjs +19 -0
  79. package/dist/create-builtin-DQuJyeZw.mjs.map +1 -0
  80. package/dist/create-builtin-FtQ6qKzX.d.mts +16 -0
  81. package/dist/create-builtin-FtQ6qKzX.d.mts.map +1 -0
  82. package/dist/dynamic-import-statement-B5Pdwr4Z.d.mts +33 -0
  83. package/dist/dynamic-import-statement-B5Pdwr4Z.d.mts.map +1 -0
  84. package/dist/dynamic-import-statement-BbNJchii.mjs +25 -0
  85. package/dist/dynamic-import-statement-BbNJchii.mjs.map +1 -0
  86. package/dist/dynamic-import-statement-DNJlI3ND.d.cts +33 -0
  87. package/dist/dynamic-import-statement-DNJlI3ND.d.cts.map +1 -0
  88. package/dist/dynamic-import-statement-Dy_MY_Ua.cjs +30 -0
  89. package/dist/dynamic-import-statement-vVM9osmC.d.cts +33 -0
  90. package/dist/dynamic-import-statement-vVM9osmC.d.cts.map +1 -0
  91. package/dist/entry-file-BFHFm7wA.cjs +47 -0
  92. package/dist/entry-file-CiMuxu2n.d.mts +28 -0
  93. package/dist/entry-file-CiMuxu2n.d.mts.map +1 -0
  94. package/dist/entry-file-CjhBCFEa.d.cts +28 -0
  95. package/dist/entry-file-CjhBCFEa.d.cts.map +1 -0
  96. package/dist/entry-file-DT_UunNT.mjs +41 -0
  97. package/dist/entry-file-DT_UunNT.mjs.map +1 -0
  98. package/dist/entry-file-Zt33JaE1.d.cts +28 -0
  99. package/dist/entry-file-Zt33JaE1.d.cts.map +1 -0
  100. package/dist/entry-file-ayzYWEo5.d.mts +28 -0
  101. package/dist/entry-file-ayzYWEo5.d.mts.map +1 -0
  102. package/dist/front-matter-2eGRXX11.mjs +28 -0
  103. package/dist/front-matter-2eGRXX11.mjs.map +1 -0
  104. package/dist/front-matter-DGpkM9OE.d.mts +16 -0
  105. package/dist/front-matter-DGpkM9OE.d.mts.map +1 -0
  106. package/dist/front-matter-DSp4xPaD.d.cts +16 -0
  107. package/dist/front-matter-DSp4xPaD.d.cts.map +1 -0
  108. package/dist/front-matter-DZ1tB-Uj.cjs +33 -0
  109. package/dist/front-matter-u9H7VPAF.d.cts +16 -0
  110. package/dist/front-matter-u9H7VPAF.d.cts.map +1 -0
  111. package/dist/helpers/capnp.cjs +18 -276
  112. package/dist/helpers/capnp.d.cts +1 -86
  113. package/dist/helpers/capnp.d.mts +1 -86
  114. package/dist/helpers/capnp.mjs +1 -257
  115. package/dist/helpers/create-builtin.cjs +2 -18
  116. package/dist/helpers/create-builtin.d.cts +1 -14
  117. package/dist/helpers/create-builtin.d.mts +1 -14
  118. package/dist/helpers/create-builtin.mjs +1 -16
  119. package/dist/helpers/index.cjs +23 -23
  120. package/dist/helpers/index.d.cts +4 -4
  121. package/dist/helpers/index.d.mts +4 -4
  122. package/dist/helpers/index.mjs +4 -4
  123. package/dist/helpers/refkey.cjs +2 -15
  124. package/dist/helpers/refkey.d.cts +1 -12
  125. package/dist/helpers/refkey.d.mts +1 -12
  126. package/dist/helpers/refkey.mjs +1 -13
  127. package/dist/helpers/typescript.cjs +2 -45
  128. package/dist/helpers/typescript.d.cts +1 -24
  129. package/dist/helpers/typescript.d.mts +1 -24
  130. package/dist/helpers/typescript.mjs +1 -43
  131. package/dist/index-B-Y-ZG2x.d.mts +1 -0
  132. package/dist/index-BH1nuHdZ.d.cts +1 -0
  133. package/dist/index-BUYyA1Xh.d.cts +1 -0
  134. package/dist/index-C-lwXyQ6.d.mts +1 -0
  135. package/dist/index-C6HcjJiY.d.mts +1 -0
  136. package/dist/index-C6yvNuzO.d.cts +1 -0
  137. package/dist/index-CrhZaFgN.d.cts +1 -0
  138. package/dist/index-CzItj62a.d.mts +1 -0
  139. package/dist/index-DcDTDbdz.d.cts +1 -0
  140. package/dist/index-hcx6LMSC.d.mts +1 -0
  141. package/dist/index.cjs +5 -5
  142. package/dist/index.d.cts +3 -2
  143. package/dist/index.d.cts.map +1 -0
  144. package/dist/index.d.mts +3 -2
  145. package/dist/index.d.mts.map +1 -0
  146. package/dist/index.mjs +4 -3
  147. package/dist/index.mjs.map +1 -0
  148. package/dist/markdown/components/front-matter.cjs +2 -27
  149. package/dist/markdown/components/front-matter.d.cts +1 -14
  150. package/dist/markdown/components/front-matter.d.mts +1 -14
  151. package/dist/markdown/components/front-matter.mjs +1 -25
  152. package/dist/markdown/components/index.cjs +17 -9
  153. package/dist/markdown/components/index.d.cts +7 -3
  154. package/dist/markdown/components/index.d.mts +7 -3
  155. package/dist/markdown/components/index.mjs +11 -3
  156. package/dist/markdown/components/markdown-file.cjs +10 -130
  157. package/dist/markdown/components/markdown-file.d.cts +4 -27
  158. package/dist/markdown/components/markdown-file.d.mts +4 -27
  159. package/dist/markdown/components/markdown-file.mjs +8 -127
  160. package/dist/markdown/components/markdown-table.cjs +5 -100
  161. package/dist/markdown/components/markdown-table.d.cts +3 -26
  162. package/dist/markdown/components/markdown-table.d.mts +3 -26
  163. package/dist/markdown/components/markdown-table.mjs +2 -96
  164. package/dist/markdown/contexts/index.cjs +6 -5
  165. package/dist/markdown/contexts/index.d.cts +2 -1
  166. package/dist/markdown/contexts/index.d.mts +2 -1
  167. package/dist/markdown/contexts/index.mjs +2 -1
  168. package/dist/markdown/contexts/markdown-table.cjs +5 -36
  169. package/dist/markdown/contexts/markdown-table.d.cts +1 -36
  170. package/dist/markdown/contexts/markdown-table.d.mts +1 -36
  171. package/dist/markdown/contexts/markdown-table.mjs +1 -31
  172. package/dist/markdown/index.cjs +22 -16
  173. package/dist/markdown/index.d.cts +8 -6
  174. package/dist/markdown/index.d.mts +8 -6
  175. package/dist/markdown/index.mjs +12 -6
  176. package/dist/markdown-file-CIGTz9xQ.d.cts +29 -0
  177. package/dist/markdown-file-CIGTz9xQ.d.cts.map +1 -0
  178. package/dist/markdown-file-CIwA46L3.mjs +130 -0
  179. package/dist/markdown-file-CIwA46L3.mjs.map +1 -0
  180. package/dist/markdown-file-DB2SAeE6.d.mts +29 -0
  181. package/dist/markdown-file-DB2SAeE6.d.mts.map +1 -0
  182. package/dist/markdown-file-DH7NDYYC.cjs +141 -0
  183. package/dist/markdown-file-EtJaVhJ3.d.mts +29 -0
  184. package/dist/markdown-file-EtJaVhJ3.d.mts.map +1 -0
  185. package/dist/markdown-file-gCQMRXoz.d.cts +29 -0
  186. package/dist/markdown-file-gCQMRXoz.d.cts.map +1 -0
  187. package/dist/markdown-table-AoJIzA89.d.cts +28 -0
  188. package/dist/markdown-table-AoJIzA89.d.cts.map +1 -0
  189. package/dist/markdown-table-B2ysbgWK.d.cts +28 -0
  190. package/dist/markdown-table-B2ysbgWK.d.cts.map +1 -0
  191. package/dist/markdown-table-BWPm6GbJ.cjs +57 -0
  192. package/dist/markdown-table-Br2Ihl2z.d.cts +38 -0
  193. package/dist/markdown-table-Br2Ihl2z.d.cts.map +1 -0
  194. package/dist/markdown-table-CFL7L6rA.d.mts +38 -0
  195. package/dist/markdown-table-CFL7L6rA.d.mts.map +1 -0
  196. package/dist/markdown-table-CJ9QJzAc.d.mts +28 -0
  197. package/dist/markdown-table-CJ9QJzAc.d.mts.map +1 -0
  198. package/dist/markdown-table-ChvYobzz.d.mts +28 -0
  199. package/dist/markdown-table-ChvYobzz.d.mts.map +1 -0
  200. package/dist/markdown-table-D3DonpwR.mjs +99 -0
  201. package/dist/markdown-table-D3DonpwR.mjs.map +1 -0
  202. package/dist/markdown-table-eTnxxb46.cjs +116 -0
  203. package/dist/markdown-table-g6DeP10e.mjs +34 -0
  204. package/dist/markdown-table-g6DeP10e.mjs.map +1 -0
  205. package/dist/output-CMC94bm-.d.mts +24 -0
  206. package/dist/output-CMC94bm-.d.mts.map +1 -0
  207. package/dist/output-CQXrGP3y.cjs +38 -0
  208. package/dist/output-D3UQ5nZo.mjs +33 -0
  209. package/dist/output-D3UQ5nZo.mjs.map +1 -0
  210. package/dist/output-Dq1RRbJY.d.cts +24 -0
  211. package/dist/output-Dq1RRbJY.d.cts.map +1 -0
  212. package/dist/output-MJnqpeJ-.d.mts +24 -0
  213. package/dist/output-MJnqpeJ-.d.mts.map +1 -0
  214. package/dist/plugin-B8wUxSXi.cjs +0 -0
  215. package/dist/plugin-BmQ6pIes.mjs +1 -0
  216. package/dist/plugin-C6SupJ8C.d.cts +41 -0
  217. package/dist/plugin-C6SupJ8C.d.cts.map +1 -0
  218. package/dist/plugin-bEu9fq1G.d.mts +41 -0
  219. package/dist/plugin-bEu9fq1G.d.mts.map +1 -0
  220. package/dist/record-expression-6ElbFyR0.cjs +17 -0
  221. package/dist/record-expression-BjXMzi4r.mjs +12 -0
  222. package/dist/record-expression-BjXMzi4r.mjs.map +1 -0
  223. package/dist/record-expression-adlQJuNw.d.cts +13 -0
  224. package/dist/record-expression-adlQJuNw.d.cts.map +1 -0
  225. package/dist/record-expression-c9kQA93k.d.mts +13 -0
  226. package/dist/record-expression-c9kQA93k.d.mts.map +1 -0
  227. package/dist/refkey-Bf_2_U5t.d.cts +14 -0
  228. package/dist/refkey-Bf_2_U5t.d.cts.map +1 -0
  229. package/dist/refkey-C08kDOQ0.cjs +21 -0
  230. package/dist/refkey-CIFiGvgZ.mjs +16 -0
  231. package/dist/refkey-CIFiGvgZ.mjs.map +1 -0
  232. package/dist/refkey-CSZgFc0P.d.mts +14 -0
  233. package/dist/refkey-CSZgFc0P.d.mts.map +1 -0
  234. package/dist/reflection-B-NMNIoB.mjs +61 -0
  235. package/dist/reflection-B-NMNIoB.mjs.map +1 -0
  236. package/dist/reflection-CUo0047e.d.mts +53 -0
  237. package/dist/reflection-CUo0047e.d.mts.map +1 -0
  238. package/dist/reflection-DHpdhvwI.cjs +108 -0
  239. package/dist/reflection-xU09ifzp.d.cts +53 -0
  240. package/dist/reflection-xU09ifzp.d.cts.map +1 -0
  241. package/dist/single-line-comment-BrtGpc8-.d.cts +23 -0
  242. package/dist/single-line-comment-BrtGpc8-.d.cts.map +1 -0
  243. package/dist/single-line-comment-Bvbr--Az.d.mts +23 -0
  244. package/dist/single-line-comment-Bvbr--Az.d.mts.map +1 -0
  245. package/dist/single-line-comment-COZ9RWsm.cjs +27 -0
  246. package/dist/single-line-comment-CQW1en2Z.d.cts +23 -0
  247. package/dist/single-line-comment-CQW1en2Z.d.cts.map +1 -0
  248. package/dist/single-line-comment-PMv_zrfe.d.mts +23 -0
  249. package/dist/single-line-comment-PMv_zrfe.d.mts.map +1 -0
  250. package/dist/single-line-comment-mOQtfhWt.mjs +22 -0
  251. package/dist/single-line-comment-mOQtfhWt.mjs.map +1 -0
  252. package/dist/source-file-BAoqxO5e.cjs +68 -0
  253. package/dist/source-file-BEY3mjFl.d.mts +33 -0
  254. package/dist/source-file-BEY3mjFl.d.mts.map +1 -0
  255. package/dist/source-file-BKZQpz0C.mjs +62 -0
  256. package/dist/source-file-BKZQpz0C.mjs.map +1 -0
  257. package/dist/source-file-BTsyACav.d.cts +33 -0
  258. package/dist/source-file-BTsyACav.d.cts.map +1 -0
  259. package/dist/source-file-CQl0UCgf.d.mts +33 -0
  260. package/dist/source-file-CQl0UCgf.d.mts.map +1 -0
  261. package/dist/source-file-QiALwKWL.d.cts +33 -0
  262. package/dist/source-file-QiALwKWL.d.cts.map +1 -0
  263. package/dist/tsdoc-BNV-5Qs2.mjs +466 -0
  264. package/dist/tsdoc-BNV-5Qs2.mjs.map +1 -0
  265. package/dist/tsdoc-CfvwK4Ml.d.cts +164 -0
  266. package/dist/tsdoc-CfvwK4Ml.d.cts.map +1 -0
  267. package/dist/tsdoc-OUuKjTbh.d.mts +164 -0
  268. package/dist/tsdoc-OUuKjTbh.d.mts.map +1 -0
  269. package/dist/tsdoc-nrR7IU_7.cjs +585 -0
  270. package/dist/tsdoc-reflection-BkVddZ_o.cjs +193 -0
  271. package/dist/tsdoc-reflection-C7_a06TL.mjs +176 -0
  272. package/dist/tsdoc-reflection-C7_a06TL.mjs.map +1 -0
  273. package/dist/tsdoc-reflection-DaykPe3v.d.cts +19 -0
  274. package/dist/tsdoc-reflection-DaykPe3v.d.cts.map +1 -0
  275. package/dist/tsdoc-reflection-Dggzpjh7.d.cts +19 -0
  276. package/dist/tsdoc-reflection-Dggzpjh7.d.cts.map +1 -0
  277. package/dist/tsdoc-reflection-ulqYHfKL.d.mts +19 -0
  278. package/dist/tsdoc-reflection-ulqYHfKL.d.mts.map +1 -0
  279. package/dist/types/components.cjs +1 -0
  280. package/dist/types/components.d.cts +1 -141
  281. package/dist/types/components.d.mts +1 -141
  282. package/dist/types/components.mjs +2 -0
  283. package/dist/types/index.cjs +2 -0
  284. package/dist/types/index.d.cts +2 -2
  285. package/dist/types/index.d.mts +2 -2
  286. package/dist/types/index.mjs +3 -0
  287. package/dist/types/plugin.cjs +1 -0
  288. package/dist/types/plugin.d.cts +1 -39
  289. package/dist/types/plugin.d.mts +1 -39
  290. package/dist/types/plugin.mjs +2 -0
  291. package/dist/typescript/components/builtin-file.cjs +10 -61
  292. package/dist/typescript/components/builtin-file.d.cts +5 -33
  293. package/dist/typescript/components/builtin-file.d.mts +5 -33
  294. package/dist/typescript/components/builtin-file.mjs +9 -59
  295. package/dist/typescript/components/dynamic-import-statement.cjs +2 -24
  296. package/dist/typescript/components/dynamic-import-statement.d.cts +1 -31
  297. package/dist/typescript/components/dynamic-import-statement.d.mts +1 -31
  298. package/dist/typescript/components/dynamic-import-statement.mjs +1 -22
  299. package/dist/typescript/components/entry-file.cjs +9 -41
  300. package/dist/typescript/components/entry-file.d.cts +4 -26
  301. package/dist/typescript/components/entry-file.d.mts +4 -26
  302. package/dist/typescript/components/entry-file.mjs +8 -38
  303. package/dist/typescript/components/index.cjs +50 -43
  304. package/dist/typescript/components/index.d.cts +12 -9
  305. package/dist/typescript/components/index.d.mts +12 -9
  306. package/dist/typescript/components/index.mjs +16 -9
  307. package/dist/typescript/components/record-expression.cjs +2 -11
  308. package/dist/typescript/components/record-expression.d.cts +1 -11
  309. package/dist/typescript/components/record-expression.d.mts +1 -11
  310. package/dist/typescript/components/record-expression.mjs +1 -9
  311. package/dist/typescript/components/tsdoc-reflection.cjs +8 -177
  312. package/dist/typescript/components/tsdoc-reflection.d.cts +3 -17
  313. package/dist/typescript/components/tsdoc-reflection.d.mts +3 -17
  314. package/dist/typescript/components/tsdoc-reflection.mjs +5 -173
  315. package/dist/typescript/components/tsdoc.cjs +23 -484
  316. package/dist/typescript/components/tsdoc.d.cts +2 -162
  317. package/dist/typescript/components/tsdoc.d.mts +2 -162
  318. package/dist/typescript/components/tsdoc.mjs +3 -463
  319. package/dist/typescript/components/typescript-file.cjs +10 -215
  320. package/dist/typescript/components/typescript-file.d.cts +3 -48
  321. package/dist/typescript/components/typescript-file.d.mts +3 -48
  322. package/dist/typescript/components/typescript-file.mjs +7 -211
  323. package/dist/typescript/components/typescript-interface.cjs +8 -72
  324. package/dist/typescript/components/typescript-interface.d.cts +2 -24
  325. package/dist/typescript/components/typescript-interface.d.mts +2 -24
  326. package/dist/typescript/components/typescript-interface.mjs +6 -69
  327. package/dist/typescript/components/typescript-object.cjs +8 -124
  328. package/dist/typescript/components/typescript-object.d.cts +2 -28
  329. package/dist/typescript/components/typescript-object.d.mts +2 -28
  330. package/dist/typescript/components/typescript-object.mjs +6 -121
  331. package/dist/typescript/index.cjs +50 -44
  332. package/dist/typescript/index.d.cts +12 -10
  333. package/dist/typescript/index.d.mts +12 -10
  334. package/dist/typescript/index.mjs +16 -10
  335. package/dist/typescript-BCc7kwL_.mjs +46 -0
  336. package/dist/typescript-BCc7kwL_.mjs.map +1 -0
  337. package/dist/typescript-BbjCTT04.cjs +51 -0
  338. package/dist/typescript-DWzPF4n4.d.mts +26 -0
  339. package/dist/typescript-DWzPF4n4.d.mts.map +1 -0
  340. package/dist/typescript-file-BDYo1D2p.d.cts +50 -0
  341. package/dist/typescript-file-BDYo1D2p.d.cts.map +1 -0
  342. package/dist/typescript-file-BWaBMfMr.d.mts +50 -0
  343. package/dist/typescript-file-BWaBMfMr.d.mts.map +1 -0
  344. package/dist/typescript-file-Bi5NEAOC.d.mts +50 -0
  345. package/dist/typescript-file-Bi5NEAOC.d.mts.map +1 -0
  346. package/dist/typescript-file-CFy1OsoL.mjs +214 -0
  347. package/dist/typescript-file-CFy1OsoL.mjs.map +1 -0
  348. package/dist/typescript-file-Ca-6MeqN.cjs +231 -0
  349. package/dist/typescript-file-fOVF6YF2.d.cts +50 -0
  350. package/dist/typescript-file-fOVF6YF2.d.cts.map +1 -0
  351. package/dist/typescript-interface-CilM16if.d.mts +26 -0
  352. package/dist/typescript-interface-CilM16if.d.mts.map +1 -0
  353. package/dist/typescript-interface-Dmvkz1pt.d.cts +26 -0
  354. package/dist/typescript-interface-Dmvkz1pt.d.cts.map +1 -0
  355. package/dist/typescript-interface-MV4qwTHs.d.mts +26 -0
  356. package/dist/typescript-interface-MV4qwTHs.d.mts.map +1 -0
  357. package/dist/typescript-interface-WicKnDB9.mjs +72 -0
  358. package/dist/typescript-interface-WicKnDB9.mjs.map +1 -0
  359. package/dist/typescript-interface-Zf9pVXoI.cjs +83 -0
  360. package/dist/typescript-o4AsClkT.d.cts +26 -0
  361. package/dist/typescript-o4AsClkT.d.cts.map +1 -0
  362. package/dist/typescript-object-A5_fPqKr.d.cts +30 -0
  363. package/dist/typescript-object-A5_fPqKr.d.cts.map +1 -0
  364. package/dist/typescript-object-BNmRVXfj.mjs +124 -0
  365. package/dist/typescript-object-BNmRVXfj.mjs.map +1 -0
  366. package/dist/typescript-object-Bi7HOz2C.d.mts +30 -0
  367. package/dist/typescript-object-Bi7HOz2C.d.mts.map +1 -0
  368. package/dist/typescript-object-C4WhCkui.cjs +135 -0
  369. package/dist/typescript-object-C7p9fJBF.d.mts +30 -0
  370. package/dist/typescript-object-C7p9fJBF.d.mts.map +1 -0
  371. package/dist/typescript-object-v1WiBD8W.d.cts +30 -0
  372. package/dist/typescript-object-v1WiBD8W.d.cts.map +1 -0
  373. package/dist/unctx-B3g_fMrS.cjs +13 -0
  374. package/dist/{internal/unctx.mjs → unctx-RT0xjVBl.mjs} +2 -1
  375. package/dist/unctx-RT0xjVBl.mjs.map +1 -0
  376. package/package.json +6 -6
  377. package/dist/internal/unctx.cjs +0 -8
@@ -1,12 +1,18 @@
1
- import { TSDoc, TSDocAlias, TSDocAttributesTags, TSDocDefaultValue, TSDocDomain, TSDocExample, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocParam, TSDocParams, TSDocPermission, TSDocReadonly, TSDocRemarks, TSDocReturns, TSDocTag, TSDocThrows, TSDocTitle } from "./components/tsdoc.mjs";
2
- import { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports } from "./components/typescript-file.mjs";
3
- import { BuiltinFile } from "./components/builtin-file.mjs";
4
- import { DynamicImportStatement } from "./components/dynamic-import-statement.mjs";
5
- import { EntryFile } from "./components/entry-file.mjs";
6
- import { RecordExpression } from "./components/record-expression.mjs";
7
- import { TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty } from "./components/tsdoc-reflection.mjs";
8
- import { TypeScriptInterface, TypescriptInterfaceProperty } from "./components/typescript-interface.mjs";
9
- import { TypescriptObject, TypescriptObjectProperty } from "./components/typescript-object.mjs";
10
- import "./components/index.mjs";
1
+ import "../unctx-RT0xjVBl.mjs";
2
+ import "../single-line-comment-mOQtfhWt.mjs";
3
+ import "../context-AhzykdKC.mjs";
4
+ import "../reflection-B-NMNIoB.mjs";
5
+ import "../contexts-juWSyBfb.mjs";
6
+ import "../source-file-BKZQpz0C.mjs";
7
+ import { _ as TSDocReturns, a as TSDocDomain, b as TSDocTitle, c as TSDocIgnore, d as TSDocModule, f as TSDocParam, g as TSDocRemarks, h as TSDocReadonly, i as TSDocDefaultValue, l as TSDocInternal, m as TSDocPermission, n as TSDocAlias, o as TSDocExample, p as TSDocParams, r as TSDocAttributesTags, s as TSDocHidden, t as TSDoc, u as TSDocLink, v as TSDocTag, y as TSDocThrows } from "../tsdoc-BNV-5Qs2.mjs";
8
+ import { n as TypescriptFileHeader, r as TypescriptFileHeaderImports, t as TypescriptFile } from "../typescript-file-CFy1OsoL.mjs";
9
+ import { t as BuiltinFile } from "../builtin-file-BJKPEOF7.mjs";
10
+ import { t as DynamicImportStatement } from "../dynamic-import-statement-BbNJchii.mjs";
11
+ import { t as EntryFile } from "../entry-file-DT_UunNT.mjs";
12
+ import { t as RecordExpression } from "../record-expression-BjXMzi4r.mjs";
13
+ import { n as TSDocReflectionMethod, r as TSDocReflectionProperty, t as TSDocReflectionClass } from "../tsdoc-reflection-C7_a06TL.mjs";
14
+ import { n as TypescriptInterfaceProperty, t as TypeScriptInterface } from "../typescript-interface-WicKnDB9.mjs";
15
+ import { n as TypescriptObjectProperty, t as TypescriptObject } from "../typescript-object-BNmRVXfj.mjs";
16
+ import "../components-C_Rnle_h.mjs";
11
17
 
12
18
  export { BuiltinFile, DynamicImportStatement, EntryFile, RecordExpression, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocDefaultValue, TSDocDomain, TSDocExample, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocParam, TSDocParams, TSDocPermission, TSDocReadonly, TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty, TSDocRemarks, TSDocReturns, TSDocTag, TSDocThrows, TSDocTitle, TypeScriptInterface, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptInterfaceProperty, TypescriptObject, TypescriptObjectProperty };
@@ -0,0 +1,46 @@
1
+ import { stringifyValue } from "@powerlines/deepkit/utilities";
2
+ import { camelCase } from "@stryke/string-format/camel-case";
3
+ import { titleCase } from "@stryke/string-format/title-case";
4
+ import { isUndefined } from "@stryke/type-checks/is-undefined";
5
+
6
+ //#region src/helpers/typescript.ts
7
+ /**
8
+ * Generates a TypeScript object for the given reflection class.
9
+ *
10
+ * @param reflection - The reflection class to generate the object for.
11
+ * @param options - Options for generating the object.
12
+ * @returns A string containing the TypeScript object definition.
13
+ */
14
+ function generateTypeScriptObject(reflection, options = {}) {
15
+ if (!reflection) return "";
16
+ return `
17
+ /**
18
+ * ${reflection.getDescription() || `${titleCase(options.overrideName || reflection.getClassName() || reflection.getName())} object instance`}.
19
+ */
20
+ export const ${camelCase(options.overrideName || reflection.getName())}${options.overrideExtends !== false && (options.overrideExtends || reflection.getSuperReflectionClass()?.getName()) ? `: ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}` : ""} = {
21
+ ${reflection.getProperties().filter((item) => !item.isIgnored() && !isUndefined(options.defaultValues?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
22
+ if (isUndefined(ret) && !isUndefined(options.defaultValues?.[alias])) return options.defaultValues?.[alias];
23
+ return ret;
24
+ }, void 0) ?? item.getDefaultValue())).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1).map((item) => ` /**
25
+ * ${item.getDescription() || item.getTitle() || titleCase(item.getNameAsString())}
26
+ *
27
+ * @title ${item.getTitle() || titleCase(item.getNameAsString())}${item.getAlias().length ? `
28
+ ${item.getAlias().map((alias) => ` * @alias ${alias}`).join("\n")}` : ""}${item.getDomain() ? `
29
+ * @domain ${item.getDomain()}` : ""}${item.getPermission().length ? `
30
+ ${item.getPermission().map((permission) => ` * @permission ${permission}`).join("\n")}` : ""}${item.isInternal() ? `
31
+ * @internal` : ""}${item.isReadonly() ? `
32
+ * @readonly` : ""}${item.isIgnored() ? `
33
+ * @ignored` : ""}${item.isHidden() ? `
34
+ * @hidden` : ""}
35
+ */
36
+ ${item.getNameAsString()}: ${stringifyValue(item.getType(), options.defaultValues?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
37
+ if (isUndefined(ret) && !isUndefined(options.defaultValues?.[alias])) return options.defaultValues?.[alias];
38
+ return ret;
39
+ }, void 0) ?? item.getDefaultValue())}`).join(", \n")}
40
+ };
41
+ `;
42
+ }
43
+
44
+ //#endregion
45
+ export { generateTypeScriptObject as t };
46
+ //# sourceMappingURL=typescript-BCc7kwL_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-BCc7kwL_.mjs","names":["stringifyValue","camelCase","titleCase","isUndefined","generateTypeScriptObject","reflection","options","getDescription","overrideName","getClassName","getName","overrideExtends","getSuperReflectionClass","getProperties","filter","item","isIgnored","defaultValues","getNameAsString","getAlias","reduce","ret","alias","undefined","getDefaultValue","sort","a","b","isReadonly","localeCompare","map","getTitle","length","join","getDomain","getPermission","permission","isInternal","isHidden","getType"],"sources":["../src/helpers/typescript.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { stringifyValue } from \"@powerlines/deepkit/utilities\";\nimport type { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\nexport interface GenerateTypeScriptInterfaceOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n// /**\n// * Generates a TypeScript interface for the given reflection class.\n// *\n// * @param reflection - The reflection class to generate the interface for.\n// * @returns A string containing the TypeScript interface definition.\n// */\n// export function TypeScriptInterface<T>(\n// reflection: ReflectionClass<T>,\n// options: GenerateTypeScriptInterfaceOptions<T> = {}\n// ): string {\n// if (!reflection) {\n// return \"\";\n// }\n\n// return `\n// /**\n// * Interface for ${reflection.getTitle() || titleCase(options.overrideName || reflection.getName())}.\n// *\n// * @title ${reflection.getTitle() || titleCase(reflection.getName())}${\n// reflection.getAlias().length\n// ? ` ${reflection\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${reflection.getDomain() ? ` * @domain ${reflection.getDomain()}` : \"\"}${\n// reflection.getPermission().length\n// ? `\n// ${reflection\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// reflection.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// reflection.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// reflection.isIgnored()\n// ? `\n// * @ignored`\n// : \"\"\n// }${\n// reflection.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// export interface ${pascalCase(options.overrideName || reflection.getName())}${\n// options.overrideExtends !== false &&\n// (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n// ? ` extends ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n// : \"\"\n// } {\n// ${reflection\n// .getProperties()\n// .filter(item => !item.isIgnored())\n// .sort((a, b) =>\n// (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n// ? a.getNameAsString().localeCompare(b.getNameAsString())\n// : a.isReadonly()\n// ? 1\n// : -1\n// )\n// .map(\n// item =>\n// ` /**\n// * ${\n// item.getDescription() ||\n// item.getTitle() ||\n// titleCase(item.getNameAsString())\n// }\n// *\n// * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n// item.getAlias().length\n// ? `\n// ${item\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// item.getDomain()\n// ? `\n// * @domain ${item.getDomain()}`\n// : \"\"\n// }${\n// item.getPermission().length\n// ? `\n// ${item\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// !isUndefined(item.getDefaultValue()) && item.getDefaultValue() !== \"\"\n// ? `\n// * @defaultValue ${item.getDefaultValue()}`\n// : \"\"\n// }${\n// item.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// item.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// item.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// ${item.isReadonly() ? \"readonly \" : \"\"}${item.getNameAsString()}${\n// isUndefined(\n// (options.defaultValues as Record<string, any>)?.[item.getNameAsString()]\n// ) &&\n// isUndefined(item.getDefaultValue()) &&\n// !item\n// .getAlias()\n// .some(\n// alias =>\n// !isUndefined(\n// (options.defaultValues as Record<string, any>)?.[alias]\n// )\n// ) &&\n// item.isOptional()\n// ? \"?\"\n// : \"\"\n// }: ${stringifyType(item.getType())}`\n// )\n// .join(\", \\n\")}\n// }\n// `;\n// }\n\nexport interface GenerateTypeScriptObjectOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n *\n * @param reflection - The reflection class to generate the object for.\n * @param options - Options for generating the object.\n * @returns A string containing the TypeScript object definition.\n */\nexport function generateTypeScriptObject<T extends Record<string, any>>(\n reflection: ReflectionClass<T>,\n options: GenerateTypeScriptObjectOptions<T> = {}\n) {\n if (!reflection) {\n return \"\";\n }\n\n return `\n/**\n * ${\n reflection.getDescription() ||\n `${titleCase(options.overrideName || reflection.getClassName() || reflection.getName())} object instance`\n }.\n */\nexport const ${camelCase(options.overrideName || reflection.getName())}${\n options.overrideExtends !== false &&\n (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n ? `: ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n : \"\"\n } = {\n ${reflection\n .getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (options.defaultValues as Record<string, any>)?.[alias]\n )\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n .map(\n item =>\n ` /**\n * ${\n item.getDescription() ||\n item.getTitle() ||\n titleCase(item.getNameAsString())\n }\n *\n * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n item.getAlias().length\n ? `\n ${item\n .getAlias()\n .map(alias => ` * @alias ${alias}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.getDomain()\n ? `\n * @domain ${item.getDomain()}`\n : \"\"\n }${\n item.getPermission().length\n ? `\n ${item\n .getPermission()\n .map(permission => ` * @permission ${permission}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.isInternal()\n ? `\n * @internal`\n : \"\"\n }${\n item.isReadonly()\n ? `\n * @readonly`\n : \"\"\n }${\n item.isIgnored()\n ? `\n * @ignored`\n : \"\"\n }${\n item.isHidden()\n ? `\n * @hidden`\n : \"\"\n }\n */\n ${item.getNameAsString()}: ${stringifyValue(\n item.getType(),\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined((options.defaultValues as Record<string, any>)?.[alias])\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )}`\n )\n .join(\", \\n\")}\n};\n`;\n}\n"],"mappings":""}
@@ -0,0 +1,51 @@
1
+ const require_chunk = require('./chunk-CbDLau6x.cjs');
2
+ let __powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
3
+ let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
4
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
5
+ let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
6
+
7
+ //#region src/helpers/typescript.ts
8
+ /**
9
+ * Generates a TypeScript object for the given reflection class.
10
+ *
11
+ * @param reflection - The reflection class to generate the object for.
12
+ * @param options - Options for generating the object.
13
+ * @returns A string containing the TypeScript object definition.
14
+ */
15
+ function generateTypeScriptObject(reflection, options = {}) {
16
+ if (!reflection) return "";
17
+ return `
18
+ /**
19
+ * ${reflection.getDescription() || `${(0, __stryke_string_format_title_case.titleCase)(options.overrideName || reflection.getClassName() || reflection.getName())} object instance`}.
20
+ */
21
+ export const ${(0, __stryke_string_format_camel_case.camelCase)(options.overrideName || reflection.getName())}${options.overrideExtends !== false && (options.overrideExtends || reflection.getSuperReflectionClass()?.getName()) ? `: ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}` : ""} = {
22
+ ${reflection.getProperties().filter((item) => !item.isIgnored() && !(0, __stryke_type_checks_is_undefined.isUndefined)(options.defaultValues?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
23
+ if ((0, __stryke_type_checks_is_undefined.isUndefined)(ret) && !(0, __stryke_type_checks_is_undefined.isUndefined)(options.defaultValues?.[alias])) return options.defaultValues?.[alias];
24
+ return ret;
25
+ }, void 0) ?? item.getDefaultValue())).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1).map((item) => ` /**
26
+ * ${item.getDescription() || item.getTitle() || (0, __stryke_string_format_title_case.titleCase)(item.getNameAsString())}
27
+ *
28
+ * @title ${item.getTitle() || (0, __stryke_string_format_title_case.titleCase)(item.getNameAsString())}${item.getAlias().length ? `
29
+ ${item.getAlias().map((alias) => ` * @alias ${alias}`).join("\n")}` : ""}${item.getDomain() ? `
30
+ * @domain ${item.getDomain()}` : ""}${item.getPermission().length ? `
31
+ ${item.getPermission().map((permission) => ` * @permission ${permission}`).join("\n")}` : ""}${item.isInternal() ? `
32
+ * @internal` : ""}${item.isReadonly() ? `
33
+ * @readonly` : ""}${item.isIgnored() ? `
34
+ * @ignored` : ""}${item.isHidden() ? `
35
+ * @hidden` : ""}
36
+ */
37
+ ${item.getNameAsString()}: ${(0, __powerlines_deepkit_utilities.stringifyValue)(item.getType(), options.defaultValues?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
38
+ if ((0, __stryke_type_checks_is_undefined.isUndefined)(ret) && !(0, __stryke_type_checks_is_undefined.isUndefined)(options.defaultValues?.[alias])) return options.defaultValues?.[alias];
39
+ return ret;
40
+ }, void 0) ?? item.getDefaultValue())}`).join(", \n")}
41
+ };
42
+ `;
43
+ }
44
+
45
+ //#endregion
46
+ Object.defineProperty(exports, 'generateTypeScriptObject', {
47
+ enumerable: true,
48
+ get: function () {
49
+ return generateTypeScriptObject;
50
+ }
51
+ });
@@ -0,0 +1,26 @@
1
+ import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
2
+
3
+ //#region src/helpers/typescript.d.ts
4
+ interface GenerateTypeScriptInterfaceOptions<T> {
5
+ overrideName?: string;
6
+ overrideExtends?: string | false;
7
+ defaultValues?: Partial<T>;
8
+ }
9
+ interface GenerateTypeScriptObjectOptions<T> {
10
+ overrideName?: string;
11
+ overrideExtends?: string | false;
12
+ defaultValues?: Partial<T>;
13
+ }
14
+ /**
15
+ * Generates a TypeScript object for the given reflection class.
16
+ *
17
+ * @param reflection - The reflection class to generate the object for.
18
+ * @param options - Options for generating the object.
19
+ * @returns A string containing the TypeScript object definition.
20
+ */
21
+ declare function generateTypeScriptObject<T extends Record<string, any>>(reflection: ReflectionClass<T>, options?: GenerateTypeScriptObjectOptions<T>): string;
22
+ declare type __ΩGenerateTypeScriptInterfaceOptions = any[];
23
+ declare type __ΩGenerateTypeScriptObjectOptions = any[];
24
+ //#endregion
25
+ export { generateTypeScriptObject as a, __ΩGenerateTypeScriptObjectOptions as i, GenerateTypeScriptObjectOptions as n, __ΩGenerateTypeScriptInterfaceOptions as r, GenerateTypeScriptInterfaceOptions as t };
26
+ //# sourceMappingURL=typescript-DWzPF4n4.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-DWzPF4n4.d.mts","names":[],"sources":["../src/helpers/typescript.ts"],"sourcesContent":[],"mappings":";;;UAwBiB;;EAAA,eAAA,CAAA,EAAA,MAAA,GAAA,KAAA;EAwJA,aAAA,CAAA,EArJC,OAqJD,CArJS,CAqJT,CAAA;AAajB;AAAmD,UAblC,+BAakC,CAAA,CAAA,CAAA,CAAA;EACrB,YAAA,CAAA,EAAA,MAAA;EAAhB,eAAA,CAAA,EAAA,MAAA,GAAA,KAAA;EAC6B,aAAA,CAAA,EAZzB,OAYyB,CAZjB,CAYiB,CAAA;;;;;;;;;iBAF3B,mCAAmC,iCACrC,gBAAgB,cACnB,gCAAgC"}
@@ -0,0 +1,50 @@
1
+ import { h as TypescriptFileImports, n as ComponentProps, p as SourceFileHeaderProps } from "./components-IRVnipN0.cjs";
2
+ import { n as SourceFileProps$1 } from "./source-file-QiALwKWL.cjs";
3
+ import { Children } from "@alloy-js/core";
4
+ import { TSModuleScope } from "@alloy-js/typescript";
5
+
6
+ //#region src/typescript/components/typescript-file.d.ts
7
+ type TypescriptFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps & {
8
+ hashbang?: Children | true;
9
+ header?: Children;
10
+ imports?: TypescriptFileImports;
11
+ builtinImports?: TypescriptFileImports;
12
+ export?: boolean | string;
13
+ tsx?: boolean;
14
+ };
15
+ /**
16
+ * A base component representing a Powerlines generated Typescript source file.
17
+ *
18
+ * @param props - The properties for the source file.
19
+ * @returns The rendered source file component.
20
+ */
21
+ declare function TypescriptFile(props: TypescriptFileProps): Children;
22
+ interface TypescriptFileHeaderProps extends SourceFileHeaderProps {
23
+ header?: Children;
24
+ hashbang?: Children | true;
25
+ }
26
+ /**
27
+ * Renders the header for a Powerlines Typescript source file.
28
+ *
29
+ * @param props - The properties for the source file header.
30
+ * @returns The rendered source file header.
31
+ */
32
+ declare function TypescriptFileHeader(props: TypescriptFileHeaderProps): Children;
33
+ interface TypescriptFileHeaderImportsProps extends SourceFileHeaderProps {
34
+ imports?: TypescriptFileImports;
35
+ builtinImports?: TypescriptFileImports;
36
+ scope?: TSModuleScope;
37
+ }
38
+ /**
39
+ * Renders the header for a Powerlines Typescript source file.
40
+ *
41
+ * @param props - The properties for the source file header.
42
+ * @returns The rendered source file header.
43
+ */
44
+ declare function TypescriptFileHeaderImports(props: TypescriptFileHeaderImportsProps): Children;
45
+ declare type __ΩTypescriptFileProps = any[];
46
+ declare type __ΩTypescriptFileHeaderProps = any[];
47
+ declare type __ΩTypescriptFileHeaderImportsProps = any[];
48
+ //#endregion
49
+ export { TypescriptFileHeaderProps as a, __ΩTypescriptFileHeaderProps as c, TypescriptFileHeaderImportsProps as i, __ΩTypescriptFileProps as l, TypescriptFileHeader as n, TypescriptFileProps as o, TypescriptFileHeaderImports as r, __ΩTypescriptFileHeaderImportsProps as s, TypescriptFile as t };
50
+ //# sourceMappingURL=typescript-file-BDYo1D2p.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-file-BDYo1D2p.d.cts","names":[],"sources":["../src/typescript/components/typescript-file.tsx"],"sourcesContent":[],"mappings":";;;;;;KAmDY,mBAAA,GAAsB,KAAK,iCACrC;aACa;EAFH,MAAA,CAAA,EAGC,QAHD;EAA2B,OAAA,CAAA,EAIzB,qBAJyB;EAAL,cAAA,CAAA,EAKb,qBALa;EAChC,MAAA,CAAA,EAAA,OAAA,GAAA,MAAA;EACa,GAAA,CAAA,EAAA,OAAA;CACF;;;;AAab;AAgEA;;AAEa,iBAlEG,cAAA,CAkEH,KAAA,EAlEyB,mBAkEzB,CAAA,EAlE4C,QAkE5C;AAFsC,UAAlC,yBAAA,SAAkC,qBAAA,CAAA;EAAqB,MAAA,CAAA,EAC7D,QAD6D;EAWxD,QAAA,CAAA,EATH,QASG,GAAA,IAAoB;AAuEpC;;;;;;AAYA;iBAnFgB,oBAAA,QAA4B,4BAAyB;UAuEpD,gCAAA,SAAyC;YAC9C;mBACO;UACT;;;;;;;;iBASM,2BAAA,QACP,mCAAgC"}
@@ -0,0 +1,50 @@
1
+ import { h as TypescriptFileImports, n as ComponentProps, p as SourceFileHeaderProps } from "./components-oHSM7vmp.mjs";
2
+ import { n as SourceFileProps$1 } from "./source-file-CQl0UCgf.mjs";
3
+ import { Children } from "@alloy-js/core";
4
+ import { TSModuleScope } from "@alloy-js/typescript";
5
+
6
+ //#region src/typescript/components/typescript-file.d.ts
7
+ type TypescriptFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps & {
8
+ hashbang?: Children | true;
9
+ header?: Children;
10
+ imports?: TypescriptFileImports;
11
+ builtinImports?: TypescriptFileImports;
12
+ export?: boolean | string;
13
+ tsx?: boolean;
14
+ };
15
+ /**
16
+ * A base component representing a Powerlines generated Typescript source file.
17
+ *
18
+ * @param props - The properties for the source file.
19
+ * @returns The rendered source file component.
20
+ */
21
+ declare function TypescriptFile(props: TypescriptFileProps): Children;
22
+ interface TypescriptFileHeaderProps extends SourceFileHeaderProps {
23
+ header?: Children;
24
+ hashbang?: Children | true;
25
+ }
26
+ /**
27
+ * Renders the header for a Powerlines Typescript source file.
28
+ *
29
+ * @param props - The properties for the source file header.
30
+ * @returns The rendered source file header.
31
+ */
32
+ declare function TypescriptFileHeader(props: TypescriptFileHeaderProps): Children;
33
+ interface TypescriptFileHeaderImportsProps extends SourceFileHeaderProps {
34
+ imports?: TypescriptFileImports;
35
+ builtinImports?: TypescriptFileImports;
36
+ scope?: TSModuleScope;
37
+ }
38
+ /**
39
+ * Renders the header for a Powerlines Typescript source file.
40
+ *
41
+ * @param props - The properties for the source file header.
42
+ * @returns The rendered source file header.
43
+ */
44
+ declare function TypescriptFileHeaderImports(props: TypescriptFileHeaderImportsProps): Children;
45
+ declare type __ΩTypescriptFileProps = any[];
46
+ declare type __ΩTypescriptFileHeaderProps = any[];
47
+ declare type __ΩTypescriptFileHeaderImportsProps = any[];
48
+ //#endregion
49
+ export { TypescriptFileHeaderProps as a, __ΩTypescriptFileHeaderProps as c, TypescriptFileHeaderImportsProps as i, __ΩTypescriptFileProps as l, TypescriptFileHeader as n, TypescriptFileProps as o, TypescriptFileHeaderImports as r, __ΩTypescriptFileHeaderImportsProps as s, TypescriptFile as t };
50
+ //# sourceMappingURL=typescript-file-BWaBMfMr.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-file-BWaBMfMr.d.mts","names":[],"sources":["../src/typescript/components/typescript-file.tsx"],"sourcesContent":[],"mappings":";;;;;;KAmDY,mBAAA,GAAsB,KAAK,iCACrC;aACa;EAFH,MAAA,CAAA,EAGC,QAHD;EAA2B,OAAA,CAAA,EAIzB,qBAJyB;EAAL,cAAA,CAAA,EAKb,qBALa;EAChC,MAAA,CAAA,EAAA,OAAA,GAAA,MAAA;EACa,GAAA,CAAA,EAAA,OAAA;CACF;;;;AAab;AAgEA;;AAEa,iBAlEG,cAAA,CAkEH,KAAA,EAlEyB,mBAkEzB,CAAA,EAlE4C,QAkE5C;AAFsC,UAAlC,yBAAA,SAAkC,qBAAA,CAAA;EAAqB,MAAA,CAAA,EAC7D,QAD6D;EAWxD,QAAA,CAAA,EATH,QASG,GAAA,IAAoB;AAuEpC;;;;;;AAYA;iBAnFgB,oBAAA,QAA4B,4BAAyB;UAuEpD,gCAAA,SAAyC;YAC9C;mBACO;UACT;;;;;;;;iBASM,2BAAA,QACP,mCAAgC"}
@@ -0,0 +1,50 @@
1
+ import { h as TypescriptFileImports, n as ComponentProps, p as SourceFileHeaderProps } from "./components-oHSM7vmp.mjs";
2
+ import { n as SourceFileProps$1 } from "./source-file-BEY3mjFl.mjs";
3
+ import { Children } from "@alloy-js/core";
4
+ import { TSModuleScope } from "@alloy-js/typescript";
5
+
6
+ //#region src/typescript/components/typescript-file.d.ts
7
+ type TypescriptFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps & {
8
+ hashbang?: Children | true;
9
+ header?: Children;
10
+ imports?: TypescriptFileImports;
11
+ builtinImports?: TypescriptFileImports;
12
+ export?: boolean | string;
13
+ tsx?: boolean;
14
+ };
15
+ /**
16
+ * A base component representing a Powerlines generated Typescript source file.
17
+ *
18
+ * @param props - The properties for the source file.
19
+ * @returns The rendered source file component.
20
+ */
21
+ declare function TypescriptFile(props: TypescriptFileProps): Children;
22
+ interface TypescriptFileHeaderProps extends SourceFileHeaderProps {
23
+ header?: Children;
24
+ hashbang?: Children | true;
25
+ }
26
+ /**
27
+ * Renders the header for a Powerlines Typescript source file.
28
+ *
29
+ * @param props - The properties for the source file header.
30
+ * @returns The rendered source file header.
31
+ */
32
+ declare function TypescriptFileHeader(props: TypescriptFileHeaderProps): Children;
33
+ interface TypescriptFileHeaderImportsProps extends SourceFileHeaderProps {
34
+ imports?: TypescriptFileImports;
35
+ builtinImports?: TypescriptFileImports;
36
+ scope?: TSModuleScope;
37
+ }
38
+ /**
39
+ * Renders the header for a Powerlines Typescript source file.
40
+ *
41
+ * @param props - The properties for the source file header.
42
+ * @returns The rendered source file header.
43
+ */
44
+ declare function TypescriptFileHeaderImports(props: TypescriptFileHeaderImportsProps): Children;
45
+ declare type __ΩTypescriptFileProps = any[];
46
+ declare type __ΩTypescriptFileHeaderProps = any[];
47
+ declare type __ΩTypescriptFileHeaderImportsProps = any[];
48
+ //#endregion
49
+ export { TypescriptFileHeaderProps as a, __ΩTypescriptFileHeaderProps as c, TypescriptFileHeaderImportsProps as i, __ΩTypescriptFileProps as l, TypescriptFileHeader as n, TypescriptFileProps as o, TypescriptFileHeaderImports as r, __ΩTypescriptFileHeaderImportsProps as s, TypescriptFile as t };
50
+ //# sourceMappingURL=typescript-file-Bi5NEAOC.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-file-Bi5NEAOC.d.mts","names":[],"sources":["../src/typescript/components/typescript-file.tsx"],"sourcesContent":[],"mappings":";;;;;;KAmDY,mBAAA,GAAsB,KAAK,iCACrC;aACa;EAFH,MAAA,CAAA,EAGC,QAHD;EAA2B,OAAA,CAAA,EAIzB,qBAJyB;EAAL,cAAA,CAAA,EAKb,qBALa;EAChC,MAAA,CAAA,EAAA,OAAA,GAAA,MAAA;EACa,GAAA,CAAA,EAAA,OAAA;CACF;;;;AAab;AAgEA;;AAEa,iBAlEG,cAAA,CAkEH,KAAA,EAlEyB,mBAkEzB,CAAA,EAlE4C,QAkE5C;AAFsC,UAAlC,yBAAA,SAAkC,qBAAA,CAAA;EAAqB,MAAA,CAAA,EAC7D,QAD6D;EAWxD,QAAA,CAAA,EATH,QASG,GAAA,IAAoB;AAuEpC;;;;;;AAYA;iBAnFgB,oBAAA,QAA4B,4BAAyB;UAuEpD,gCAAA,SAAyC;YAC9C;mBACO;UACT;;;;;;;;iBASM,2BAAA,QACP,mCAAgC"}
@@ -0,0 +1,214 @@
1
+ import { t as SingleLineComment } from "./single-line-comment-mOQtfhWt.mjs";
2
+ import { a as usePowerlinesSafe } from "./context-AhzykdKC.mjs";
3
+ import { t as SourceFile } from "./source-file-BKZQpz0C.mjs";
4
+ import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
5
+ import { For, Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
6
+ import { appendPath } from "@stryke/path/append";
7
+ import { titleCase } from "@stryke/string-format/title-case";
8
+ import { isString } from "@stryke/type-checks/is-string";
9
+ import { ImportStatements, PackageContext, SourceFileContext as SourceFileContext$1, TSModuleScope, getSourceDirectoryData, useSourceFile } from "@alloy-js/typescript";
10
+ import { isBoolean } from "@stryke/type-checks/is-boolean";
11
+
12
+ //#region src/typescript/components/typescript-file.tsx
13
+ /**
14
+ * A base component representing a Powerlines generated Typescript source file.
15
+ *
16
+ * @param props - The properties for the source file.
17
+ * @returns The rendered source file component.
18
+ */
19
+ function TypescriptFile(props) {
20
+ const [{ children, path, imports, builtinImports, tsx, header, hashbang }, rest] = splitProps(props, [
21
+ "children",
22
+ "path",
23
+ "imports",
24
+ "builtinImports",
25
+ "tsx",
26
+ "header",
27
+ "hashbang"
28
+ ]);
29
+ const directoryContext = useContext(SourceDirectoryContext);
30
+ const sdData = getSourceDirectoryData(directoryContext);
31
+ const modulePath = appendPath(path, directoryContext.path);
32
+ const scope = new TSModuleScope(modulePath, useScope());
33
+ sdData.modules.add(scope);
34
+ const pkg = useContext(PackageContext);
35
+ if (pkg) pkg.scope.addModule(scope);
36
+ if (props.export) {
37
+ if (pkg) if (isBoolean(props.export)) pkg.scope.addExport(modulePath, scope);
38
+ else pkg.scope.addExport(props.export, scope);
39
+ }
40
+ return createComponent(SourceFileContext$1.Provider, {
41
+ value: { scope },
42
+ get children() {
43
+ return createComponent(Scope, {
44
+ value: scope,
45
+ get children() {
46
+ return createComponent(SourceFile, mergeProps(rest, {
47
+ path: modulePath,
48
+ get header() {
49
+ return header ?? createComponent(TypescriptFileHeader, {
50
+ hashbang,
51
+ get children() {
52
+ return createComponent(TypescriptFileHeaderImports, {
53
+ imports,
54
+ builtinImports,
55
+ scope
56
+ });
57
+ }
58
+ });
59
+ },
60
+ filetype: tsx ? "tsx" : "typescript",
61
+ children
62
+ }));
63
+ }
64
+ });
65
+ }
66
+ });
67
+ }
68
+ /**
69
+ * Renders the header for a Powerlines Typescript source file.
70
+ *
71
+ * @param props - The properties for the source file header.
72
+ * @returns The rendered source file header.
73
+ */
74
+ function TypescriptFileHeader(props) {
75
+ const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
76
+ const context = usePowerlinesSafe();
77
+ return [
78
+ createComponent(Show, {
79
+ get when() {
80
+ return Boolean(hashbang);
81
+ },
82
+ get children() {
83
+ return [memo(() => hashbang === true ? code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang), createIntrinsic("hbr", {})];
84
+ }
85
+ }),
86
+ createComponent(Show, {
87
+ get when() {
88
+ return Boolean(header);
89
+ },
90
+ get children() {
91
+ return [header, createIntrinsic("hbr", {})];
92
+ }
93
+ }),
94
+ createIntrinsic("hbr", {}),
95
+ createComponent(Show, {
96
+ get when() {
97
+ return Boolean(disableEslint);
98
+ },
99
+ get children() {
100
+ return [createComponent(SingleLineComment, {
101
+ variant: "slash-star",
102
+ children: "eslint-disable"
103
+ }), createIntrinsic("hbr", {})];
104
+ }
105
+ }),
106
+ createComponent(Show, {
107
+ get when() {
108
+ return Boolean(disablePrettier);
109
+ },
110
+ get children() {
111
+ return [createComponent(SingleLineComment, {
112
+ variant: "slash-star",
113
+ children: "prettier-ignore"
114
+ }), createIntrinsic("hbr", {})];
115
+ }
116
+ }),
117
+ createComponent(Show, {
118
+ get when() {
119
+ return Boolean(disableBiome);
120
+ },
121
+ get children() {
122
+ return [createComponent(SingleLineComment, { children: "biome-ignore lint: disable" }), createIntrinsic("hbr", {})];
123
+ }
124
+ }),
125
+ createComponent(Show, {
126
+ get when() {
127
+ return Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome);
128
+ },
129
+ get children() {
130
+ return createIntrinsic("hbr", {});
131
+ }
132
+ }),
133
+ createComponent(Show, {
134
+ get when() {
135
+ return Boolean(children);
136
+ },
137
+ get children() {
138
+ return [children, createIntrinsic("hbr", {})];
139
+ }
140
+ }),
141
+ createComponent(SingleLineComment, { get children() {
142
+ return `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`;
143
+ } }),
144
+ createIntrinsic("hbr", {}),
145
+ createComponent(SingleLineComment, { children: code`NOTE: Do not edit this file manually - it will be overwritten automatically` }),
146
+ createIntrinsic("hbr", {})
147
+ ];
148
+ }
149
+ /**
150
+ * Renders the header for a Powerlines Typescript source file.
151
+ *
152
+ * @param props - The properties for the source file header.
153
+ * @returns The rendered source file header.
154
+ */
155
+ function TypescriptFileHeaderImports(props) {
156
+ const { imports, builtinImports } = props;
157
+ const context = usePowerlinesSafe();
158
+ const sourceFile = useSourceFile();
159
+ const scope = props.scope ?? sourceFile.scope;
160
+ return createComponent(Show, {
161
+ get when() {
162
+ return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0 || !!builtinImports && Object.keys(builtinImports).length > 0;
163
+ },
164
+ get children() {
165
+ return [
166
+ createComponent(Show, {
167
+ get when() {
168
+ return !!imports && Object.keys(imports).length > 0;
169
+ },
170
+ get children() {
171
+ return createComponent(For, {
172
+ get each() {
173
+ return Object.entries(imports ?? {});
174
+ },
175
+ hardline: true,
176
+ children: ([module, importItem]) => {
177
+ return [memo(() => code`import ${importItem === null ? "" : isString(importItem) ? importItem : ` ${importItem.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (importItem.filter((i) => !isString(i) && i.default).length > 0 && importItem.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (importItem.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${importItem.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} from "${module}";`)];
178
+ }
179
+ });
180
+ }
181
+ }),
182
+ createComponent(Show, {
183
+ get when() {
184
+ return builtinImports && Object.keys(builtinImports).length > 0;
185
+ },
186
+ get children() {
187
+ return createComponent(For, {
188
+ get each() {
189
+ return Object.entries(builtinImports ?? {});
190
+ },
191
+ hardline: true,
192
+ children: ([module, importItem]) => code`import ${importItem === null ? "" : isString(importItem) ? importItem : ` ${importItem.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (importItem.filter((i) => !isString(i) && i.default).length > 0 && importItem.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (importItem.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${importItem.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} from "${module.includes(":") ? module : `${context?.config?.framework || "powerlines"}:${module}`}";`
193
+ });
194
+ }
195
+ }),
196
+ createComponent(Show, {
197
+ get when() {
198
+ return scope.importedModules.size > 0;
199
+ },
200
+ get children() {
201
+ return createComponent(ImportStatements, { get records() {
202
+ return scope.importedModules;
203
+ } });
204
+ }
205
+ }),
206
+ createIntrinsic("hbr", {})
207
+ ];
208
+ }
209
+ });
210
+ }
211
+
212
+ //#endregion
213
+ export { TypescriptFileHeader as n, TypescriptFileHeaderImports as r, TypescriptFile as t };
214
+ //# sourceMappingURL=typescript-file-CFy1OsoL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-file-CFy1OsoL.mjs","names":["code","For","Scope","Show","SourceDirectoryContext","splitProps","useContext","useScope","getSourceDirectoryData","ImportStatements","PackageContext","SourceFileContext","TSModuleScope","useSourceFile","appendPath","titleCase","isBoolean","isString","SingleLineComment","SourceFile","usePowerlinesSafe","TypescriptFile","props","children","path","imports","builtinImports","tsx","header","hashbang","rest","directoryContext","sdData","modulePath","scope","modules","add","pkg","addModule","export","addExport","_$createComponent","Provider","value","_$mergeProps","TypescriptFileHeader","TypescriptFileHeaderImports","filetype","disableEslint","disableBiome","disablePrettier","context","when","Boolean","_$memo","config","mode","_$createIntrinsic","variant","framework","sourceFile","importedModules","size","Object","keys","length","each","entries","hardline","module","importItem","filter","i","default","map","alias","name","join","includes","records"],"sources":["../src/typescript/components/typescript-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport {\n code,\n For,\n Scope,\n Show,\n SourceDirectoryContext,\n splitProps,\n useContext,\n useScope\n} from \"@alloy-js/core\";\nimport {\n getSourceDirectoryData,\n ImportStatements,\n PackageContext,\n SourceFileContext,\n TSModuleScope,\n useSourceFile\n} from \"@alloy-js/typescript\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { SingleLineComment } from \"../../core/components/single-line-comment\";\nimport { SourceFile, SourceFileProps } from \"../../core/components/source-file\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport {\n ComponentProps,\n SourceFileHeaderProps,\n TypescriptFileImportItem,\n TypescriptFileImports\n} from \"../../types/components\";\n\nexport type TypescriptFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps & {\n hashbang?: Children | true;\n header?: Children;\n imports?: TypescriptFileImports;\n builtinImports?: TypescriptFileImports;\n export?: boolean | string;\n tsx?: boolean;\n };\n\n/**\n * A base component representing a Powerlines generated Typescript source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function TypescriptFile(props: TypescriptFileProps) {\n const [\n { children, path, imports, builtinImports, tsx, header, hashbang },\n rest\n ] = splitProps(props, [\n \"children\",\n \"path\",\n \"imports\",\n \"builtinImports\",\n \"tsx\",\n \"header\",\n \"hashbang\"\n ]);\n\n const directoryContext = useContext(SourceDirectoryContext)!;\n const sdData = getSourceDirectoryData(directoryContext);\n\n const modulePath = appendPath(path, directoryContext.path);\n const scope = new TSModuleScope(modulePath, useScope());\n sdData.modules.add(scope);\n\n const pkg = useContext(PackageContext);\n if (pkg) {\n pkg.scope.addModule(scope);\n }\n\n if (props.export) {\n if (pkg) {\n if (isBoolean(props.export)) {\n pkg.scope.addExport(modulePath, scope);\n } else {\n pkg.scope.addExport(props.export, scope);\n }\n }\n }\n\n return (\n <SourceFileContext.Provider\n value={{\n scope\n }}>\n <Scope value={scope}>\n <SourceFile\n {...rest}\n path={modulePath}\n header={\n header ?? (\n <TypescriptFileHeader hashbang={hashbang}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n scope={scope}\n />\n </TypescriptFileHeader>\n )\n }\n filetype={tsx ? \"tsx\" : \"typescript\"}>\n {children}\n </SourceFile>\n </Scope>\n </SourceFileContext.Provider>\n );\n}\n\nexport interface TypescriptFileHeaderProps extends SourceFileHeaderProps {\n header?: Children;\n hashbang?: Children | true;\n}\n\n/**\n * Renders the header for a Powerlines Typescript source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function TypescriptFileHeader(props: TypescriptFileHeaderProps) {\n const {\n header,\n hashbang,\n disableEslint = true,\n disableBiome = true,\n disablePrettier = false,\n children\n } = props;\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show when={Boolean(hashbang)}>\n {hashbang === true\n ? code`#!/usr/bin/env ${\n context?.config.mode === \"development\"\n ? \"-S NODE_OPTIONS=--enable-source-maps\"\n : \"\"\n } node`\n : hashbang}\n <hbr />\n </Show>\n <Show when={Boolean(header)}>\n {header}\n <hbr />\n </Show>\n <hbr />\n <Show when={Boolean(disableEslint)}>\n <SingleLineComment variant=\"slash-star\">\n {\"eslint-disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disablePrettier)}>\n <SingleLineComment variant=\"slash-star\">\n {\"prettier-ignore\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disableBiome)}>\n <SingleLineComment>{\"biome-ignore lint: disable\"}</SingleLineComment>\n <hbr />\n </Show>\n <Show\n when={\n Boolean(disableEslint) ||\n Boolean(disablePrettier) ||\n Boolean(disableBiome)\n }>\n <hbr />\n </Show>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment>{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment>\n {code`NOTE: Do not edit this file manually - it will be overwritten automatically`}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n\nexport interface TypescriptFileHeaderImportsProps extends SourceFileHeaderProps {\n imports?: TypescriptFileImports;\n builtinImports?: TypescriptFileImports;\n scope?: TSModuleScope;\n}\n\n/**\n * Renders the header for a Powerlines Typescript source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function TypescriptFileHeaderImports(\n props: TypescriptFileHeaderImportsProps\n) {\n const { imports, builtinImports } = props;\n\n const context = usePowerlinesSafe();\n const sourceFile = useSourceFile();\n\n const scope = props.scope ?? sourceFile.scope;\n\n return (\n <Show\n when={\n scope.importedModules.size > 0 ||\n (!!imports && Object.keys(imports).length > 0) ||\n (!!builtinImports && Object.keys(builtinImports).length > 0)\n }>\n <Show when={!!imports && Object.keys(imports).length > 0}>\n <For each={Object.entries(imports ?? {})} hardline>\n {([module, importItem]) => {\n return (\n <>\n {code`import ${\n importItem === null\n ? \"\"\n : isString(importItem)\n ? importItem\n : ` ${\n (\n importItem.filter(\n i => !isString(i) && i.default\n ) as TypescriptFileImportItem[]\n )\n .map(i => (i.alias ? i.alias : i.name))\n .join(\", \") +\n (importItem.filter(i => !isString(i) && i.default)\n .length > 0 &&\n importItem.filter(i => isString(i) || !i.default)\n .length > 0\n ? \", \"\n : \"\") +\n (importItem.filter(i => isString(i) || !i.default)\n .length > 0\n ? `{ ${importItem\n .map(i =>\n isString(i)\n ? i\n : i.alias\n ? `${i.name} as ${i.alias}`\n : i.name\n )\n .join(\", \")} }`\n : \"\")\n } `\n } from \"${module}\";`}\n </>\n );\n }}\n </For>\n </Show>\n <Show when={builtinImports && Object.keys(builtinImports).length > 0}>\n <For\n each={Object.entries(\n (builtinImports ?? {}) as Record<\n string,\n null | Array<TypescriptFileImportItem | string>\n >\n )}\n hardline>\n {([module, importItem]) =>\n code`import ${\n importItem === null\n ? \"\"\n : isString(importItem)\n ? importItem\n : ` ${\n (\n importItem.filter(\n i => !isString(i) && i.default\n ) as TypescriptFileImportItem[]\n )\n .map(i => (i.alias ? i.alias : i.name))\n .join(\", \") +\n (importItem.filter(i => !isString(i) && i.default)\n .length > 0 &&\n importItem.filter(i => isString(i) || !i.default).length >\n 0\n ? \", \"\n : \"\") +\n (importItem.filter(i => isString(i) || !i.default)\n .length > 0\n ? `{ ${importItem\n .map(i =>\n isString(i)\n ? i\n : i.alias\n ? `${i.name} as ${i.alias}`\n : i.name\n )\n .join(\", \")} }`\n : \"\")\n } `\n } from \"${\n module.includes(\":\")\n ? module\n : `${context?.config?.framework || \"powerlines\"}:${module}`\n }\";`\n }\n </For>\n </Show>\n <Show when={scope.importedModules.size > 0}>\n <ImportStatements records={scope.importedModules} />\n </Show>\n <hbr />\n </Show>\n );\n}\n"],"mappings":""}