@alloy-js/csharp 0.21.0-dev.1 → 0.21.0-dev.13

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 (445) 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 +3 -1
  226. package/dist/src/components/index.d.ts.map +1 -1
  227. package/dist/src/components/index.js +3 -2
  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 +15 -0
  263. package/dist/src/components/parameters/parameters.d.ts.map +1 -1
  264. package/dist/src/components/parameters/parameters.js +9 -3
  265. package/dist/src/components/parameters/parameters.js.map +1 -1
  266. package/dist/src/components/parameters/parameters.test.js +36 -0
  267. package/dist/src/components/parameters/parameters.test.js.map +1 -1
  268. package/dist/src/components/property/property.d.ts.map +1 -1
  269. package/dist/src/components/property/property.js +21 -12
  270. package/dist/src/components/property/property.js.map +1 -1
  271. package/dist/src/components/property/property.test.js +28 -0
  272. package/dist/src/components/property/property.test.js.map +1 -1
  273. package/dist/src/components/record/declaration.d.ts +1 -1
  274. package/dist/src/components/record/declaration.d.ts.map +1 -1
  275. package/dist/src/components/record/declaration.js +3 -4
  276. package/dist/src/components/record/declaration.js.map +1 -1
  277. package/dist/src/components/record/declaration.test.js +14 -1
  278. package/dist/src/components/record/declaration.test.js.map +1 -1
  279. package/dist/src/components/source-file/source-file.d.ts.map +1 -1
  280. package/dist/src/components/source-file/source-file.js +4 -2
  281. package/dist/src/components/source-file/source-file.js.map +1 -1
  282. package/dist/src/components/source-file/source-file.test.js +1 -1
  283. package/dist/src/components/source-file/using.test.js +1 -1
  284. package/dist/src/components/struct/declaration.d.ts +1 -1
  285. package/dist/src/components/struct/declaration.d.ts.map +1 -1
  286. package/dist/src/components/struct/declaration.js +3 -3
  287. package/dist/src/components/struct/declaration.js.map +1 -1
  288. package/dist/src/components/struct/declaration.test.js +14 -1
  289. package/dist/src/components/struct/declaration.test.js.map +1 -1
  290. package/dist/src/components/type-parameters/type-parameter.d.ts +2 -2
  291. package/dist/src/components/type-parameters/type-parameter.d.ts.map +1 -1
  292. package/dist/src/components/type-parameters/type-parameter.js.map +1 -1
  293. package/dist/src/components/type-parameters/type-parameters.test.js +14 -0
  294. package/dist/src/components/type-parameters/type-parameters.test.js.map +1 -1
  295. package/dist/src/components/var/declaration.d.ts +4 -2
  296. package/dist/src/components/var/declaration.d.ts.map +1 -1
  297. package/dist/src/components/var/declaration.js +17 -3
  298. package/dist/src/components/var/declaration.js.map +1 -1
  299. package/dist/src/components/var/declaration.test.js +22 -1
  300. package/dist/src/components/var/declaration.test.js.map +1 -1
  301. package/dist/src/contexts/global-namespace.d.ts +1 -0
  302. package/dist/src/contexts/global-namespace.d.ts.map +1 -1
  303. package/dist/src/contexts/global-namespace.js +6 -1
  304. package/dist/src/contexts/global-namespace.js.map +1 -1
  305. package/dist/src/create-library.d.ts +62 -0
  306. package/dist/src/create-library.d.ts.map +1 -0
  307. package/dist/src/create-library.js +128 -0
  308. package/dist/src/create-library.js.map +1 -0
  309. package/dist/src/create-library.test.d.ts +10 -0
  310. package/dist/src/create-library.test.d.ts.map +1 -0
  311. package/dist/src/create-library.test.js +220 -0
  312. package/dist/src/create-library.test.js.map +1 -0
  313. package/dist/src/index.d.ts +2 -0
  314. package/dist/src/index.d.ts.map +1 -1
  315. package/dist/src/index.js +2 -0
  316. package/dist/src/index.js.map +1 -1
  317. package/dist/src/name-policy.d.ts +1 -1
  318. package/dist/src/name-policy.d.ts.map +1 -1
  319. package/dist/src/name-policy.js +1 -0
  320. package/dist/src/name-policy.js.map +1 -1
  321. package/dist/src/symbols/factories.d.ts +1 -1
  322. package/dist/src/symbols/factories.d.ts.map +1 -1
  323. package/dist/src/symbols/factories.js +27 -7
  324. package/dist/src/symbols/factories.js.map +1 -1
  325. package/dist/src/symbols/named-type.d.ts +3 -3
  326. package/dist/src/symbols/named-type.d.ts.map +1 -1
  327. package/dist/src/symbols/named-type.js.map +1 -1
  328. package/dist/src/symbols/namespace.d.ts +2 -2
  329. package/dist/src/symbols/namespace.d.ts.map +1 -1
  330. package/dist/src/symbols/namespace.js.map +1 -1
  331. package/dist/src/symbols/reference.d.ts.map +1 -1
  332. package/dist/src/symbols/reference.js +3 -3
  333. package/dist/src/symbols/reference.js.map +1 -1
  334. package/dist/test/utils.d.ts +4 -2
  335. package/dist/test/utils.d.ts.map +1 -1
  336. package/dist/test/utils.js +5 -4
  337. package/dist/test/utils.js.map +1 -1
  338. package/dist/tsconfig.tsbuildinfo +1 -1
  339. package/package.json +14 -3
  340. package/scripts/components/library-interface.tsx +41 -0
  341. package/scripts/components/namespace-directory.tsx +104 -0
  342. package/scripts/generate-builtins.tsx +35 -0
  343. package/scripts/process-docfx.tsx +309 -0
  344. package/src/access.test.tsx +49 -0
  345. package/src/access.tsx +70 -0
  346. package/src/builtins/Microsoft/Win32/SafeHandles/index.ts +147 -0
  347. package/src/builtins/Microsoft/Win32/index.ts +8 -0
  348. package/src/builtins/Microsoft/index.ts +8 -0
  349. package/src/builtins/System/Buffers/Text/index.ts +150 -0
  350. package/src/builtins/System/Buffers/index.ts +267 -0
  351. package/src/builtins/System/CodeDom/Compiler/index.ts +160 -0
  352. package/src/builtins/System/CodeDom/index.ts +8 -0
  353. package/src/builtins/System/Collections/Generic/index.ts +439 -0
  354. package/src/builtins/System/Collections/ObjectModel/index.ts +232 -0
  355. package/src/builtins/System/Collections/index.ts +771 -0
  356. package/src/builtins/System/ComponentModel/index.ts +108 -0
  357. package/src/builtins/System/Configuration/Assemblies/index.ts +85 -0
  358. package/src/builtins/System/Configuration/index.ts +8 -0
  359. package/src/builtins/System/Diagnostics/CodeAnalysis/index.ts +858 -0
  360. package/src/builtins/System/Diagnostics/index.ts +620 -0
  361. package/src/builtins/System/Globalization/index.ts +4583 -0
  362. package/src/builtins/System/IO/Enumeration/index.ts +269 -0
  363. package/src/builtins/System/IO/index.ts +3701 -0
  364. package/src/builtins/System/Net/index.ts +52 -0
  365. package/src/builtins/System/Numerics/index.ts +1184 -0
  366. package/src/builtins/System/Reflection/index.ts +5591 -0
  367. package/src/builtins/System/Resources/index.ts +289 -0
  368. package/src/builtins/System/Runtime/CompilerServices/index.ts +1929 -0
  369. package/src/builtins/System/Runtime/ConstrainedExecution/index.ts +129 -0
  370. package/src/builtins/System/Runtime/ExceptionServices/index.ts +80 -0
  371. package/src/builtins/System/Runtime/InteropServices/Marshalling/index.ts +394 -0
  372. package/src/builtins/System/Runtime/InteropServices/Swift/index.ts +65 -0
  373. package/src/builtins/System/Runtime/InteropServices/index.ts +934 -0
  374. package/src/builtins/System/Runtime/Remoting/index.ts +25 -0
  375. package/src/builtins/System/Runtime/Serialization/index.ts +584 -0
  376. package/src/builtins/System/Runtime/Versioning/index.ts +415 -0
  377. package/src/builtins/System/Runtime/index.ts +298 -0
  378. package/src/builtins/System/Security/Cryptography/index.ts +20 -0
  379. package/src/builtins/System/Security/Permissions/index.ts +390 -0
  380. package/src/builtins/System/Security/Principal/index.ts +129 -0
  381. package/src/builtins/System/Security/index.ts +725 -0
  382. package/src/builtins/System/Text/Unicode/index.ts +40 -0
  383. package/src/builtins/System/Text/index.ts +1542 -0
  384. package/src/builtins/System/Threading/Tasks/Sources/index.ts +147 -0
  385. package/src/builtins/System/Threading/Tasks/index.ts +757 -0
  386. package/src/builtins/System/Threading/index.ts +460 -0
  387. package/src/builtins/System/index.ts +15803 -0
  388. package/src/builtins/index.ts +2 -0
  389. package/src/components/access-expression/access-expression.tsx +2 -2
  390. package/src/components/enum/declaration.ref.test.tsx +1 -1
  391. package/src/components/enum/declaration.test.tsx +14 -1
  392. package/src/components/enum/declaration.tsx +4 -3
  393. package/src/components/enum/member.test.tsx +22 -1
  394. package/src/components/enum/member.tsx +4 -4
  395. package/src/components/field/field.test.tsx +14 -1
  396. package/src/components/field/field.tsx +2 -2
  397. package/src/components/if/if-statement.test.tsx +26 -0
  398. package/src/components/if/if-statement.tsx +50 -0
  399. package/src/components/index.ts +3 -1
  400. package/src/components/interface/declaration.test.tsx +11 -1
  401. package/src/components/interface/declaration.tsx +3 -4
  402. package/src/components/interface/method.test.tsx +14 -1
  403. package/src/components/interface/method.tsx +2 -1
  404. package/src/components/interface/property.test.tsx +13 -0
  405. package/src/components/interface/property.tsx +2 -1
  406. package/src/components/method/method.test.tsx +49 -0
  407. package/src/components/method/method.tsx +7 -4
  408. package/src/components/namespace/namespace-name.tsx +31 -0
  409. package/src/components/namespace/namespace.test.tsx +145 -0
  410. package/src/components/{namespace.tsx → namespace/namespace.tsx} +12 -15
  411. package/src/components/namespace.ref.test.tsx +34 -9
  412. package/src/components/parameters/parameters.test.tsx +33 -0
  413. package/src/components/parameters/parameters.tsx +24 -2
  414. package/src/components/property/property.test.tsx +25 -0
  415. package/src/components/property/property.tsx +22 -11
  416. package/src/components/record/declaration.test.tsx +11 -1
  417. package/src/components/record/declaration.tsx +3 -4
  418. package/src/components/source-file/source-file.test.tsx +1 -1
  419. package/src/components/source-file/source-file.tsx +2 -2
  420. package/src/components/source-file/using.test.tsx +1 -1
  421. package/src/components/struct/declaration.test.tsx +11 -1
  422. package/src/components/struct/declaration.tsx +3 -4
  423. package/src/components/type-parameters/type-parameter.tsx +2 -1
  424. package/src/components/type-parameters/type-parameters.test.tsx +9 -0
  425. package/src/components/var/declaration.test.tsx +16 -1
  426. package/src/components/var/declaration.tsx +17 -2
  427. package/src/contexts/global-namespace.ts +8 -1
  428. package/src/create-library.test.tsx +202 -0
  429. package/src/create-library.ts +270 -0
  430. package/src/index.ts +2 -0
  431. package/src/name-policy.ts +3 -1
  432. package/src/symbols/factories.ts +47 -10
  433. package/src/symbols/named-type.ts +3 -3
  434. package/src/symbols/namespace.ts +2 -2
  435. package/src/symbols/reference.tsx +10 -3
  436. package/temp/api.json +3282 -98
  437. package/test/utils.tsx +6 -3
  438. package/tsconfig.json +11 -2
  439. package/dist/src/components/namespace.d.ts.map +0 -1
  440. package/dist/src/components/namespace.js.map +0 -1
  441. package/dist/src/components/namespace.test.d.ts.map +0 -1
  442. package/dist/src/components/namespace.test.js +0 -79
  443. package/dist/src/components/namespace.test.js.map +0 -1
  444. package/src/components/namespace.test.tsx +0 -52
  445. /package/dist/src/components/{namespace.test.d.ts → namespace/namespace.test.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alloy-js/csharp",
3
- "version": "0.21.0-dev.1",
3
+ "version": "0.21.0-dev.13",
4
4
  "description": "Alloy components for CSharp language.",
5
5
  "exports": {
6
6
  ".": {
@@ -8,19 +8,28 @@
8
8
  },
9
9
  "./stc": {
10
10
  "import": "./dist/src/components/stc/index.js"
11
+ },
12
+ "./global/*.js": {
13
+ "import": "./dist/src/builtins/*.js"
11
14
  }
12
15
  },
13
16
  "imports": {
14
17
  "#test/*": "./test/*",
15
18
  "#components/*": {
16
19
  "default": "./dist/src/components/*"
20
+ },
21
+ "#createLibrary": {
22
+ "default": "./dist/src/create-library.js"
23
+ },
24
+ "#builtins": {
25
+ "default": "./dist/src/builtins.js"
17
26
  }
18
27
  },
19
28
  "keywords": [],
20
29
  "author": "jhendrix@microsoft.com",
21
30
  "license": "MIT",
22
31
  "dependencies": {
23
- "@alloy-js/core": "~0.20.0 || >= 0.21.0-dev.0",
32
+ "@alloy-js/core": "~0.20.0 || >= 0.21.0-dev.8",
24
33
  "change-case": "^5.4.4",
25
34
  "marked": "^16.1.1",
26
35
  "pathe": "^2.0.3"
@@ -28,11 +37,13 @@
28
37
  "devDependencies": {
29
38
  "@alloy-js/cli": "~0.20.0 || >= 0.21.0-dev.0",
30
39
  "@alloy-js/rollup-plugin": "~0.1.0 || >= 0.1.1-dev.0",
40
+ "@alloy-js/typescript": "~0.20.0 || >= 0.21.0-dev.5",
31
41
  "@microsoft/api-extractor": "~7.52.8",
32
42
  "@rollup/plugin-typescript": "^12.1.2",
33
43
  "concurrently": "^9.2.0",
34
44
  "typescript": "^5.8.3",
35
- "vitest": "^3.2.4"
45
+ "vitest": "^3.2.4",
46
+ "yaml": "^2.8.0"
36
47
  },
37
48
  "type": "module",
38
49
  "scripts": {
@@ -0,0 +1,41 @@
1
+ import { Descriptor } from "#createLibrary";
2
+ import { For } from "@alloy-js/core";
3
+ import {
4
+ InterfaceExpression,
5
+ InterfaceMember,
6
+ TypeDeclaration,
7
+ } from "@alloy-js/typescript";
8
+
9
+ export function LibraryInterfaceDeclaration(props: {
10
+ name: string;
11
+ types: Record<string, Descriptor>;
12
+ }) {
13
+ return (
14
+ <TypeDeclaration name={props.name + "Library"}>
15
+ <LibraryMembersInterface types={props.types} />
16
+ </TypeDeclaration>
17
+ );
18
+ }
19
+
20
+ export function LibraryMembersInterface(props: {
21
+ types: Record<string, Descriptor>;
22
+ }) {
23
+ return (
24
+ <>
25
+ LibrarySymbolReference &{" "}
26
+ <InterfaceExpression>
27
+ <For each={Object.entries(props.types)} semicolon hardline>
28
+ {([name, descriptor]) => {
29
+ return (
30
+ <InterfaceMember name={name}>
31
+ {"members" in descriptor ?
32
+ <LibraryMembersInterface types={descriptor.members} />
33
+ : "LibrarySymbolReference"}
34
+ </InterfaceMember>
35
+ );
36
+ }}
37
+ </For>
38
+ </InterfaceExpression>
39
+ </>
40
+ );
41
+ }
@@ -0,0 +1,104 @@
1
+ import { Descriptor, NamespaceDescriptor } from "#createLibrary";
2
+ import {
3
+ code,
4
+ For,
5
+ namekey,
6
+ refkey,
7
+ Show,
8
+ SourceDirectory,
9
+ } from "@alloy-js/core";
10
+ import {
11
+ ObjectExpression,
12
+ SourceFile,
13
+ VarDeclaration,
14
+ } from "@alloy-js/typescript";
15
+ import { LibraryInterfaceDeclaration } from "./library-interface.jsx";
16
+
17
+ export function NamespaceDirectory(props: {
18
+ name: string;
19
+ fqn: string;
20
+ ns: NamespaceDescriptor<any>;
21
+ }) {
22
+ const subNamespaces = Object.entries(props.ns.members || {}).filter(
23
+ ([, member]) => (member as any).kind === "namespace",
24
+ );
25
+
26
+ const nonNamespaces = Object.entries(props.ns.members || {}).filter(
27
+ ([, member]) => (member as any).kind !== "namespace",
28
+ );
29
+
30
+ if (nonNamespaces.length === 0 && subNamespaces.length === 0) {
31
+ return;
32
+ }
33
+
34
+ let path: string;
35
+ let fqnBase: string;
36
+ if (props.name === "") {
37
+ path = ".";
38
+ fqnBase = "";
39
+ } else {
40
+ path = props.name;
41
+ fqnBase = props.fqn + ".";
42
+ }
43
+
44
+ const typeDescriptor = Object.fromEntries(nonNamespaces) as Record<
45
+ string,
46
+ Descriptor
47
+ >;
48
+
49
+ return (
50
+ <SourceDirectory path={path}>
51
+ <Show when={subNamespaces.length > 0}>
52
+ <For each={subNamespaces}>
53
+ {([memberName, member]) => {
54
+ if ((member as any).kind === "namespace") {
55
+ return (
56
+ <NamespaceDirectory
57
+ name={memberName}
58
+ fqn={fqnBase + memberName}
59
+ ns={member as any}
60
+ />
61
+ );
62
+ }
63
+ }}
64
+ </For>
65
+ </Show>
66
+
67
+ <SourceFile path="index.ts">
68
+ <Show when={props.fqn !== ""}>
69
+ {code`
70
+ import { createLibrary } from "#createLibrary";
71
+ import { LibrarySymbolReference } from "@alloy-js/core";
72
+ `}
73
+ </Show>
74
+ <For each={subNamespaces}>
75
+ {([memberName, member]) => {
76
+ if ((member as any).kind === "namespace") {
77
+ return `export { default as ${memberName} } from "./${memberName}/index.js";`;
78
+ }
79
+ }}
80
+ </For>
81
+ <Show when={props.fqn !== ""}>
82
+ <hbr />
83
+ <hbr />
84
+ <LibraryInterfaceDeclaration name={path} types={typeDescriptor} />
85
+ <hbr />
86
+ <VarDeclaration name={path} type={path + "Library"}>
87
+ createLibrary("{props.fqn}",{" "}
88
+ <ObjectExpression jsValue={typeDescriptor} />
89
+ );
90
+ </VarDeclaration>
91
+ <hbr />
92
+ <VarDeclaration
93
+ name={namekey(path, { ignoreNameConflict: true })}
94
+ refkey={refkey(props.fqn)}
95
+ export
96
+ default
97
+ >
98
+ {path}
99
+ </VarDeclaration>
100
+ </Show>
101
+ </SourceFile>
102
+ </SourceDirectory>
103
+ );
104
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Script to process DocFX YAML outputs (in ./api) into a Record<string, Descriptor>
3
+ * compatible with the `createLibrary` props shape defined in ../src/create-library.ts.
4
+ *
5
+ * Usage (from repo root):
6
+ * tsx packages/csharp/scripts/generate-builtins.ts > /tmp/system-builtins.ts
7
+ *
8
+ * Disclaimer: coded with 🪄 vibes 🔮
9
+ */
10
+
11
+ import { Output, renderAsync, writeOutput } from "@alloy-js/core";
12
+
13
+ import { dirname, join, resolve } from "node:path";
14
+ import { NamespaceDirectory } from "./components/namespace-directory.jsx";
15
+ import { walk } from "./process-docfx.jsx";
16
+
17
+ // Arg[0]=node, Arg[1]=script, Arg[2]=apiDir, Arg[3]=outputPath (unused for now)
18
+ const [, , apiParam, outParam] = process.argv;
19
+ const API_DIR =
20
+ apiParam ?
21
+ resolve(apiParam)
22
+ : join(dirname(new URL(import.meta.url).pathname), "api");
23
+ const OUTPUT_PATH = outParam ? resolve(outParam) : undefined; // reserved for future use
24
+
25
+ console.log("Reading yaml files...");
26
+ const rootNamespace = walk(API_DIR);
27
+
28
+ console.log("Writing library definitions...");
29
+ await writeOutput(
30
+ await renderAsync(
31
+ <Output basePath={OUTPUT_PATH}>
32
+ <NamespaceDirectory name="" fqn="" ns={rootNamespace} />
33
+ </Output>,
34
+ ),
35
+ );
@@ -0,0 +1,309 @@
1
+ import { Descriptor, NamespaceDescriptor } from "#createLibrary";
2
+ import { refkey } from "@alloy-js/core";
3
+ import { ArrowFunction } from "@alloy-js/typescript";
4
+ import { readdirSync, readFileSync, statSync } from "node:fs";
5
+ import { join } from "node:path";
6
+ import { parse as parseYaml } from "yaml";
7
+
8
+ interface DocfxItem {
9
+ uid: string;
10
+ id?: string; // simple id (member name)
11
+ type?: string; // e.g. Class, Struct, Method, Property, Field, Enum, Interface, Constructor
12
+ namespace?: string; // namespace owning the type
13
+ children?: string[]; // child UIDs
14
+ syntax?: { content?: string; return?: { type?: string } };
15
+ }
16
+
17
+ interface DocfxFile {
18
+ items?: DocfxItem[];
19
+ }
20
+
21
+ // Global root namespace descriptor (represents the conceptual global namespace).
22
+ const rootNamespace: NamespaceDescriptor<any> = {
23
+ kind: "namespace",
24
+ members: {},
25
+ } as any;
26
+
27
+ // Track fully-qualified namespace names encountered so we can resolve the most-nested
28
+ // namespace portion of type references later.
29
+ const knownNamespaces = new Set<string>();
30
+ knownNamespaces.add("");
31
+
32
+ function ensureNamespace(path: string[]): {
33
+ members: Record<string, Descriptor>;
34
+ } {
35
+ let members = rootNamespace.members as Record<string, Descriptor>;
36
+ let currentPath: string[] = [];
37
+ for (const nsPart of path) {
38
+ currentPath.push(nsPart);
39
+ if (!members[nsPart]) {
40
+ members[nsPart] = { kind: "namespace", members: {} } as any;
41
+ }
42
+ const existing = members[nsPart];
43
+ if (existing.kind !== "namespace") {
44
+ return { members: (existing as any).members ?? {} };
45
+ }
46
+ members = (existing as any).members;
47
+ knownNamespaces.add(currentPath.join("."));
48
+ }
49
+ return { members };
50
+ }
51
+
52
+ function mapTypeKind(docfxKind: string | undefined): Descriptor["kind"] {
53
+ switch (docfxKind) {
54
+ case "Class":
55
+ return "class";
56
+ case "Struct":
57
+ return "struct";
58
+ case "Enum":
59
+ return "enum";
60
+ case "Interface":
61
+ return "interface";
62
+ // DocFX might emit "Record" in newer versions; support it if present.
63
+ case "Record":
64
+ return "record";
65
+ default:
66
+ return "generic";
67
+ }
68
+ }
69
+
70
+ function isAcceptableIdentifier(name: string): boolean {
71
+ // Accept only alphanumeric names (A-Z a-z 0-9). Anything with underscore, backtick, or other punctuation is skipped.
72
+ return /^[A-Za-z0-9]+$/.test(name);
73
+ }
74
+
75
+ function sanitizeMemberName(id: string | undefined): string | undefined {
76
+ if (!id) return undefined;
77
+ // Drop parameter list for methods / constructors
78
+ const base = id.split("(")[0];
79
+ // Remove leading punctuation (# for constructors)
80
+ let trimmed = base.replace(/^#+/, "");
81
+ // Remove trailing overload artifacts like __1
82
+ trimmed = trimmed.replace(/__\d+$/, "");
83
+ // Drop generic arity for potential generic members (rare): Name`1 -> Name
84
+ trimmed = trimmed.replace(/`\d+$/, "");
85
+ if (!trimmed || !isAcceptableIdentifier(trimmed)) return undefined;
86
+ return trimmed;
87
+ }
88
+
89
+ function parseModifiers(syntaxContent: string | undefined) {
90
+ const mods: Record<string, boolean> = {};
91
+ if (!syntaxContent) return mods;
92
+ // NOTE: simple regex presence checks; this may over-approximate in rare cases (e.g., names containing keywords)
93
+ if (/\bstatic\b/.test(syntaxContent)) mods.isStatic = true;
94
+ if (/\babstract\b/.test(syntaxContent)) mods.isAbstract = true;
95
+ if (/\bvirtual\b/.test(syntaxContent)) mods.isVirtual = true;
96
+ if (/\boverride\b/.test(syntaxContent)) mods.isOverride = true;
97
+ if (/\bsealed\b/.test(syntaxContent)) mods.isSealed = true;
98
+ if (/\bextern\b/.test(syntaxContent)) mods.isExtern = true;
99
+ if (/\breadonly\b/.test(syntaxContent)) mods.isReadOnly = true; // fields, also 'readonly struct' ignored for members
100
+ return mods;
101
+ }
102
+
103
+ function normalizeTypeName(name: string): string {
104
+ if (name.startsWith("ValueTuple`")) return "ValueTuple";
105
+ // Remove synthetic generic arity artifacts like __1, __2 etc.
106
+ return name.replace(/__\d+$/, "");
107
+ }
108
+
109
+ // Remove generic arity markers (`1, `2, etc.) and DocFX placeholder type parameter lists like {{T}}, {{TKey},{TValue}}
110
+ function cleanDocfxType(typeName: string | undefined): string | undefined {
111
+ if (!typeName) return typeName;
112
+ let cleaned = typeName;
113
+ // Strip generic arity markers following identifiers
114
+ cleaned = cleaned.replace(/`\d+/g, "");
115
+ // Remove placeholder generic parameter blocks of the form {{...}}
116
+ cleaned = cleaned.replace(/\{?\{[^}]*\}\}?/g, "");
117
+ // Collapse any duplicate commas/spaces introduced
118
+ cleaned = cleaned.replace(/\s+/g, "");
119
+ cleaned = cleaned.replace(/,+/g, ",");
120
+ cleaned = cleaned.replace(/,+$/g, "");
121
+ return cleaned;
122
+ }
123
+
124
+ function TypeReference(props: { type: string | undefined }) {
125
+ const type = cleanDocfxType(props.type);
126
+ if (!type) return "undefined";
127
+ if (type.endsWith("[]")) {
128
+ return <ArrowFunction>return {refkey("System")}.Array;</ArrowFunction>;
129
+ }
130
+ const parts = type.split(".");
131
+ if (parts.length === 0) return "undefined";
132
+
133
+ // Find the longest prefix that is a known namespace.
134
+ let namespace = "";
135
+ for (let i = parts.length - 1; i >= 0; i--) {
136
+ const candidate = parts.slice(0, i).join(".");
137
+ if (knownNamespaces.has(candidate)) {
138
+ namespace = candidate;
139
+ break;
140
+ }
141
+ }
142
+ let typeName =
143
+ namespace ?
144
+ parts.slice(namespace.split(".").length).join(".")
145
+ : parts.join(".");
146
+ if (!typeName) return "undefined";
147
+
148
+ if (typeName.endsWith("*")) {
149
+ typeName = typeName.slice(0, -1);
150
+ }
151
+ return (
152
+ <ArrowFunction>
153
+ return {refkey(namespace)}.{typeName};
154
+ </ArrowFunction>
155
+ );
156
+ }
157
+ function buildMemberDescriptors(
158
+ items: DocfxItem[],
159
+ leafTypeName: string,
160
+ ): Record<string, Descriptor> {
161
+ const memberDescriptors: Record<string, Descriptor> = {};
162
+ for (const item of items) {
163
+ const memberKind = item.type;
164
+ if (!memberKind) continue;
165
+ if (["Field", "Property", "Method", "Constructor"].includes(memberKind)) {
166
+ const simpleName = sanitizeMemberName(
167
+ item.id || item.uid.split(".").pop(),
168
+ );
169
+ if (!simpleName) continue;
170
+ if (memberDescriptors[simpleName]) continue; // collapse overloads
171
+ // Detect Nullable<T> return types (DocFX form: System.Nullable{T}) so we can
172
+ // mark descriptor.isNullable = true and reference the inner T symbol directly.
173
+ const rawReturnType = item.syntax?.return?.type;
174
+ let isNullable = false;
175
+ let effectiveReturnType = rawReturnType;
176
+ if (rawReturnType) {
177
+ const nullableMatch = /^System\.Nullable\{(.+)\}$/.exec(
178
+ rawReturnType.trim(),
179
+ );
180
+ if (nullableMatch) {
181
+ isNullable = true;
182
+ effectiveReturnType = nullableMatch[1];
183
+ }
184
+ }
185
+ // If still not marked nullable, attempt to detect C# shorthand nullable syntax (Type? Name)
186
+ // by searching the declaration content for a '?' immediately preceding the identifier.
187
+ if (!isNullable && item.syntax?.content) {
188
+ const namePattern = new RegExp(`\\?\\s+${simpleName}\\b`);
189
+ // Quick scan: split at newline to avoid unrelated later usages.
190
+ const firstLine = item.syntax.content.split(/\r?\n/, 1)[0];
191
+ if (namePattern.test(firstLine)) {
192
+ // Ensure the '?' actually belongs to the type token (avoid matching '??').
193
+ // Find the index of the simpleName and inspect preceding chars.
194
+ const idx = firstLine.indexOf(simpleName);
195
+ if (idx > 1) {
196
+ const before = firstLine.slice(0, idx);
197
+ // Trim trailing spaces then check last non-space char
198
+ const trimmed = before.replace(/\s+$/g, "");
199
+ if (trimmed.endsWith("?") && !trimmed.endsWith("??")) {
200
+ isNullable = true;
201
+ }
202
+ }
203
+ }
204
+ }
205
+ switch (memberKind) {
206
+ case "Field":
207
+ memberDescriptors[simpleName] = {
208
+ kind: "field",
209
+ type: (() => <TypeReference type={effectiveReturnType} />) as any,
210
+ ...(isNullable ? { isNullable: true } : {}),
211
+ ...parseModifiers(item.syntax?.content),
212
+ } as any;
213
+ break;
214
+ case "Property":
215
+ memberDescriptors[simpleName] = {
216
+ kind: "property",
217
+ type: (() => <TypeReference type={effectiveReturnType} />) as any,
218
+ ...(isNullable ? { isNullable: true } : {}),
219
+ ...parseModifiers(item.syntax?.content),
220
+ } as any;
221
+ break;
222
+ case "Method":
223
+ memberDescriptors[simpleName] = {
224
+ kind: "method",
225
+ methodKind: "ordinary",
226
+ ...parseModifiers(item.syntax?.content),
227
+ } as any;
228
+ break;
229
+ case "Constructor":
230
+ memberDescriptors[leafTypeName] = {
231
+ kind: "method",
232
+ methodKind: "constructor",
233
+ ...parseModifiers(item.syntax?.content),
234
+ } as any;
235
+ break;
236
+ }
237
+ }
238
+ }
239
+ return memberDescriptors;
240
+ }
241
+
242
+ function addType(file: DocfxFile) {
243
+ if (!file.items || !file.items.length) return;
244
+ const root = file.items[0];
245
+ if (!root.uid || !root.type || !root.namespace) return;
246
+
247
+ const typeKind = mapTypeKind(root.type);
248
+
249
+ const nsParts = root.namespace.split(".");
250
+ const { members: namespaceMembers } = ensureNamespace(nsParts);
251
+
252
+ // Normalize and split potential nested type path (ReadOnlyDictionary`2.KeyCollection)
253
+ const rawId = root.id || root.uid.split(".").pop() || "";
254
+ const normalized = normalizeTypeName(rawId);
255
+ const segments = normalized.split(".").map((s) => s.replace(/`\d+$/, ""));
256
+ if (segments.some((s) => !s || !isAcceptableIdentifier(s))) return;
257
+ const leafName = segments.at(-1)!;
258
+
259
+ // Walk/create parent chain (placeholders) within namespace container
260
+ let container: Record<string, Descriptor> = namespaceMembers;
261
+ for (const parentSeg of segments.slice(0, -1)) {
262
+ const existing = container[parentSeg];
263
+ if (!existing || !(existing as any).members) {
264
+ container[parentSeg] = {
265
+ kind: "class", // placeholder kind
266
+ members: (existing as any)?.members || {},
267
+ } as any;
268
+ }
269
+ container = (container[parentSeg] as any).members;
270
+ }
271
+
272
+ // Avoid overwriting existing rich definition
273
+ if (container[leafName] && (container[leafName] as any).members) return;
274
+
275
+ const typeLevelMods = parseModifiers(root.syntax?.content);
276
+ const namedTypeExtra: Record<string, boolean> = {};
277
+ if (typeLevelMods.isStatic) namedTypeExtra.isStatic = true;
278
+ if (typeLevelMods.isAbstract) namedTypeExtra.isAbstract = true;
279
+ if (typeLevelMods.isSealed) namedTypeExtra.isSealed = true;
280
+
281
+ const memberDescriptors = buildMemberDescriptors(
282
+ file.items.slice(1),
283
+ leafName,
284
+ );
285
+
286
+ container[leafName] = {
287
+ kind: typeKind,
288
+ members: memberDescriptors,
289
+ ...namedTypeExtra,
290
+ } as any;
291
+ }
292
+ export function walk(dir: string) {
293
+ for (const entry of readdirSync(dir)) {
294
+ if (entry.startsWith(".")) continue;
295
+ if (!entry.endsWith(".yml")) continue;
296
+ if (entry === "toc.yml" || entry === ".manifest") continue;
297
+ const full = join(dir, entry);
298
+ if (statSync(full).isDirectory()) continue;
299
+ try {
300
+ const content = readFileSync(full, "utf8");
301
+ const data = parseYaml(content) as DocfxFile;
302
+ addType(data);
303
+ } catch (e) {
304
+ console.warn(`Skipping ${entry}: ${(e as Error).message}`);
305
+ }
306
+ }
307
+
308
+ return rootNamespace;
309
+ }
@@ -0,0 +1,49 @@
1
+ import { expect, it } from "vitest";
2
+ import { access } from "./access.jsx";
3
+
4
+ it("makes a member access expression", () => {
5
+ const template = access("Foo").member("Bar");
6
+ expect(template).toRenderTo(`Foo.Bar`);
7
+ });
8
+
9
+ it("makes a conditional member access expression", () => {
10
+ const template = access("Foo").member("Bar", { conditional: true });
11
+ expect(template).toRenderTo(`Foo?.Bar`);
12
+ });
13
+
14
+ it("handles nullable", () => {
15
+ const template = access("Foo", { nullable: true }).member("Bar");
16
+ expect(template).toRenderTo(`Foo?.Bar`);
17
+ });
18
+
19
+ it("can make calls", () => {
20
+ const template = access("Foo").call([]);
21
+ expect(template).toRenderTo(`Foo()`);
22
+
23
+ const template2 = access("Foo").member("Bar").call([1, 2, 3]);
24
+ expect(template2).toRenderTo(`Foo.Bar(1, 2, 3)`);
25
+
26
+ const template3 = access("Foo").member("Bar").call().member("Baz");
27
+ expect(template3).toRenderTo(`Foo.Bar().Baz`);
28
+
29
+ const template4 = access("Foo").call("Bar", [1, 2, 3]);
30
+ expect(template4).toRenderTo(`Foo.Bar(1, 2, 3)`);
31
+ });
32
+
33
+ it("can do array access", () => {
34
+ const template = access("Foo").index([0]);
35
+ expect(template).toRenderTo(`Foo[0]`);
36
+
37
+ const template2 = access("Foo").index([0, 1]).member("Bar");
38
+ expect(template2).toRenderTo(`Foo[0, 1].Bar`);
39
+ });
40
+
41
+ it("can do complex chains", () => {
42
+ const template = access("Foo")
43
+ .member("Bar", { conditional: true })
44
+ .index([0], { nullable: true })
45
+ .call("Method", [access("Other").call("Method")])
46
+ .member("Baz");
47
+
48
+ expect(template).toRenderTo(`Foo?.Bar[0]?.Method(Other.Method()).Baz`);
49
+ });
package/src/access.tsx ADDED
@@ -0,0 +1,70 @@
1
+ import { Children, isRefkeyable, Refkeyable, RENDERABLE } from "@alloy-js/core";
2
+ import {
3
+ AccessExpression,
4
+ AccessExpressionPartProps,
5
+ } from "./components/access-expression/access-expression.jsx";
6
+ import { CSharpSymbol } from "./symbols/csharp.js";
7
+
8
+ export class AccessExpressionBuilder {
9
+ private _parts: AccessExpressionPartProps[] = [];
10
+
11
+ member(
12
+ member: Refkeyable | string | CSharpSymbol,
13
+ options: AccessExpressionPartProps = {},
14
+ ) {
15
+ if (typeof member === "string") {
16
+ this._parts.push({
17
+ id: member,
18
+ ...options,
19
+ });
20
+ } else if (isRefkeyable(member)) {
21
+ this._parts.push({ refkey: member, ...options });
22
+ } else {
23
+ this._parts.push({ symbol: member, ...options });
24
+ }
25
+
26
+ return this;
27
+ }
28
+
29
+ index(indexerArgs: Children[], options: AccessExpressionPartProps = {}) {
30
+ this._parts.push({ indexerArgs, ...options });
31
+
32
+ return this;
33
+ }
34
+
35
+ call(
36
+ member: Refkeyable | string,
37
+ args?: Children[],
38
+ options?: AccessExpressionPartProps,
39
+ ): this;
40
+ call(args?: Children[], options?: AccessExpressionPartProps): this;
41
+ call(...params: any[]): this {
42
+ if (params.length === 0 || Array.isArray(params[0])) {
43
+ // Signature: call(args?, options?)
44
+ const args: Children[] = (params[0] ?? []) as Children[];
45
+ const options: AccessExpressionPartProps = params[1] ?? {};
46
+ this._parts.push({ args, ...options });
47
+ return this;
48
+ } else {
49
+ const member = params[0] as Refkeyable | string;
50
+ const args: Children[] = (params[1] ?? []) as Children[];
51
+ const options: AccessExpressionPartProps = params[2] ?? {};
52
+ this.member(member);
53
+ this._parts.push({ args, ...options });
54
+ return this;
55
+ }
56
+ }
57
+
58
+ [RENDERABLE]() {
59
+ const parts = this._parts.map((p) => <AccessExpression.Part {...p} />);
60
+ return <AccessExpression children={parts} />;
61
+ }
62
+ }
63
+
64
+ export function access(
65
+ base: Refkeyable | string,
66
+ options: AccessExpressionPartProps = {},
67
+ ) {
68
+ const builder = new AccessExpressionBuilder();
69
+ return builder.member(base, options);
70
+ }