@alloy-js/csharp 0.21.0-dev.0 → 0.21.0-dev.12

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 (467) hide show
  1. package/dist/scripts/components/library-interface.d.ts +9 -0
  2. package/dist/scripts/components/library-interface.d.ts.map +1 -0
  3. package/dist/scripts/components/library-interface.js +43 -0
  4. package/dist/scripts/components/library-interface.js.map +1 -0
  5. package/dist/scripts/components/namespace-directory.d.ts +7 -0
  6. package/dist/scripts/components/namespace-directory.d.ts.map +1 -0
  7. package/dist/scripts/components/namespace-directory.js +96 -0
  8. package/dist/scripts/components/namespace-directory.js.map +1 -0
  9. package/dist/scripts/generate-builtins.d.ts +11 -0
  10. package/dist/scripts/generate-builtins.d.ts.map +1 -0
  11. package/dist/scripts/generate-builtins.js +35 -0
  12. package/dist/scripts/generate-builtins.js.map +1 -0
  13. package/dist/scripts/process-docfx.d.ts +3 -0
  14. package/dist/scripts/process-docfx.d.ts.map +1 -0
  15. package/dist/scripts/process-docfx.js +288 -0
  16. package/dist/scripts/process-docfx.js.map +1 -0
  17. package/dist/src/access.d.ts +13 -0
  18. package/dist/src/access.d.ts.map +1 -0
  19. package/dist/src/access.js +65 -0
  20. package/dist/src/access.js.map +1 -0
  21. package/dist/src/access.test.d.ts +2 -0
  22. package/dist/src/access.test.d.ts.map +1 -0
  23. package/dist/src/access.test.js +43 -0
  24. package/dist/src/access.test.js.map +1 -0
  25. package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.d.ts +32 -0
  26. package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.d.ts.map +1 -0
  27. package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.js +117 -0
  28. package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.js.map +1 -0
  29. package/dist/src/builtins/Microsoft/Win32/index.d.ts +6 -0
  30. package/dist/src/builtins/Microsoft/Win32/index.d.ts.map +1 -0
  31. package/dist/src/builtins/Microsoft/Win32/index.js +5 -0
  32. package/dist/src/builtins/Microsoft/Win32/index.js.map +1 -0
  33. package/dist/src/builtins/Microsoft/index.d.ts +6 -0
  34. package/dist/src/builtins/Microsoft/index.d.ts.map +1 -0
  35. package/dist/src/builtins/Microsoft/index.js +5 -0
  36. package/dist/src/builtins/Microsoft/index.js.map +1 -0
  37. package/dist/src/builtins/System/Buffers/Text/index.d.ts +31 -0
  38. package/dist/src/builtins/System/Buffers/Text/index.d.ts.map +1 -0
  39. package/dist/src/builtins/System/Buffers/Text/index.js +122 -0
  40. package/dist/src/builtins/System/Buffers/Text/index.js.map +1 -0
  41. package/dist/src/builtins/System/Buffers/index.d.ts +57 -0
  42. package/dist/src/builtins/System/Buffers/index.d.ts.map +1 -0
  43. package/dist/src/builtins/System/Buffers/index.js +214 -0
  44. package/dist/src/builtins/System/Buffers/index.js.map +1 -0
  45. package/dist/src/builtins/System/CodeDom/Compiler/index.d.ts +31 -0
  46. package/dist/src/builtins/System/CodeDom/Compiler/index.d.ts.map +1 -0
  47. package/dist/src/builtins/System/CodeDom/Compiler/index.js +131 -0
  48. package/dist/src/builtins/System/CodeDom/Compiler/index.js.map +1 -0
  49. package/dist/src/builtins/System/CodeDom/index.d.ts +6 -0
  50. package/dist/src/builtins/System/CodeDom/index.d.ts.map +1 -0
  51. package/dist/src/builtins/System/CodeDom/index.js +5 -0
  52. package/dist/src/builtins/System/CodeDom/index.js.map +1 -0
  53. package/dist/src/builtins/System/Collections/Generic/index.d.ts +99 -0
  54. package/dist/src/builtins/System/Collections/Generic/index.d.ts.map +1 -0
  55. package/dist/src/builtins/System/Collections/Generic/index.js +342 -0
  56. package/dist/src/builtins/System/Collections/Generic/index.js.map +1 -0
  57. package/dist/src/builtins/System/Collections/ObjectModel/index.d.ts +49 -0
  58. package/dist/src/builtins/System/Collections/ObjectModel/index.d.ts.map +1 -0
  59. package/dist/src/builtins/System/Collections/ObjectModel/index.js +185 -0
  60. package/dist/src/builtins/System/Collections/ObjectModel/index.js.map +1 -0
  61. package/dist/src/builtins/System/Collections/index.d.ts +142 -0
  62. package/dist/src/builtins/System/Collections/index.d.ts.map +1 -0
  63. package/dist/src/builtins/System/Collections/index.js +634 -0
  64. package/dist/src/builtins/System/Collections/index.js.map +1 -0
  65. package/dist/src/builtins/System/ComponentModel/index.d.ts +24 -0
  66. package/dist/src/builtins/System/ComponentModel/index.d.ts.map +1 -0
  67. package/dist/src/builtins/System/ComponentModel/index.js +86 -0
  68. package/dist/src/builtins/System/ComponentModel/index.js.map +1 -0
  69. package/dist/src/builtins/System/Configuration/Assemblies/index.d.ts +19 -0
  70. package/dist/src/builtins/System/Configuration/Assemblies/index.d.ts.map +1 -0
  71. package/dist/src/builtins/System/Configuration/Assemblies/index.js +69 -0
  72. package/dist/src/builtins/System/Configuration/Assemblies/index.js.map +1 -0
  73. package/dist/src/builtins/System/Configuration/index.d.ts +6 -0
  74. package/dist/src/builtins/System/Configuration/index.d.ts.map +1 -0
  75. package/dist/src/builtins/System/Configuration/index.js +5 -0
  76. package/dist/src/builtins/System/Configuration/index.js.map +1 -0
  77. package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.d.ts +155 -0
  78. package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.d.ts.map +1 -0
  79. package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.js +705 -0
  80. package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.js.map +1 -0
  81. package/dist/src/builtins/System/Diagnostics/index.d.ts +115 -0
  82. package/dist/src/builtins/System/Diagnostics/index.d.ts.map +1 -0
  83. package/dist/src/builtins/System/Diagnostics/index.js +509 -0
  84. package/dist/src/builtins/System/Diagnostics/index.js.map +1 -0
  85. package/dist/src/builtins/System/Globalization/index.d.ts +737 -0
  86. package/dist/src/builtins/System/Globalization/index.d.ts.map +1 -0
  87. package/dist/src/builtins/System/Globalization/index.js +3848 -0
  88. package/dist/src/builtins/System/Globalization/index.js.map +1 -0
  89. package/dist/src/builtins/System/IO/Enumeration/index.d.ts +53 -0
  90. package/dist/src/builtins/System/IO/Enumeration/index.d.ts.map +1 -0
  91. package/dist/src/builtins/System/IO/Enumeration/index.js +218 -0
  92. package/dist/src/builtins/System/IO/Enumeration/index.js.map +1 -0
  93. package/dist/src/builtins/System/IO/index.d.ts +622 -0
  94. package/dist/src/builtins/System/IO/index.d.ts.map +1 -0
  95. package/dist/src/builtins/System/IO/index.js +3083 -0
  96. package/dist/src/builtins/System/IO/index.js.map +1 -0
  97. package/dist/src/builtins/System/Net/index.d.ts +14 -0
  98. package/dist/src/builtins/System/Net/index.d.ts.map +1 -0
  99. package/dist/src/builtins/System/Net/index.js +41 -0
  100. package/dist/src/builtins/System/Net/index.js.map +1 -0
  101. package/dist/src/builtins/System/Numerics/index.d.ts +204 -0
  102. package/dist/src/builtins/System/Numerics/index.d.ts.map +1 -0
  103. package/dist/src/builtins/System/Numerics/index.js +952 -0
  104. package/dist/src/builtins/System/Numerics/index.js.map +1 -0
  105. package/dist/src/builtins/System/Reflection/index.d.ts +918 -0
  106. package/dist/src/builtins/System/Reflection/index.d.ts.map +1 -0
  107. package/dist/src/builtins/System/Reflection/index.js +4675 -0
  108. package/dist/src/builtins/System/Reflection/index.js.map +1 -0
  109. package/dist/src/builtins/System/Resources/index.d.ts +56 -0
  110. package/dist/src/builtins/System/Resources/index.d.ts.map +1 -0
  111. package/dist/src/builtins/System/Resources/index.js +235 -0
  112. package/dist/src/builtins/System/Resources/index.js.map +1 -0
  113. package/dist/src/builtins/System/Runtime/CompilerServices/index.d.ts +396 -0
  114. package/dist/src/builtins/System/Runtime/CompilerServices/index.d.ts.map +1 -0
  115. package/dist/src/builtins/System/Runtime/CompilerServices/index.js +1531 -0
  116. package/dist/src/builtins/System/Runtime/CompilerServices/index.js.map +1 -0
  117. package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.d.ts +29 -0
  118. package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.d.ts.map +1 -0
  119. package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.js +103 -0
  120. package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.js.map +1 -0
  121. package/dist/src/builtins/System/Runtime/ExceptionServices/index.d.ts +20 -0
  122. package/dist/src/builtins/System/Runtime/ExceptionServices/index.d.ts.map +1 -0
  123. package/dist/src/builtins/System/Runtime/ExceptionServices/index.js +62 -0
  124. package/dist/src/builtins/System/Runtime/ExceptionServices/index.js.map +1 -0
  125. package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.d.ts +84 -0
  126. package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.d.ts.map +1 -0
  127. package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.js +310 -0
  128. package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.js.map +1 -0
  129. package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.d.ts +18 -0
  130. package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.d.ts.map +1 -0
  131. package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.js +49 -0
  132. package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.js.map +1 -0
  133. package/dist/src/builtins/System/Runtime/InteropServices/index.d.ts +165 -0
  134. package/dist/src/builtins/System/Runtime/InteropServices/index.d.ts.map +1 -0
  135. package/dist/src/builtins/System/Runtime/InteropServices/index.js +774 -0
  136. package/dist/src/builtins/System/Runtime/InteropServices/index.js.map +1 -0
  137. package/dist/src/builtins/System/Runtime/Remoting/index.d.ts +10 -0
  138. package/dist/src/builtins/System/Runtime/Remoting/index.d.ts.map +1 -0
  139. package/dist/src/builtins/System/Runtime/Remoting/index.js +18 -0
  140. package/dist/src/builtins/System/Runtime/Remoting/index.js.map +1 -0
  141. package/dist/src/builtins/System/Runtime/Serialization/index.d.ts +118 -0
  142. package/dist/src/builtins/System/Runtime/Serialization/index.d.ts.map +1 -0
  143. package/dist/src/builtins/System/Runtime/Serialization/index.js +468 -0
  144. package/dist/src/builtins/System/Runtime/Serialization/index.js.map +1 -0
  145. package/dist/src/builtins/System/Runtime/Versioning/index.d.ts +81 -0
  146. package/dist/src/builtins/System/Runtime/Versioning/index.d.ts.map +1 -0
  147. package/dist/src/builtins/System/Runtime/Versioning/index.js +336 -0
  148. package/dist/src/builtins/System/Runtime/Versioning/index.js.map +1 -0
  149. package/dist/src/builtins/System/Runtime/index.d.ts +65 -0
  150. package/dist/src/builtins/System/Runtime/index.d.ts.map +1 -0
  151. package/dist/src/builtins/System/Runtime/index.js +243 -0
  152. package/dist/src/builtins/System/Runtime/index.js.map +1 -0
  153. package/dist/src/builtins/System/Security/Cryptography/index.d.ts +9 -0
  154. package/dist/src/builtins/System/Security/Cryptography/index.d.ts.map +1 -0
  155. package/dist/src/builtins/System/Security/Cryptography/index.js +14 -0
  156. package/dist/src/builtins/System/Security/Cryptography/index.js.map +1 -0
  157. package/dist/src/builtins/System/Security/Permissions/index.d.ts +67 -0
  158. package/dist/src/builtins/System/Security/Permissions/index.d.ts.map +1 -0
  159. package/dist/src/builtins/System/Security/Permissions/index.js +325 -0
  160. package/dist/src/builtins/System/Security/Permissions/index.js.map +1 -0
  161. package/dist/src/builtins/System/Security/Principal/index.d.ts +27 -0
  162. package/dist/src/builtins/System/Security/Principal/index.d.ts.map +1 -0
  163. package/dist/src/builtins/System/Security/Principal/index.js +104 -0
  164. package/dist/src/builtins/System/Security/Principal/index.js.map +1 -0
  165. package/dist/src/builtins/System/Security/index.d.ts +141 -0
  166. package/dist/src/builtins/System/Security/index.d.ts.map +1 -0
  167. package/dist/src/builtins/System/Security/index.js +590 -0
  168. package/dist/src/builtins/System/Security/index.js.map +1 -0
  169. package/dist/src/builtins/System/Text/Unicode/index.d.ts +12 -0
  170. package/dist/src/builtins/System/Text/Unicode/index.d.ts.map +1 -0
  171. package/dist/src/builtins/System/Text/Unicode/index.js +31 -0
  172. package/dist/src/builtins/System/Text/Unicode/index.js.map +1 -0
  173. package/dist/src/builtins/System/Text/index.d.ts +268 -0
  174. package/dist/src/builtins/System/Text/index.d.ts.map +1 -0
  175. package/dist/src/builtins/System/Text/index.js +1278 -0
  176. package/dist/src/builtins/System/Text/index.js.map +1 -0
  177. package/dist/src/builtins/System/Threading/Tasks/Sources/index.d.ts +32 -0
  178. package/dist/src/builtins/System/Threading/Tasks/Sources/index.d.ts.map +1 -0
  179. package/dist/src/builtins/System/Threading/Tasks/Sources/index.js +117 -0
  180. package/dist/src/builtins/System/Threading/Tasks/Sources/index.js.map +1 -0
  181. package/dist/src/builtins/System/Threading/Tasks/index.d.ts +140 -0
  182. package/dist/src/builtins/System/Threading/Tasks/index.d.ts.map +1 -0
  183. package/dist/src/builtins/System/Threading/Tasks/index.js +621 -0
  184. package/dist/src/builtins/System/Threading/Tasks/index.js.map +1 -0
  185. package/dist/src/builtins/System/Threading/index.d.ts +92 -0
  186. package/dist/src/builtins/System/Threading/index.d.ts.map +1 -0
  187. package/dist/src/builtins/System/Threading/index.js +372 -0
  188. package/dist/src/builtins/System/Threading/index.js.map +1 -0
  189. package/dist/src/builtins/System/index.d.ts +2746 -0
  190. package/dist/src/builtins/System/index.d.ts.map +1 -0
  191. package/dist/src/builtins/System/index.js +13070 -0
  192. package/dist/src/builtins/System/index.js.map +1 -0
  193. package/dist/src/builtins/index.d.ts +3 -0
  194. package/dist/src/builtins/index.d.ts.map +1 -0
  195. package/dist/src/builtins/index.js +3 -0
  196. package/dist/src/builtins/index.js.map +1 -0
  197. package/dist/src/components/access-expression/access-expression.d.ts +3 -3
  198. package/dist/src/components/access-expression/access-expression.d.ts.map +1 -1
  199. package/dist/src/components/enum/declaration.d.ts +2 -2
  200. package/dist/src/components/enum/declaration.d.ts.map +1 -1
  201. package/dist/src/components/enum/declaration.js +3 -3
  202. package/dist/src/components/enum/declaration.js.map +1 -1
  203. package/dist/src/components/enum/declaration.ref.test.js +1 -1
  204. package/dist/src/components/enum/declaration.test.js +15 -1
  205. package/dist/src/components/enum/declaration.test.js.map +1 -1
  206. package/dist/src/components/enum/member.d.ts +2 -2
  207. package/dist/src/components/enum/member.d.ts.map +1 -1
  208. package/dist/src/components/enum/member.js +3 -3
  209. package/dist/src/components/enum/member.js.map +1 -1
  210. package/dist/src/components/enum/member.test.js +24 -1
  211. package/dist/src/components/enum/member.test.js.map +1 -1
  212. package/dist/src/components/field/field.d.ts +2 -2
  213. package/dist/src/components/field/field.d.ts.map +1 -1
  214. package/dist/src/components/field/field.js.map +1 -1
  215. package/dist/src/components/field/field.test.js +19 -1
  216. package/dist/src/components/field/field.test.js.map +1 -1
  217. package/dist/src/components/if/if-statement.d.ts +25 -0
  218. package/dist/src/components/if/if-statement.d.ts.map +1 -0
  219. package/dist/src/components/if/if-statement.js +36 -0
  220. package/dist/src/components/if/if-statement.js.map +1 -0
  221. package/dist/src/components/if/if-statement.test.d.ts +2 -0
  222. package/dist/src/components/if/if-statement.test.d.ts.map +1 -0
  223. package/dist/src/components/if/if-statement.test.js +29 -0
  224. package/dist/src/components/if/if-statement.test.js.map +1 -0
  225. package/dist/src/components/index.d.ts +4 -2
  226. package/dist/src/components/index.d.ts.map +1 -1
  227. package/dist/src/components/index.js +4 -3
  228. package/dist/src/components/index.js.map +1 -1
  229. package/dist/src/components/interface/declaration.d.ts +1 -1
  230. package/dist/src/components/interface/declaration.d.ts.map +1 -1
  231. package/dist/src/components/interface/declaration.js +3 -3
  232. package/dist/src/components/interface/declaration.js.map +1 -1
  233. package/dist/src/components/interface/declaration.test.js +14 -1
  234. package/dist/src/components/interface/declaration.test.js.map +1 -1
  235. package/dist/src/components/interface/method.d.ts +2 -2
  236. package/dist/src/components/interface/method.d.ts.map +1 -1
  237. package/dist/src/components/interface/method.js.map +1 -1
  238. package/dist/src/components/interface/method.test.js +17 -1
  239. package/dist/src/components/interface/method.test.js.map +1 -1
  240. package/dist/src/components/interface/property.d.ts +2 -2
  241. package/dist/src/components/interface/property.d.ts.map +1 -1
  242. package/dist/src/components/interface/property.js.map +1 -1
  243. package/dist/src/components/interface/property.test.js +19 -0
  244. package/dist/src/components/interface/property.test.js.map +1 -1
  245. package/dist/src/components/method/method.js +10 -2
  246. package/dist/src/components/method/method.js.map +1 -1
  247. package/dist/src/components/method/method.test.js +61 -0
  248. package/dist/src/components/method/method.test.js.map +1 -1
  249. package/dist/src/components/namespace/namespace-name.d.ts +10 -0
  250. package/dist/src/components/namespace/namespace-name.d.ts.map +1 -0
  251. package/dist/src/components/namespace/namespace-name.js +20 -0
  252. package/dist/src/components/namespace/namespace-name.js.map +1 -0
  253. package/dist/src/components/{namespace.d.ts → namespace/namespace.d.ts} +3 -1
  254. package/dist/src/components/namespace/namespace.d.ts.map +1 -0
  255. package/dist/src/components/{namespace.js → namespace/namespace.js} +12 -13
  256. package/dist/src/components/namespace/namespace.js.map +1 -0
  257. package/dist/src/components/namespace/namespace.test.d.ts.map +1 -0
  258. package/dist/src/components/namespace/namespace.test.js +207 -0
  259. package/dist/src/components/namespace/namespace.test.js.map +1 -0
  260. package/dist/src/components/namespace.ref.test.js +42 -10
  261. package/dist/src/components/namespace.ref.test.js.map +1 -1
  262. package/dist/src/components/parameters/parameters.d.ts.map +1 -1
  263. package/dist/src/components/parameters/parameters.js +2 -2
  264. package/dist/src/components/parameters/parameters.js.map +1 -1
  265. package/dist/src/components/property/property.d.ts.map +1 -1
  266. package/dist/src/components/property/property.js +21 -12
  267. package/dist/src/components/property/property.js.map +1 -1
  268. package/dist/src/components/property/property.test.js +28 -0
  269. package/dist/src/components/property/property.test.js.map +1 -1
  270. package/dist/src/components/record/declaration.d.ts +1 -1
  271. package/dist/src/components/record/declaration.d.ts.map +1 -1
  272. package/dist/src/components/record/declaration.js +3 -4
  273. package/dist/src/components/record/declaration.js.map +1 -1
  274. package/dist/src/components/record/declaration.test.js +14 -1
  275. package/dist/src/components/record/declaration.test.js.map +1 -1
  276. package/dist/src/components/source-file/source-file.d.ts.map +1 -1
  277. package/dist/src/components/source-file/source-file.js +6 -4
  278. package/dist/src/components/source-file/source-file.js.map +1 -1
  279. package/dist/src/components/source-file/source-file.test.js +1 -1
  280. package/dist/src/components/source-file/using.test.d.ts.map +1 -0
  281. package/dist/{test → src/components/source-file}/using.test.js +30 -49
  282. package/dist/src/components/source-file/using.test.js.map +1 -0
  283. package/dist/src/components/stc/index.d.ts +1 -1
  284. package/dist/src/components/stc/index.d.ts.map +1 -1
  285. package/dist/src/components/stc/index.js +1 -1
  286. package/dist/src/components/stc/index.js.map +1 -1
  287. package/dist/src/components/struct/declaration.d.ts +1 -1
  288. package/dist/src/components/struct/declaration.d.ts.map +1 -1
  289. package/dist/src/components/struct/declaration.js +3 -3
  290. package/dist/src/components/struct/declaration.js.map +1 -1
  291. package/dist/src/components/struct/declaration.test.js +14 -1
  292. package/dist/src/components/struct/declaration.test.js.map +1 -1
  293. package/dist/src/components/type-parameters/type-parameter.d.ts +2 -2
  294. package/dist/src/components/type-parameters/type-parameter.d.ts.map +1 -1
  295. package/dist/src/components/type-parameters/type-parameter.js.map +1 -1
  296. package/dist/src/components/type-parameters/type-parameters.test.js +14 -0
  297. package/dist/src/components/type-parameters/type-parameters.test.js.map +1 -1
  298. package/dist/src/components/using/using.d.ts +28 -0
  299. package/dist/src/components/using/using.d.ts.map +1 -0
  300. package/dist/src/components/using/using.js +37 -0
  301. package/dist/src/components/using/using.js.map +1 -0
  302. package/dist/src/components/using/using.test.d.ts +2 -0
  303. package/dist/src/components/using/using.test.d.ts.map +1 -0
  304. package/dist/src/components/using/using.test.js +19 -0
  305. package/dist/src/components/using/using.test.js.map +1 -0
  306. package/dist/src/components/var/declaration.d.ts +4 -2
  307. package/dist/src/components/var/declaration.d.ts.map +1 -1
  308. package/dist/src/components/var/declaration.js +17 -3
  309. package/dist/src/components/var/declaration.js.map +1 -1
  310. package/dist/src/components/var/declaration.test.js +22 -1
  311. package/dist/src/components/var/declaration.test.js.map +1 -1
  312. package/dist/src/contexts/global-namespace.d.ts +1 -0
  313. package/dist/src/contexts/global-namespace.d.ts.map +1 -1
  314. package/dist/src/contexts/global-namespace.js +6 -1
  315. package/dist/src/contexts/global-namespace.js.map +1 -1
  316. package/dist/src/create-library.d.ts +62 -0
  317. package/dist/src/create-library.d.ts.map +1 -0
  318. package/dist/src/create-library.js +128 -0
  319. package/dist/src/create-library.js.map +1 -0
  320. package/dist/src/create-library.test.d.ts +10 -0
  321. package/dist/src/create-library.test.d.ts.map +1 -0
  322. package/dist/src/create-library.test.js +220 -0
  323. package/dist/src/create-library.test.js.map +1 -0
  324. package/dist/src/index.d.ts +2 -0
  325. package/dist/src/index.d.ts.map +1 -1
  326. package/dist/src/index.js +2 -0
  327. package/dist/src/index.js.map +1 -1
  328. package/dist/src/name-policy.d.ts +1 -1
  329. package/dist/src/name-policy.d.ts.map +1 -1
  330. package/dist/src/name-policy.js +1 -0
  331. package/dist/src/name-policy.js.map +1 -1
  332. package/dist/src/symbols/factories.d.ts +1 -1
  333. package/dist/src/symbols/factories.d.ts.map +1 -1
  334. package/dist/src/symbols/factories.js +27 -7
  335. package/dist/src/symbols/factories.js.map +1 -1
  336. package/dist/src/symbols/named-type.d.ts +3 -3
  337. package/dist/src/symbols/named-type.d.ts.map +1 -1
  338. package/dist/src/symbols/named-type.js.map +1 -1
  339. package/dist/src/symbols/namespace.d.ts +2 -2
  340. package/dist/src/symbols/namespace.d.ts.map +1 -1
  341. package/dist/src/symbols/namespace.js.map +1 -1
  342. package/dist/src/symbols/reference.d.ts.map +1 -1
  343. package/dist/src/symbols/reference.js +3 -3
  344. package/dist/src/symbols/reference.js.map +1 -1
  345. package/dist/test/utils.d.ts +4 -2
  346. package/dist/test/utils.d.ts.map +1 -1
  347. package/dist/test/utils.js +5 -4
  348. package/dist/test/utils.js.map +1 -1
  349. package/dist/tsconfig.tsbuildinfo +1 -1
  350. package/package.json +14 -3
  351. package/scripts/components/library-interface.tsx +41 -0
  352. package/scripts/components/namespace-directory.tsx +104 -0
  353. package/scripts/generate-builtins.tsx +35 -0
  354. package/scripts/process-docfx.tsx +309 -0
  355. package/src/access.test.tsx +49 -0
  356. package/src/access.tsx +70 -0
  357. package/src/builtins/Microsoft/Win32/SafeHandles/index.ts +147 -0
  358. package/src/builtins/Microsoft/Win32/index.ts +8 -0
  359. package/src/builtins/Microsoft/index.ts +8 -0
  360. package/src/builtins/System/Buffers/Text/index.ts +150 -0
  361. package/src/builtins/System/Buffers/index.ts +267 -0
  362. package/src/builtins/System/CodeDom/Compiler/index.ts +160 -0
  363. package/src/builtins/System/CodeDom/index.ts +8 -0
  364. package/src/builtins/System/Collections/Generic/index.ts +439 -0
  365. package/src/builtins/System/Collections/ObjectModel/index.ts +232 -0
  366. package/src/builtins/System/Collections/index.ts +771 -0
  367. package/src/builtins/System/ComponentModel/index.ts +108 -0
  368. package/src/builtins/System/Configuration/Assemblies/index.ts +85 -0
  369. package/src/builtins/System/Configuration/index.ts +8 -0
  370. package/src/builtins/System/Diagnostics/CodeAnalysis/index.ts +858 -0
  371. package/src/builtins/System/Diagnostics/index.ts +620 -0
  372. package/src/builtins/System/Globalization/index.ts +4583 -0
  373. package/src/builtins/System/IO/Enumeration/index.ts +269 -0
  374. package/src/builtins/System/IO/index.ts +3701 -0
  375. package/src/builtins/System/Net/index.ts +52 -0
  376. package/src/builtins/System/Numerics/index.ts +1184 -0
  377. package/src/builtins/System/Reflection/index.ts +5591 -0
  378. package/src/builtins/System/Resources/index.ts +289 -0
  379. package/src/builtins/System/Runtime/CompilerServices/index.ts +1929 -0
  380. package/src/builtins/System/Runtime/ConstrainedExecution/index.ts +129 -0
  381. package/src/builtins/System/Runtime/ExceptionServices/index.ts +80 -0
  382. package/src/builtins/System/Runtime/InteropServices/Marshalling/index.ts +394 -0
  383. package/src/builtins/System/Runtime/InteropServices/Swift/index.ts +65 -0
  384. package/src/builtins/System/Runtime/InteropServices/index.ts +934 -0
  385. package/src/builtins/System/Runtime/Remoting/index.ts +25 -0
  386. package/src/builtins/System/Runtime/Serialization/index.ts +584 -0
  387. package/src/builtins/System/Runtime/Versioning/index.ts +415 -0
  388. package/src/builtins/System/Runtime/index.ts +298 -0
  389. package/src/builtins/System/Security/Cryptography/index.ts +20 -0
  390. package/src/builtins/System/Security/Permissions/index.ts +390 -0
  391. package/src/builtins/System/Security/Principal/index.ts +129 -0
  392. package/src/builtins/System/Security/index.ts +725 -0
  393. package/src/builtins/System/Text/Unicode/index.ts +40 -0
  394. package/src/builtins/System/Text/index.ts +1542 -0
  395. package/src/builtins/System/Threading/Tasks/Sources/index.ts +147 -0
  396. package/src/builtins/System/Threading/Tasks/index.ts +757 -0
  397. package/src/builtins/System/Threading/index.ts +460 -0
  398. package/src/builtins/System/index.ts +15803 -0
  399. package/src/builtins/index.ts +2 -0
  400. package/src/components/access-expression/access-expression.tsx +2 -2
  401. package/src/components/enum/declaration.ref.test.tsx +1 -1
  402. package/src/components/enum/declaration.test.tsx +14 -1
  403. package/src/components/enum/declaration.tsx +4 -3
  404. package/src/components/enum/member.test.tsx +22 -1
  405. package/src/components/enum/member.tsx +4 -4
  406. package/src/components/field/field.test.tsx +14 -1
  407. package/src/components/field/field.tsx +2 -2
  408. package/src/components/if/if-statement.test.tsx +26 -0
  409. package/src/components/if/if-statement.tsx +50 -0
  410. package/src/components/index.ts +4 -2
  411. package/src/components/interface/declaration.test.tsx +11 -1
  412. package/src/components/interface/declaration.tsx +3 -4
  413. package/src/components/interface/method.test.tsx +14 -1
  414. package/src/components/interface/method.tsx +2 -1
  415. package/src/components/interface/property.test.tsx +13 -0
  416. package/src/components/interface/property.tsx +2 -1
  417. package/src/components/method/method.test.tsx +49 -0
  418. package/src/components/method/method.tsx +7 -4
  419. package/src/components/namespace/namespace-name.tsx +31 -0
  420. package/src/components/namespace/namespace.test.tsx +145 -0
  421. package/src/components/{namespace.tsx → namespace/namespace.tsx} +12 -15
  422. package/src/components/namespace.ref.test.tsx +34 -9
  423. package/src/components/parameters/parameters.tsx +7 -2
  424. package/src/components/property/property.test.tsx +25 -0
  425. package/src/components/property/property.tsx +22 -11
  426. package/src/components/record/declaration.test.tsx +11 -1
  427. package/src/components/record/declaration.tsx +3 -4
  428. package/src/components/source-file/source-file.test.tsx +1 -1
  429. package/src/components/source-file/source-file.tsx +4 -4
  430. package/src/components/source-file/using.test.tsx +94 -0
  431. package/src/components/stc/index.ts +1 -1
  432. package/src/components/struct/declaration.test.tsx +11 -1
  433. package/src/components/struct/declaration.tsx +3 -4
  434. package/src/components/type-parameters/type-parameter.tsx +2 -1
  435. package/src/components/type-parameters/type-parameters.test.tsx +9 -0
  436. package/src/components/using/using.test.tsx +15 -0
  437. package/src/components/using/using.tsx +52 -0
  438. package/src/components/var/declaration.test.tsx +16 -1
  439. package/src/components/var/declaration.tsx +17 -2
  440. package/src/contexts/global-namespace.ts +8 -1
  441. package/src/create-library.test.tsx +202 -0
  442. package/src/create-library.ts +270 -0
  443. package/src/index.ts +2 -0
  444. package/src/name-policy.ts +3 -1
  445. package/src/symbols/factories.ts +47 -10
  446. package/src/symbols/named-type.ts +3 -3
  447. package/src/symbols/namespace.ts +2 -2
  448. package/src/symbols/reference.tsx +10 -3
  449. package/temp/api.json +3934 -683
  450. package/test/utils.tsx +6 -3
  451. package/tsconfig.json +11 -2
  452. package/dist/src/components/UsingDirective.d.ts +0 -10
  453. package/dist/src/components/UsingDirective.d.ts.map +0 -1
  454. package/dist/src/components/UsingDirective.js +0 -15
  455. package/dist/src/components/UsingDirective.js.map +0 -1
  456. package/dist/src/components/namespace.d.ts.map +0 -1
  457. package/dist/src/components/namespace.js.map +0 -1
  458. package/dist/src/components/namespace.test.d.ts.map +0 -1
  459. package/dist/src/components/namespace.test.js +0 -79
  460. package/dist/src/components/namespace.test.js.map +0 -1
  461. package/dist/test/using.test.d.ts.map +0 -1
  462. package/dist/test/using.test.js.map +0 -1
  463. package/src/components/UsingDirective.tsx +0 -28
  464. package/src/components/namespace.test.tsx +0 -52
  465. package/test/using.test.tsx +0 -118
  466. /package/dist/src/components/{namespace.test.d.ts → namespace/namespace.test.d.ts} +0 -0
  467. /package/dist/{test → src/components/source-file}/using.test.d.ts +0 -0
@@ -0,0 +1,2 @@
1
+ export { default as Microsoft } from "./Microsoft/index.js";
2
+ export { default as System } from "./System/index.js";
@@ -5,7 +5,7 @@ import {
5
5
  computed,
6
6
  For,
7
7
  isComponentCreator,
8
- Refkey,
8
+ Refkeyable,
9
9
  Show,
10
10
  takeSymbols,
11
11
  } from "@alloy-js/core";
@@ -92,7 +92,7 @@ export interface AccessExpressionPartProps {
92
92
  * A refkey for the symbol whose name becomes this part's identifier. When a refkey is provided for the first
93
93
  * part, it will be fully resolved. Otherwise, just the symbol's name is used.
94
94
  */
95
- refkey?: Refkey;
95
+ refkey?: Refkeyable;
96
96
 
97
97
  /**
98
98
  * The symbol whose name becomes this part's identifier.
@@ -1,4 +1,4 @@
1
- import { Namespace } from "#components/namespace.jsx";
1
+ import { Namespace } from "#components/namespace/namespace.jsx";
2
2
  import { SourceFile } from "#components/source-file/source-file.jsx";
3
3
  import { Output, refkey } from "@alloy-js/core";
4
4
  import { d } from "@alloy-js/core/testing";
@@ -1,4 +1,5 @@
1
- import { toSourceText } from "#test/utils.jsx";
1
+ import { TestNamespace, toSourceText } from "#test/utils.jsx";
2
+ import { namekey } from "@alloy-js/core";
2
3
  import { d } from "@alloy-js/core/testing";
3
4
  import { expect, it } from "vitest";
4
5
  import { EnumDeclaration } from "./declaration.jsx";
@@ -32,3 +33,15 @@ it("applies naming policy to enum and members", () => {
32
33
  }
33
34
  `);
34
35
  });
36
+
37
+ it("takes a namekey", () => {
38
+ const key = namekey("my-enum");
39
+ const tree = (
40
+ <TestNamespace>
41
+ <EnumDeclaration name={key} />
42
+ </TestNamespace>
43
+ );
44
+ expect(tree).toRenderTo(`
45
+ enum MyEnum;
46
+ `);
47
+ });
@@ -3,6 +3,7 @@ import {
3
3
  Children,
4
4
  Declaration,
5
5
  MemberScope,
6
+ Namekey,
6
7
  Refkey,
7
8
  } from "@alloy-js/core";
8
9
  import {
@@ -17,7 +18,7 @@ import { Name } from "../Name.jsx";
17
18
 
18
19
  // properties for creating an enum
19
20
  export interface EnumDeclarationProps extends AccessModifiers {
20
- name: string;
21
+ name: string | Namekey;
21
22
  refkey?: Refkey | Refkey[];
22
23
  children?: Children;
23
24
  }
@@ -43,9 +44,9 @@ export interface EnumDeclarationProps extends AccessModifiers {
43
44
  * ```
44
45
  */
45
46
  export function EnumDeclaration(props: EnumDeclarationProps) {
46
- const name = useCSharpNamePolicy().getName(props.name!, "enum");
47
- const symbol = createNamedTypeSymbol(name, "enum", {
47
+ const symbol = createNamedTypeSymbol(props.name, "enum", {
48
48
  refkeys: props.refkey,
49
+ namePolicy: useCSharpNamePolicy().for("enum"),
49
50
  });
50
51
  const scope = createNamedTypeScope(symbol);
51
52
 
@@ -1,4 +1,5 @@
1
- import { toSourceText } from "#test/utils.jsx";
1
+ import { TestNamespace, toSourceText } from "#test/utils.jsx";
2
+ import { namekey } from "@alloy-js/core";
2
3
  import { d } from "@alloy-js/core/testing";
3
4
  import { expect, it } from "vitest";
4
5
  import { EnumDeclaration } from "./declaration.jsx";
@@ -22,3 +23,23 @@ it("declares enum with members", () => {
22
23
  }
23
24
  `);
24
25
  });
26
+
27
+ it("takes a namekey", () => {
28
+ const memberKey = namekey("MyMember");
29
+ const tree = (
30
+ <TestNamespace>
31
+ <EnumDeclaration name="Foo">
32
+ <EnumMember name={memberKey} />
33
+ </EnumDeclaration>
34
+ <hbr />
35
+ {memberKey};
36
+ </TestNamespace>
37
+ );
38
+ expect(tree).toRenderTo(`
39
+ enum Foo
40
+ {
41
+ MyMember
42
+ }
43
+ Foo.MyMember;
44
+ `);
45
+ });
@@ -1,11 +1,11 @@
1
- import { MemberDeclaration, MemberName, Refkey } from "@alloy-js/core";
1
+ import { MemberDeclaration, MemberName, Namekey, Refkey } from "@alloy-js/core";
2
2
  import { useCSharpNamePolicy } from "../../name-policy.js";
3
3
  import { useNamedTypeScope } from "../../scopes/contexts.js";
4
4
  import { CSharpSymbol } from "../../symbols/csharp.js";
5
5
 
6
6
  // properties for creating a C# enum member
7
7
  export interface EnumMemberProps {
8
- name: string;
8
+ name: string | Namekey;
9
9
  refkey?: Refkey;
10
10
  }
11
11
 
@@ -23,9 +23,9 @@ export function EnumMember(props: EnumMemberProps) {
23
23
  throw new Error("EnumMember must be used within an EnumDeclaration.");
24
24
  }
25
25
 
26
- const name = useCSharpNamePolicy().getName(props.name, "enum-member");
27
- const thisEnumValueSymbol = new CSharpSymbol(name, symbol.members, {
26
+ const thisEnumValueSymbol = new CSharpSymbol(props.name, symbol.members, {
28
27
  refkeys: props.refkey,
28
+ namePolicy: useCSharpNamePolicy().for("enum-member"),
29
29
  });
30
30
 
31
31
  return (
@@ -1,4 +1,4 @@
1
- import { List } from "@alloy-js/core";
1
+ import { List, namekey } from "@alloy-js/core";
2
2
  import { describe, expect, it } from "vitest";
3
3
  import { TestNamespace } from "../../../test/utils.jsx";
4
4
  import { ClassDeclaration } from "../class/declaration.jsx";
@@ -30,6 +30,19 @@ it("declares multiple fields", () => {
30
30
  `);
31
31
  });
32
32
 
33
+ it("takes a namekey", () => {
34
+ expect(
35
+ <Wrapper>
36
+ <Field name={namekey("my-field")} type="string" public />
37
+ </Wrapper>,
38
+ ).toRenderTo(`
39
+ public class TestClass
40
+ {
41
+ public string MyField;
42
+ }
43
+ `);
44
+ });
45
+
33
46
  describe("modifiers", () => {
34
47
  describe("access modifiers", () => {
35
48
  it.each(["public", "private", "protected", "internal"] as const)(
@@ -1,4 +1,4 @@
1
- import { Children, Declaration, Name, Refkey } from "@alloy-js/core";
1
+ import { Children, Declaration, Name, Namekey, Refkey } from "@alloy-js/core";
2
2
  import {
3
3
  AccessModifiers,
4
4
  computeModifiersPrefix,
@@ -28,7 +28,7 @@ const getModifiers = makeModifiers<FieldModifiers>([
28
28
  ]);
29
29
 
30
30
  export interface FieldProps extends AccessModifiers, FieldModifiers {
31
- name: string;
31
+ name: string | Namekey;
32
32
  type: Children;
33
33
  refkey?: Refkey;
34
34
  /** Doc comment */
@@ -0,0 +1,26 @@
1
+ import { d } from "@alloy-js/core/testing";
2
+ import { expect, it } from "vitest";
3
+ import { ElseClause, ElseIfClause, IfStatement } from "./if-statement.jsx";
4
+
5
+ it("works with blocks", () => {
6
+ expect(
7
+ <>
8
+ <IfStatement condition="x === 1">// do thing</IfStatement>
9
+ <ElseIfClause condition="x === 2">// do another thing</ElseIfClause>
10
+ <ElseClause>// do default thing</ElseClause>
11
+ </>,
12
+ ).toRenderTo(d`
13
+ if (x === 1)
14
+ {
15
+ // do thing
16
+ }
17
+ else if (x === 2)
18
+ {
19
+ // do another thing
20
+ }
21
+ else
22
+ {
23
+ // do default thing
24
+ }
25
+ `);
26
+ });
@@ -0,0 +1,50 @@
1
+ import { Block, type Children } from "@alloy-js/core";
2
+
3
+ export interface IfStatementProps {
4
+ condition: Children;
5
+ children: Children;
6
+ }
7
+
8
+ /**
9
+ * An if statement.
10
+ */
11
+ export function IfStatement(props: IfStatementProps) {
12
+ return (
13
+ <>
14
+ if ({props.condition}) <Block newline>{props.children}</Block>
15
+ </>
16
+ );
17
+ }
18
+
19
+ export interface ElseIfClauseProps {
20
+ condition: Children;
21
+ children: Children;
22
+ }
23
+
24
+ /**
25
+ * An else clause with an if statement.
26
+ */
27
+ export function ElseIfClause(props: ElseIfClauseProps) {
28
+ return (
29
+ <>
30
+ <hardline />
31
+ else if ({props.condition}) <Block newline>{props.children}</Block>
32
+ </>
33
+ );
34
+ }
35
+
36
+ export interface ElseClauseProps {
37
+ children: Children;
38
+ }
39
+
40
+ /**
41
+ * The else clause of an if statement.
42
+ */
43
+ export function ElseClause(props: ElseClauseProps) {
44
+ return (
45
+ <>
46
+ <hardline />
47
+ else <Block newline>{props.children}</Block>
48
+ </>
49
+ );
50
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./access-expression/access-expression.jsx";
1
2
  export * from "./attributes/attributes.jsx";
2
3
  export * from "./class/declaration.jsx";
3
4
  export * from "./constructor/constructor.jsx";
@@ -7,6 +8,7 @@ export * from "./doc/from-markdown.jsx";
7
8
  export * from "./enum/declaration.jsx";
8
9
  export * from "./enum/member.jsx";
9
10
  export * from "./field/field.jsx";
11
+ export * from "./if/if-statement.jsx";
10
12
  export * from "./interface/declaration.js";
11
13
  export * from "./interface/method.js";
12
14
  export * from "./interface/property.js";
@@ -15,7 +17,7 @@ export * from "./lexical-scope.jsx";
15
17
  export * from "./method-scope.jsx";
16
18
  export * from "./method/method.jsx";
17
19
  export * from "./Name.js";
18
- export * from "./namespace.js";
20
+ export { Namespace, type NamespaceProps } from "./namespace/namespace.jsx";
19
21
  export * from "./parameters/parameters.jsx";
20
22
  export * from "./ProjectDirectory.js";
21
23
  export * from "./property/property.jsx";
@@ -24,5 +26,5 @@ export * from "./Reference.js";
24
26
  export * from "./source-file/source-file.jsx";
25
27
  export * from "./struct/declaration.jsx";
26
28
  export type { TypeParameterProps } from "./type-parameters/type-parameter.jsx";
27
- export * from "./UsingDirective.js";
29
+ export * from "./using/using.jsx";
28
30
  export * from "./var/declaration.jsx";
@@ -1,4 +1,4 @@
1
- import { List, refkey } from "@alloy-js/core";
1
+ import { List, namekey, refkey } from "@alloy-js/core";
2
2
  import { describe, expect, it } from "vitest";
3
3
  import { TestNamespace } from "../../../test/utils.jsx";
4
4
  import { Attribute } from "../attributes/attributes.jsx";
@@ -59,6 +59,16 @@ it("specify doc comment", () => {
59
59
  `);
60
60
  });
61
61
 
62
+ it("takes a namekey", () => {
63
+ expect(
64
+ <TestNamespace>
65
+ <InterfaceDeclaration name={namekey("my-interface")} />
66
+ </TestNamespace>,
67
+ ).toRenderTo(`
68
+ interface MyInterface;
69
+ `);
70
+ });
71
+
62
72
  describe("with type parameters", () => {
63
73
  it("reference parameters", () => {
64
74
  const typeParameters: TypeParameterProps[] = [
@@ -26,7 +26,7 @@ export interface InterfaceDeclarationProps
26
26
  extends Omit<core.DeclarationProps, "nameKind">,
27
27
  AccessModifiers,
28
28
  InterfaceModifiers {
29
- name: string;
29
+ name: string | core.Namekey;
30
30
 
31
31
  /** Doc comment */
32
32
  doc?: core.Children;
@@ -86,10 +86,9 @@ export interface InterfaceDeclarationProps
86
86
  * ```
87
87
  */
88
88
  export function InterfaceDeclaration(props: InterfaceDeclarationProps) {
89
- const name = useCSharpNamePolicy().getName(props.name!, "interface");
90
-
91
- const symbol = createNamedTypeSymbol(name, "interface", {
89
+ const symbol = createNamedTypeSymbol(props.name!, "interface", {
92
90
  refkeys: props.refkey,
91
+ namePolicy: useCSharpNamePolicy().for("interface"),
93
92
  });
94
93
 
95
94
  // this creates a new scope for the interface definition.
@@ -1,4 +1,4 @@
1
- import { refkey } from "@alloy-js/core";
1
+ import { namekey, refkey } from "@alloy-js/core";
2
2
  import { Children } from "@alloy-js/core/jsx-runtime";
3
3
  import { describe, expect, it } from "vitest";
4
4
  import { TestNamespace } from "../../../test/utils.jsx";
@@ -188,6 +188,19 @@ it("specify attributes", () => {
188
188
  `);
189
189
  });
190
190
 
191
+ it("takes a namekey", () => {
192
+ expect(
193
+ <Wrapper>
194
+ <InterfaceMethod name={namekey("my-method")} />
195
+ </Wrapper>,
196
+ ).toRenderTo(`
197
+ public interface TestInterface
198
+ {
199
+ void MyMethod();
200
+ }
201
+ `);
202
+ });
203
+
191
204
  describe("with type parameters", () => {
192
205
  it("reference parameters", () => {
193
206
  const typeParameters: TypeParameterProps[] = [
@@ -3,6 +3,7 @@ import {
3
3
  Children,
4
4
  MemberDeclaration,
5
5
  MemberName,
6
+ Namekey,
6
7
  Refkey,
7
8
  Scope,
8
9
  } from "@alloy-js/core";
@@ -32,7 +33,7 @@ const getMethodModifier = makeModifiers<InterfaceMethodModifiers>(["new"]);
32
33
  export interface InterfaceMethodProps
33
34
  extends AccessModifiers,
34
35
  InterfaceMethodModifiers {
35
- name: string;
36
+ name: string | Namekey;
36
37
  refkey?: Refkey;
37
38
  children?: Children;
38
39
  parameters?: Array<ParameterProps>;
@@ -1,5 +1,6 @@
1
1
  import { Children } from "@alloy-js/core/jsx-runtime";
2
2
  import { describe, expect, it } from "vitest";
3
+ import { namekey } from "../../../../core/src/refkey.js";
3
4
  import { TestNamespace } from "../../../test/utils.jsx";
4
5
  import { Attribute } from "../attributes/attributes.jsx";
5
6
  import { InterfaceDeclaration } from "./declaration.jsx";
@@ -144,6 +145,18 @@ it("specify doc comment", () => {
144
145
  `);
145
146
  });
146
147
 
148
+ it("takes a namekey", () => {
149
+ expect(
150
+ <Wrapper>
151
+ <InterfaceProperty name={namekey("my-property")} type="string" get />
152
+ </Wrapper>,
153
+ ).toRenderTo(`
154
+ public interface TestInterface
155
+ {
156
+ string MyProperty { get; }
157
+ }
158
+ `);
159
+ });
147
160
  it("specify attributes", () => {
148
161
  expect(
149
162
  <Wrapper>
@@ -4,6 +4,7 @@ import {
4
4
  List,
5
5
  MemberDeclaration,
6
6
  MemberName,
7
+ Namekey,
7
8
  Refkey,
8
9
  } from "@alloy-js/core";
9
10
  import {
@@ -27,7 +28,7 @@ const getModifiers = makeModifiers<InterfacePropertyModifiers>(["new"]);
27
28
  export interface InterfacePropertyProps
28
29
  extends AccessModifiers,
29
30
  InterfacePropertyModifiers {
30
- name: string;
31
+ name: string | Namekey;
31
32
  refkey?: Refkey;
32
33
 
33
34
  /** Property type */
@@ -158,3 +158,52 @@ it("use expression body form", () => {
158
158
  }
159
159
  `);
160
160
  });
161
+
162
+ describe("format", () => {
163
+ it("split expression after => if too long", () => {
164
+ expect(
165
+ <TestNamespace printWidth={60}>
166
+ <ClassDeclaration name="Test">
167
+ <Method public override name="ThisIsAVeryLongMethodName" expression>
168
+ this.WithAVeryLongPropertyName.AndAnEvenLongerMemberName
169
+ </Method>
170
+ </ClassDeclaration>
171
+ </TestNamespace>,
172
+ ).toRenderTo(`
173
+ class Test
174
+ {
175
+ public override void ThisIsAVeryLongMethodName() =>
176
+ this.WithAVeryLongPropertyName.AndAnEvenLongerMemberName;
177
+ }
178
+ `);
179
+ });
180
+
181
+ it("split parameters first if too long", () => {
182
+ expect(
183
+ <TestNamespace printWidth={60}>
184
+ <ClassDeclaration name="Test">
185
+ <Method
186
+ public
187
+ override
188
+ name="ThisIsAVeryLongMethodName"
189
+ expression
190
+ parameters={[
191
+ { name: "firstParameter", type: "int" },
192
+ { name: "secondParameter", type: "string" },
193
+ ]}
194
+ >
195
+ this.Short
196
+ </Method>
197
+ </ClassDeclaration>
198
+ </TestNamespace>,
199
+ ).toRenderTo(`
200
+ class Test
201
+ {
202
+ public override void ThisIsAVeryLongMethodName(
203
+ int firstParameter,
204
+ string secondParameter
205
+ ) => this.Short;
206
+ }
207
+ `);
208
+ });
209
+ });
@@ -154,9 +154,12 @@ export function Method(props: MethodProps) {
154
154
 
155
155
  const ExpressionBody = (props: { children?: Children }) => {
156
156
  return (
157
- <>
158
- {" => "}
159
- {props.children};
160
- </>
157
+ <group>
158
+ {" =>"}
159
+ <indent>
160
+ <line />
161
+ {props.children};
162
+ </indent>
163
+ </group>
161
164
  );
162
165
  };
@@ -0,0 +1,31 @@
1
+ import { useNamespaceContext } from "../../contexts/namespace.js";
2
+ import { NamespaceSymbol } from "../../symbols/namespace.js";
3
+
4
+ /** @internal */
5
+ export interface NamespaceNameProps {
6
+ symbol: NamespaceSymbol;
7
+
8
+ /** If it should print relative to the parent context */
9
+ relative?: boolean;
10
+ }
11
+
12
+ /** @internal */
13
+ export function NamespaceName(props: NamespaceNameProps) {
14
+ const names = [props.symbol.name];
15
+ const parent = props.relative ? useNamespaceContext()?.symbol : undefined;
16
+
17
+ let current = props.symbol.ownerSymbol;
18
+ while (current) {
19
+ if (
20
+ current === parent ||
21
+ !(current instanceof NamespaceSymbol) ||
22
+ current.isGlobal
23
+ ) {
24
+ break;
25
+ }
26
+ names.unshift(current.name);
27
+ current = current.ownerSymbol;
28
+ }
29
+
30
+ return names.join(".");
31
+ }
@@ -0,0 +1,145 @@
1
+ import { TestNamespace } from "#test/utils.jsx";
2
+ import { Output } from "@alloy-js/core";
3
+ import { d } from "@alloy-js/core/testing";
4
+ import { expect, it } from "vitest";
5
+ import { ClassDeclaration } from "../class/declaration.jsx";
6
+ import { SourceFile } from "../source-file/source-file.jsx";
7
+ import { Namespace } from "./namespace.jsx";
8
+
9
+ it("defines multiple namespaces and source files with unique content", () => {
10
+ const tree = (
11
+ <Output>
12
+ <Namespace name="Namespace1">
13
+ <SourceFile path="Model1.cs">
14
+ <ClassDeclaration public name="Model1" />
15
+ </SourceFile>
16
+ <SourceFile path="Model2.cs">
17
+ <ClassDeclaration public name="Model2" />
18
+ </SourceFile>
19
+ </Namespace>
20
+ <Namespace name="Namespace2">
21
+ <SourceFile path="Model3.cs">
22
+ <ClassDeclaration public name="Model3" />
23
+ </SourceFile>
24
+ <SourceFile path="Model4.cs">
25
+ <ClassDeclaration public name="Model4" />
26
+ </SourceFile>
27
+ </Namespace>
28
+ </Output>
29
+ );
30
+
31
+ expect(tree).toRenderTo({
32
+ "Model1.cs": d`
33
+ namespace Namespace1;
34
+
35
+ public class Model1;
36
+ `,
37
+ "Model2.cs": d`
38
+ namespace Namespace1;
39
+
40
+ public class Model2;
41
+ `,
42
+ "Model3.cs": d`
43
+ namespace Namespace2;
44
+
45
+ public class Model3;
46
+ `,
47
+ "Model4.cs": d`
48
+ namespace Namespace2;
49
+
50
+ public class Model4;
51
+ `,
52
+ });
53
+ });
54
+
55
+ it("nest namespaces", () => {
56
+ const tree = (
57
+ <Output>
58
+ <Namespace name={["Namespace1"]}>
59
+ <Namespace name={["Namespace2"]}>
60
+ <SourceFile path="Model1.cs">
61
+ <ClassDeclaration public name="Model1" />
62
+ </SourceFile>
63
+ </Namespace>
64
+ </Namespace>
65
+ </Output>
66
+ );
67
+
68
+ expect(tree).toRenderTo(`
69
+ namespace Namespace1.Namespace2;
70
+
71
+ public class Model1;
72
+ `);
73
+ });
74
+
75
+ it("define nested namespace directly with array", () => {
76
+ const tree = (
77
+ <Output>
78
+ <Namespace name={["Namespace1", "Namespace2"]}>
79
+ <SourceFile path="Model1.cs">
80
+ <ClassDeclaration public name="Model1" />
81
+ </SourceFile>
82
+ </Namespace>
83
+ </Output>
84
+ );
85
+
86
+ expect(tree).toRenderTo(`
87
+ namespace Namespace1.Namespace2;
88
+
89
+ public class Model1;
90
+ `);
91
+ });
92
+
93
+ it("define nested namespace directly as dotted notation", () => {
94
+ const tree = (
95
+ <Output>
96
+ <Namespace name="Namespace1.Namespace2">
97
+ <SourceFile path="Model1.cs">
98
+ <ClassDeclaration public name="Model1" />
99
+ </SourceFile>
100
+ </Namespace>
101
+ </Output>
102
+ );
103
+
104
+ expect(tree).toRenderTo({
105
+ "Model1.cs": d`
106
+ namespace Namespace1.Namespace2;
107
+
108
+ public class Model1;
109
+ `,
110
+ });
111
+ });
112
+
113
+ it("uses a name policy", () => {
114
+ expect(
115
+ <TestNamespace>
116
+ <Namespace name="my-namespace" />
117
+ </TestNamespace>,
118
+ ).toRenderTo(`
119
+ namespace MyNamespace {
120
+
121
+ }
122
+ `);
123
+ });
124
+
125
+ it("define nested namespace in sourcefile", () => {
126
+ const tree = (
127
+ <Output>
128
+ <Namespace name="Base">
129
+ <SourceFile path="Model1.cs">
130
+ <Namespace name="Namespace1.Namespace2">
131
+ <ClassDeclaration public name="Model1" />
132
+ </Namespace>
133
+ </SourceFile>
134
+ </Namespace>
135
+ </Output>
136
+ );
137
+
138
+ expect(tree).toRenderTo(`
139
+ namespace Base {
140
+ namespace Namespace1.Namespace2 {
141
+ public class Model1;
142
+ }
143
+ }
144
+ `);
145
+ });