@alloy-js/csharp 0.21.0-dev.1 → 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 (441) 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.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 +4 -2
  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.js +1 -1
  281. package/dist/src/components/struct/declaration.d.ts +1 -1
  282. package/dist/src/components/struct/declaration.d.ts.map +1 -1
  283. package/dist/src/components/struct/declaration.js +3 -3
  284. package/dist/src/components/struct/declaration.js.map +1 -1
  285. package/dist/src/components/struct/declaration.test.js +14 -1
  286. package/dist/src/components/struct/declaration.test.js.map +1 -1
  287. package/dist/src/components/type-parameters/type-parameter.d.ts +2 -2
  288. package/dist/src/components/type-parameters/type-parameter.d.ts.map +1 -1
  289. package/dist/src/components/type-parameters/type-parameter.js.map +1 -1
  290. package/dist/src/components/type-parameters/type-parameters.test.js +14 -0
  291. package/dist/src/components/type-parameters/type-parameters.test.js.map +1 -1
  292. package/dist/src/components/var/declaration.d.ts +4 -2
  293. package/dist/src/components/var/declaration.d.ts.map +1 -1
  294. package/dist/src/components/var/declaration.js +17 -3
  295. package/dist/src/components/var/declaration.js.map +1 -1
  296. package/dist/src/components/var/declaration.test.js +22 -1
  297. package/dist/src/components/var/declaration.test.js.map +1 -1
  298. package/dist/src/contexts/global-namespace.d.ts +1 -0
  299. package/dist/src/contexts/global-namespace.d.ts.map +1 -1
  300. package/dist/src/contexts/global-namespace.js +6 -1
  301. package/dist/src/contexts/global-namespace.js.map +1 -1
  302. package/dist/src/create-library.d.ts +62 -0
  303. package/dist/src/create-library.d.ts.map +1 -0
  304. package/dist/src/create-library.js +128 -0
  305. package/dist/src/create-library.js.map +1 -0
  306. package/dist/src/create-library.test.d.ts +10 -0
  307. package/dist/src/create-library.test.d.ts.map +1 -0
  308. package/dist/src/create-library.test.js +220 -0
  309. package/dist/src/create-library.test.js.map +1 -0
  310. package/dist/src/index.d.ts +2 -0
  311. package/dist/src/index.d.ts.map +1 -1
  312. package/dist/src/index.js +2 -0
  313. package/dist/src/index.js.map +1 -1
  314. package/dist/src/name-policy.d.ts +1 -1
  315. package/dist/src/name-policy.d.ts.map +1 -1
  316. package/dist/src/name-policy.js +1 -0
  317. package/dist/src/name-policy.js.map +1 -1
  318. package/dist/src/symbols/factories.d.ts +1 -1
  319. package/dist/src/symbols/factories.d.ts.map +1 -1
  320. package/dist/src/symbols/factories.js +27 -7
  321. package/dist/src/symbols/factories.js.map +1 -1
  322. package/dist/src/symbols/named-type.d.ts +3 -3
  323. package/dist/src/symbols/named-type.d.ts.map +1 -1
  324. package/dist/src/symbols/named-type.js.map +1 -1
  325. package/dist/src/symbols/namespace.d.ts +2 -2
  326. package/dist/src/symbols/namespace.d.ts.map +1 -1
  327. package/dist/src/symbols/namespace.js.map +1 -1
  328. package/dist/src/symbols/reference.d.ts.map +1 -1
  329. package/dist/src/symbols/reference.js +3 -3
  330. package/dist/src/symbols/reference.js.map +1 -1
  331. package/dist/test/utils.d.ts +4 -2
  332. package/dist/test/utils.d.ts.map +1 -1
  333. package/dist/test/utils.js +5 -4
  334. package/dist/test/utils.js.map +1 -1
  335. package/dist/tsconfig.tsbuildinfo +1 -1
  336. package/package.json +14 -3
  337. package/scripts/components/library-interface.tsx +41 -0
  338. package/scripts/components/namespace-directory.tsx +104 -0
  339. package/scripts/generate-builtins.tsx +35 -0
  340. package/scripts/process-docfx.tsx +309 -0
  341. package/src/access.test.tsx +49 -0
  342. package/src/access.tsx +70 -0
  343. package/src/builtins/Microsoft/Win32/SafeHandles/index.ts +147 -0
  344. package/src/builtins/Microsoft/Win32/index.ts +8 -0
  345. package/src/builtins/Microsoft/index.ts +8 -0
  346. package/src/builtins/System/Buffers/Text/index.ts +150 -0
  347. package/src/builtins/System/Buffers/index.ts +267 -0
  348. package/src/builtins/System/CodeDom/Compiler/index.ts +160 -0
  349. package/src/builtins/System/CodeDom/index.ts +8 -0
  350. package/src/builtins/System/Collections/Generic/index.ts +439 -0
  351. package/src/builtins/System/Collections/ObjectModel/index.ts +232 -0
  352. package/src/builtins/System/Collections/index.ts +771 -0
  353. package/src/builtins/System/ComponentModel/index.ts +108 -0
  354. package/src/builtins/System/Configuration/Assemblies/index.ts +85 -0
  355. package/src/builtins/System/Configuration/index.ts +8 -0
  356. package/src/builtins/System/Diagnostics/CodeAnalysis/index.ts +858 -0
  357. package/src/builtins/System/Diagnostics/index.ts +620 -0
  358. package/src/builtins/System/Globalization/index.ts +4583 -0
  359. package/src/builtins/System/IO/Enumeration/index.ts +269 -0
  360. package/src/builtins/System/IO/index.ts +3701 -0
  361. package/src/builtins/System/Net/index.ts +52 -0
  362. package/src/builtins/System/Numerics/index.ts +1184 -0
  363. package/src/builtins/System/Reflection/index.ts +5591 -0
  364. package/src/builtins/System/Resources/index.ts +289 -0
  365. package/src/builtins/System/Runtime/CompilerServices/index.ts +1929 -0
  366. package/src/builtins/System/Runtime/ConstrainedExecution/index.ts +129 -0
  367. package/src/builtins/System/Runtime/ExceptionServices/index.ts +80 -0
  368. package/src/builtins/System/Runtime/InteropServices/Marshalling/index.ts +394 -0
  369. package/src/builtins/System/Runtime/InteropServices/Swift/index.ts +65 -0
  370. package/src/builtins/System/Runtime/InteropServices/index.ts +934 -0
  371. package/src/builtins/System/Runtime/Remoting/index.ts +25 -0
  372. package/src/builtins/System/Runtime/Serialization/index.ts +584 -0
  373. package/src/builtins/System/Runtime/Versioning/index.ts +415 -0
  374. package/src/builtins/System/Runtime/index.ts +298 -0
  375. package/src/builtins/System/Security/Cryptography/index.ts +20 -0
  376. package/src/builtins/System/Security/Permissions/index.ts +390 -0
  377. package/src/builtins/System/Security/Principal/index.ts +129 -0
  378. package/src/builtins/System/Security/index.ts +725 -0
  379. package/src/builtins/System/Text/Unicode/index.ts +40 -0
  380. package/src/builtins/System/Text/index.ts +1542 -0
  381. package/src/builtins/System/Threading/Tasks/Sources/index.ts +147 -0
  382. package/src/builtins/System/Threading/Tasks/index.ts +757 -0
  383. package/src/builtins/System/Threading/index.ts +460 -0
  384. package/src/builtins/System/index.ts +15803 -0
  385. package/src/builtins/index.ts +2 -0
  386. package/src/components/access-expression/access-expression.tsx +2 -2
  387. package/src/components/enum/declaration.ref.test.tsx +1 -1
  388. package/src/components/enum/declaration.test.tsx +14 -1
  389. package/src/components/enum/declaration.tsx +4 -3
  390. package/src/components/enum/member.test.tsx +22 -1
  391. package/src/components/enum/member.tsx +4 -4
  392. package/src/components/field/field.test.tsx +14 -1
  393. package/src/components/field/field.tsx +2 -2
  394. package/src/components/if/if-statement.test.tsx +26 -0
  395. package/src/components/if/if-statement.tsx +50 -0
  396. package/src/components/index.ts +3 -1
  397. package/src/components/interface/declaration.test.tsx +11 -1
  398. package/src/components/interface/declaration.tsx +3 -4
  399. package/src/components/interface/method.test.tsx +14 -1
  400. package/src/components/interface/method.tsx +2 -1
  401. package/src/components/interface/property.test.tsx +13 -0
  402. package/src/components/interface/property.tsx +2 -1
  403. package/src/components/method/method.test.tsx +49 -0
  404. package/src/components/method/method.tsx +7 -4
  405. package/src/components/namespace/namespace-name.tsx +31 -0
  406. package/src/components/namespace/namespace.test.tsx +145 -0
  407. package/src/components/{namespace.tsx → namespace/namespace.tsx} +12 -15
  408. package/src/components/namespace.ref.test.tsx +34 -9
  409. package/src/components/parameters/parameters.tsx +7 -2
  410. package/src/components/property/property.test.tsx +25 -0
  411. package/src/components/property/property.tsx +22 -11
  412. package/src/components/record/declaration.test.tsx +11 -1
  413. package/src/components/record/declaration.tsx +3 -4
  414. package/src/components/source-file/source-file.test.tsx +1 -1
  415. package/src/components/source-file/source-file.tsx +2 -2
  416. package/src/components/source-file/using.test.tsx +1 -1
  417. package/src/components/struct/declaration.test.tsx +11 -1
  418. package/src/components/struct/declaration.tsx +3 -4
  419. package/src/components/type-parameters/type-parameter.tsx +2 -1
  420. package/src/components/type-parameters/type-parameters.test.tsx +9 -0
  421. package/src/components/var/declaration.test.tsx +16 -1
  422. package/src/components/var/declaration.tsx +17 -2
  423. package/src/contexts/global-namespace.ts +8 -1
  424. package/src/create-library.test.tsx +202 -0
  425. package/src/create-library.ts +270 -0
  426. package/src/index.ts +2 -0
  427. package/src/name-policy.ts +3 -1
  428. package/src/symbols/factories.ts +47 -10
  429. package/src/symbols/named-type.ts +3 -3
  430. package/src/symbols/namespace.ts +2 -2
  431. package/src/symbols/reference.tsx +10 -3
  432. package/temp/api.json +3868 -712
  433. package/test/utils.tsx +6 -3
  434. package/tsconfig.json +11 -2
  435. package/dist/src/components/namespace.d.ts.map +0 -1
  436. package/dist/src/components/namespace.js.map +0 -1
  437. package/dist/src/components/namespace.test.d.ts.map +0 -1
  438. package/dist/src/components/namespace.test.js +0 -79
  439. package/dist/src/components/namespace.test.js.map +0 -1
  440. package/src/components/namespace.test.tsx +0 -52
  441. /package/dist/src/components/{namespace.test.d.ts → namespace/namespace.test.d.ts} +0 -0
@@ -0,0 +1,202 @@
1
+ import { VarDeclaration } from "#components/index.js";
2
+ import { InvocationExpression } from "#components/invocation-expression/invocation-expression.jsx";
3
+ import { TestNamespace } from "#test/utils.jsx";
4
+ import { List, memberRefkey, namekey, toRefkey } from "@alloy-js/core";
5
+ import { beforeEach, expect, it } from "vitest";
6
+ import { IO } from "./builtins/System/index.js";
7
+ import {
8
+ getGlobalNamespace,
9
+ resetGlobalNamespace,
10
+ } from "./contexts/global-namespace.js";
11
+ import { createLibrary } from "./create-library.js";
12
+ import { NamespaceSymbol } from "./symbols/namespace.js";
13
+
14
+ beforeEach(() => {
15
+ resetGlobalNamespace();
16
+ });
17
+
18
+ it("Creates symbols on demand", () => {
19
+ const System = createLibrary("System", {
20
+ String: {
21
+ kind: "class",
22
+ members: {
23
+ Special: { kind: "class", members: { BeSpecial: { kind: "field" } } },
24
+ Substring: { kind: "method" },
25
+ Length: { kind: "field" },
26
+ Empty: { kind: "field", isStatic: true },
27
+ },
28
+ },
29
+ });
30
+
31
+ const globalNamespace = getGlobalNamespace(undefined);
32
+ const systemNs = globalNamespace.members.symbolNames.get("System")!;
33
+ expect(systemNs).toBeUndefined();
34
+ const _ = toRefkey(System);
35
+ const systemNs2 = globalNamespace.members.symbolNames.get("System")!;
36
+ expect(systemNs2).toBeDefined();
37
+ });
38
+
39
+ it("Can reference types which haven't been created yet", () => {
40
+ const System = createLibrary("System", {
41
+ String: {
42
+ kind: "class",
43
+ members: {
44
+ Special: { kind: "property", type: () => SomeNs.SomeType },
45
+ },
46
+ },
47
+ });
48
+
49
+ const SomeNs = createLibrary("SomeNs", {
50
+ SomeType: {
51
+ kind: "class",
52
+ members: {},
53
+ },
54
+ });
55
+
56
+ const globalNamespace = getGlobalNamespace(undefined);
57
+ const _ = toRefkey(System.String.Special);
58
+ const systemNs2 = globalNamespace.members.symbolNames.get("System")!;
59
+ expect(systemNs2).toBeDefined();
60
+ const someNs = globalNamespace.members.symbolNames.get("SomeNs")!;
61
+ expect(someNs).toBeDefined();
62
+ });
63
+
64
+ it("Works with nested namespaces", () => {
65
+ const IO = createLibrary("System.IO", {
66
+ BinaryReader: {
67
+ kind: "class",
68
+ members: {},
69
+ },
70
+ });
71
+
72
+ const globalNamespace = getGlobalNamespace(undefined);
73
+ const systemNs = globalNamespace.members.symbolNames.get("System")!;
74
+ expect(systemNs).toBeUndefined();
75
+ const _ = toRefkey(IO.BinaryReader);
76
+ const systemNs2 = globalNamespace.members.symbolNames.get("System")!;
77
+ expect(systemNs2).toBeDefined();
78
+ });
79
+
80
+ it("Doesn't create duplicate namespaces", () => {
81
+ const IO = createLibrary("System.IO", {
82
+ BinaryReader: { kind: "class", members: {} },
83
+ BinaryWriter: { kind: "class", members: {} },
84
+ });
85
+
86
+ const Collections = createLibrary("System.Collections", {
87
+ ArrayList: { kind: "class", members: {} },
88
+ });
89
+
90
+ const _refkeys = [
91
+ toRefkey(IO.BinaryReader),
92
+ toRefkey(IO.BinaryWriter),
93
+ toRefkey(Collections.ArrayList),
94
+ ];
95
+
96
+ const globalNamespace = getGlobalNamespace(undefined);
97
+ const systemNs = globalNamespace.members.symbolNames.get(
98
+ "System",
99
+ )! as NamespaceSymbol;
100
+ expect(systemNs).toBeDefined();
101
+ const ioNs = systemNs.members.symbolNames.get("IO")!;
102
+ expect(ioNs).toBeDefined();
103
+ const collectionsNs = systemNs.members.symbolNames.get("Collections")!;
104
+ expect(collectionsNs).toBeDefined();
105
+ });
106
+
107
+ it("renders as a refkey", () => {
108
+ const IO = createLibrary("System.IO", {
109
+ BinaryReader: {
110
+ kind: "class",
111
+ members: {},
112
+ },
113
+ });
114
+
115
+ expect(
116
+ <TestNamespace>
117
+ new <InvocationExpression target={IO.BinaryReader} />;
118
+ </TestNamespace>,
119
+ ).toRenderTo(`
120
+ using System.IO;
121
+
122
+ new BinaryReader();
123
+ `);
124
+ });
125
+
126
+ it("has a refkey getter", () => {
127
+ const IO = createLibrary("System.IO", {
128
+ BinaryReader: {
129
+ kind: "class",
130
+ members: {},
131
+ },
132
+ });
133
+
134
+ const ioKey = toRefkey(IO);
135
+ expect(ioKey).toBeDefined();
136
+ const brKey = toRefkey(IO.BinaryReader);
137
+ expect(brKey).toBeDefined();
138
+ });
139
+
140
+ it("works to reference members", () => {
141
+ const IO = createLibrary("System.IO", {
142
+ BinaryReader: {
143
+ kind: "class",
144
+ members: {
145
+ ReadString: { kind: "method" },
146
+ },
147
+ },
148
+ });
149
+
150
+ const reader = namekey("reader");
151
+
152
+ expect(
153
+ <TestNamespace>
154
+ <VarDeclaration name={reader} type={IO.BinaryReader}>
155
+ new <InvocationExpression target={IO.BinaryReader} />
156
+ </VarDeclaration>
157
+ <hbr />
158
+ <InvocationExpression
159
+ target={memberRefkey(reader, IO.BinaryReader.ReadString)}
160
+ />
161
+ ;
162
+ </TestNamespace>,
163
+ ).toRenderTo(`
164
+ using System.IO;
165
+
166
+ BinaryReader reader = new BinaryReader();
167
+ reader.ReadString();
168
+ `);
169
+ });
170
+
171
+ it("has built-ins available", () => {
172
+ const info = namekey("info");
173
+
174
+ const template = (
175
+ <TestNamespace>
176
+ <List>
177
+ <VarDeclaration name={info}>
178
+ new {IO.FileInfo}("test.txt")
179
+ </VarDeclaration>
180
+ <VarDeclaration name="directoryName">
181
+ {memberRefkey(info, "DirectoryName", "Length")}
182
+ </VarDeclaration>
183
+ </List>
184
+ </TestNamespace>
185
+ );
186
+
187
+ expect(template).toRenderTo(`
188
+ using System.IO;
189
+
190
+ var info = new FileInfo("test.txt");
191
+ var directoryName = info.DirectoryName?.Length;
192
+ `);
193
+ });
194
+
195
+ /**
196
+ <VarDeclaration name={info}>
197
+ new {IO.FileInfo}("test.txt")
198
+ </VarDeclaration>
199
+ <VarDeclaration name="directoryName">
200
+ {access(info, "DirectoryName", "Length")}
201
+ </VarDeclaration>
202
+ */
@@ -0,0 +1,270 @@
1
+ import {
2
+ Binder,
3
+ LibrarySymbolReference,
4
+ refkey,
5
+ REFKEYABLE,
6
+ TO_SYMBOL,
7
+ useBinder,
8
+ } from "@alloy-js/core";
9
+ import { getGlobalNamespace } from "./contexts/global-namespace.js";
10
+ import { MethodKinds, MethodSymbol } from "./index.js";
11
+ import { CSharpSymbol } from "./symbols/csharp.js";
12
+ import { NamedTypeSymbol } from "./symbols/named-type.js";
13
+ import { NamespaceSymbol } from "./symbols/namespace.js";
14
+
15
+ export interface MemberDescriptor {
16
+ kind: string;
17
+ type?: LibrarySymbolReference | (() => LibrarySymbolReference);
18
+ isOverride?: boolean;
19
+ isAbstract?: boolean;
20
+ isVirtual?: boolean;
21
+ isStatic?: boolean;
22
+ isSealed?: boolean;
23
+ isExtern?: boolean;
24
+ isReadOnly?: boolean;
25
+ isNullable?: boolean;
26
+ }
27
+
28
+ export interface NamespaceDescriptor<M> {
29
+ kind: "namespace";
30
+ members: M;
31
+ }
32
+
33
+ export interface FieldDescriptor extends MemberDescriptor {
34
+ kind: "field";
35
+ }
36
+
37
+ export interface MethodDescriptor extends MemberDescriptor {
38
+ kind: "method";
39
+ methodKind: MethodKinds;
40
+ }
41
+
42
+ export interface NamedTypeDescriptor<M> {
43
+ kind: string;
44
+ members: M;
45
+ isAbstract?: boolean;
46
+ isStatic?: boolean;
47
+ isSealed?: boolean;
48
+ }
49
+ export interface ClassDescriptor<M> extends NamedTypeDescriptor<M> {
50
+ kind: "class";
51
+ }
52
+
53
+ export interface PropertyDescriptor extends MemberDescriptor {
54
+ kind: "property";
55
+ }
56
+
57
+ export interface InterfaceDescriptor<M> extends NamedTypeDescriptor<M> {
58
+ kind: "interface";
59
+ }
60
+
61
+ export interface EnumDescriptor<M> extends NamedTypeDescriptor<M> {
62
+ kind: "enum";
63
+ }
64
+
65
+ export interface StructDescriptor<M> extends NamedTypeDescriptor<M> {
66
+ kind: "struct";
67
+ }
68
+
69
+ export interface RecordDescriptor<M> extends NamedTypeDescriptor<M> {
70
+ kind: "record";
71
+ }
72
+
73
+ export interface GenericDescriptor {
74
+ kind: "generic";
75
+ }
76
+
77
+ export type Descriptor =
78
+ | FieldDescriptor
79
+ | MethodDescriptor
80
+ | PropertyDescriptor
81
+ | NamespaceDescriptor<any>
82
+ | ClassDescriptor<any>
83
+ | InterfaceDescriptor<any>
84
+ | EnumDescriptor<any>
85
+ | StructDescriptor<any>
86
+ | RecordDescriptor<any>
87
+ | GenericDescriptor;
88
+
89
+ export type ResolveDescriptor<D> =
90
+ D extends NamedTypeDescriptor<infer M> ?
91
+ LibrarySymbolReference & { [K in keyof M]: ResolveDescriptor<M[K]> }
92
+ : LibrarySymbolReference;
93
+
94
+ export type LibraryFrom<T> = {
95
+ [K in keyof T]: ResolveDescriptor<T[K]>;
96
+ } & LibrarySymbolReference;
97
+
98
+ interface InternalContext {
99
+ binder(): Binder;
100
+ ownerSymbol(): NamedTypeSymbol;
101
+ }
102
+
103
+ export function createLibrary<T extends Record<string, Descriptor>>(
104
+ rootNs: string,
105
+ props: T,
106
+ ): LibraryFrom<T> {
107
+ let binder: Binder | undefined = undefined;
108
+ let ownerSymbol: NamespaceSymbol | undefined = undefined;
109
+ const namespaceNames = rootNs.split(".");
110
+
111
+ return createSymbolEntry(
112
+ namespaceNames.at(-1)!,
113
+ {
114
+ kind: "namespace",
115
+ members: props,
116
+ },
117
+ {
118
+ binder() {
119
+ if (!binder) {
120
+ binder = useBinder();
121
+ }
122
+ return binder!;
123
+ },
124
+ ownerSymbol() {
125
+ if (ownerSymbol) {
126
+ return ownerSymbol;
127
+ }
128
+
129
+ const binder = this.binder();
130
+ ownerSymbol = getGlobalNamespace(binder);
131
+ for (const name of namespaceNames.slice(0, -1)) {
132
+ if (ownerSymbol!.members.symbolNames.has(name)) {
133
+ ownerSymbol = ownerSymbol!.members.symbolNames.get(
134
+ name,
135
+ )! as NamespaceSymbol;
136
+ } else {
137
+ ownerSymbol = new NamespaceSymbol(name, ownerSymbol!, {
138
+ binder,
139
+ refkeys: refkey(),
140
+ });
141
+ }
142
+ }
143
+
144
+ return ownerSymbol;
145
+ },
146
+ },
147
+ ) as LibraryFrom<T>;
148
+ }
149
+
150
+ function createSymbolEntry(
151
+ name: string,
152
+ descriptor: Descriptor,
153
+ context: InternalContext,
154
+ ): LibrarySymbolReference {
155
+ let symbol: CSharpSymbol | undefined = undefined;
156
+
157
+ function getSymbol() {
158
+ if (symbol) return symbol;
159
+
160
+ symbol = createSymbolFromDescriptor(
161
+ name,
162
+ descriptor,
163
+ context,
164
+ initializeMembers,
165
+ );
166
+ return symbol;
167
+ }
168
+
169
+ const newContext: InternalContext = {
170
+ binder: context.binder,
171
+ ownerSymbol() {
172
+ return getSymbol() as NamedTypeSymbol;
173
+ },
174
+ };
175
+
176
+ function initializeMembers() {
177
+ for (const key of Object.keys(obj)) {
178
+ if (typeof key === "symbol") continue;
179
+ (obj as any)[key][TO_SYMBOL]();
180
+ }
181
+ }
182
+
183
+ const obj: LibrarySymbolReference & Record<string, unknown> = {
184
+ [REFKEYABLE]() {
185
+ return getSymbol().refkeys[0];
186
+ },
187
+ [TO_SYMBOL]() {
188
+ return getSymbol();
189
+ },
190
+ };
191
+
192
+ switch (descriptor.kind) {
193
+ case "class":
194
+ case "namespace":
195
+ case "interface":
196
+ case "enum":
197
+ case "struct":
198
+ case "record":
199
+ for (const [memberName, memberDesc] of Object.entries(
200
+ descriptor.members,
201
+ ) as any) {
202
+ obj[memberName] = createSymbolEntry(memberName, memberDesc, newContext);
203
+ }
204
+ break;
205
+ }
206
+
207
+ return obj;
208
+ }
209
+
210
+ function createSymbolFromDescriptor(
211
+ name: string,
212
+ descriptor: Descriptor,
213
+ context: InternalContext,
214
+ lazyMemberInitializer: () => void,
215
+ ): CSharpSymbol {
216
+ const ownerSymbol = context.ownerSymbol();
217
+ const binder = context.binder();
218
+
219
+ switch (descriptor.kind) {
220
+ case "namespace":
221
+ if (ownerSymbol.members.symbolNames.has(name)) {
222
+ return ownerSymbol.members.symbolNames.get(name)! as NamespaceSymbol;
223
+ }
224
+ return new NamespaceSymbol(name, ownerSymbol as NamespaceSymbol, {
225
+ binder,
226
+ refkeys: refkey(),
227
+ lazyMemberInitializer,
228
+ });
229
+ case "class":
230
+ case "enum":
231
+ case "interface":
232
+ case "struct":
233
+ case "record":
234
+ return new NamedTypeSymbol(name, ownerSymbol.members, descriptor.kind, {
235
+ binder,
236
+ refkeys: refkey(),
237
+ lazyMemberInitializer,
238
+ });
239
+ case "method":
240
+ return new MethodSymbol(
241
+ name,
242
+ ownerSymbol.members,
243
+ descriptor.methodKind,
244
+ {
245
+ binder,
246
+ refkeys: refkey(),
247
+ },
248
+ );
249
+ case "field":
250
+ case "property":
251
+ return new CSharpSymbol(name, ownerSymbol.members, {
252
+ binder,
253
+ refkeys: refkey(),
254
+ type:
255
+ descriptor.type === undefined ? undefined
256
+ : typeof descriptor.type === "function" ?
257
+ descriptor.type()[TO_SYMBOL]()
258
+ : descriptor.type[TO_SYMBOL](),
259
+ isNullable: descriptor.isNullable,
260
+ lazyMemberInitializer,
261
+ });
262
+ case "generic":
263
+ return new CSharpSymbol(name, ownerSymbol.members, {
264
+ binder,
265
+ refkeys: refkey(),
266
+ });
267
+ default:
268
+ throw "Unsupported";
269
+ }
270
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
+ export * from "./access.jsx";
1
2
  export * from "./components/index.js";
2
3
  export * from "./contexts/format-options.js";
4
+ export * from "./create-library.js";
3
5
  export * from "./modifiers.js";
4
6
  export * from "./name-policy.js";
5
7
  export * from "./scopes/index.js";
@@ -17,7 +17,8 @@ export type CSharpElements =
17
17
  | "class-method"
18
18
  | "class-property"
19
19
  | "parameter"
20
- | "type-parameter";
20
+ | "type-parameter"
21
+ | "namespace";
21
22
 
22
23
  // creates the C# naming policy
23
24
  export function createCSharpNamePolicy(): core.NamePolicy<CSharpElements> {
@@ -33,6 +34,7 @@ export function createCSharpNamePolicy(): core.NamePolicy<CSharpElements> {
33
34
  case "class-method":
34
35
  case "type-parameter":
35
36
  case "class-property":
37
+ case "namespace":
36
38
  return changecase.pascalCase(name);
37
39
  case "constant":
38
40
  return changecase.constantCase(name);
@@ -6,6 +6,7 @@ import {
6
6
  useBinder,
7
7
  } from "@alloy-js/core";
8
8
  import { getGlobalNamespace } from "../contexts/global-namespace.js";
9
+ import { useNamespaceContext } from "../contexts/namespace.js";
9
10
  import { CSharpElements, useCSharpNamePolicy } from "../name-policy.js";
10
11
  import { CSharpClassScope } from "../scopes/class.js";
11
12
  import { useCSharpScope, useNamedTypeScope } from "../scopes/contexts.js";
@@ -13,10 +14,7 @@ import { CSharpScope } from "../scopes/csharp.js";
13
14
  import { CSharpLexicalScope } from "../scopes/lexical.js";
14
15
  import { CSharpMethodScope } from "../scopes/method.js";
15
16
  import { CSharpNamedTypeScope } from "../scopes/named-type.js";
16
- import {
17
- CSharpNamespaceScope,
18
- useEnclosingNamespaceScope,
19
- } from "../scopes/namespace.js";
17
+ import { CSharpNamespaceScope } from "../scopes/namespace.js";
20
18
  import { CSharpSourceFileScope } from "../scopes/source-file.js";
21
19
  import { CSharpSymbol, CSharpSymbolOptions } from "./csharp.js";
22
20
  import { MethodKinds, MethodSymbol } from "./method.js";
@@ -118,13 +116,52 @@ export function createNamedTypeSymbol(
118
116
  );
119
117
  }
120
118
 
121
- export function createNamespaceSymbol(name: string) {
122
- const scope = useEnclosingNamespaceScope();
123
- const nsSymbol = scope?.ownerSymbol ?? getGlobalNamespace(useBinder());
124
- if (nsSymbol.members.symbolNames.has(name)) {
125
- return nsSymbol.members.symbolNames.get(name)! as NamespaceSymbol;
119
+ export function createNamespaceSymbol(
120
+ name: string | Namekey | (string | Namekey)[],
121
+ options: CSharpSymbolOptions = {},
122
+ ): NamespaceSymbol {
123
+ const scope = useNamespaceContext();
124
+ const parentSymbol = scope?.symbol ?? getGlobalNamespace(useBinder());
125
+ const names = normalizeNamespaceName(name);
126
+ let current = parentSymbol;
127
+ for (const name of names) {
128
+ current = createNamespaceSymbolInternal(name, current, options);
129
+ }
130
+ return current;
131
+ }
132
+
133
+ function normalizeNamespaceName(
134
+ name: string | Namekey | (string | Namekey)[],
135
+ ): (string | Namekey)[] {
136
+ if (Array.isArray(name)) {
137
+ return name;
138
+ }
139
+ if (typeof name === "string" && name.includes(".")) {
140
+ return name.split(".");
126
141
  }
127
- return withCleanup(new NamespaceSymbol(name, nsSymbol));
142
+ return [name];
143
+ }
144
+
145
+ function createNamespaceSymbolInternal(
146
+ name: string | Namekey,
147
+ parentSymbol: NamespaceSymbol,
148
+ options: CSharpSymbolOptions = {},
149
+ ): NamespaceSymbol {
150
+ const namePolicy =
151
+ options.namePolicy ?? useCSharpNamePolicy().for("namespace");
152
+ const expectedName = namePolicy(typeof name === "string" ? name : name.name);
153
+ if (parentSymbol.members.symbolNames.has(expectedName)) {
154
+ return parentSymbol.members.symbolNames.get(
155
+ expectedName,
156
+ )! as NamespaceSymbol;
157
+ }
158
+ return withCleanup(
159
+ new NamespaceSymbol(
160
+ name,
161
+ parentSymbol,
162
+ withNamePolicy(options, "namespace"),
163
+ ),
164
+ );
128
165
  }
129
166
 
130
167
  export interface CreateMethodSymbolOptions extends CSharpSymbolOptions {
@@ -1,5 +1,5 @@
1
- import { Namekey, OutputSpace, OutputSymbolOptions } from "@alloy-js/core";
2
- import { CSharpSymbol } from "./csharp.js";
1
+ import { Namekey, OutputSpace } from "@alloy-js/core";
2
+ import { CSharpSymbol, CSharpSymbolOptions } from "./csharp.js";
3
3
 
4
4
  // represents a symbol from a .cs file. Class, enum, interface etc.
5
5
 
@@ -25,7 +25,7 @@ export class NamedTypeSymbol extends CSharpSymbol {
25
25
  name: string | Namekey,
26
26
  spaces: OutputSpace[] | OutputSpace | undefined,
27
27
  kind: NamedTypeTypeKind,
28
- options?: OutputSymbolOptions,
28
+ options?: CSharpSymbolOptions,
29
29
  ) {
30
30
  super(name, spaces, options);
31
31
  this.#typeKind = kind;
@@ -1,4 +1,4 @@
1
- import { OutputSymbolOptions } from "@alloy-js/core";
1
+ import { Namekey, OutputSymbolOptions } from "@alloy-js/core";
2
2
  import { NamedTypeSymbol } from "./named-type.js";
3
3
 
4
4
  export interface NamespaceSymbolOptions extends OutputSymbolOptions {
@@ -11,7 +11,7 @@ export interface NamespaceSymbolOptions extends OutputSymbolOptions {
11
11
  export class NamespaceSymbol extends NamedTypeSymbol {
12
12
  public readonly symbolKind = "namespace";
13
13
  constructor(
14
- name: string,
14
+ name: string | Namekey,
15
15
  parentNamespace?: NamespaceSymbol,
16
16
  options?: NamespaceSymbolOptions,
17
17
  ) {
@@ -1,5 +1,12 @@
1
1
  import { AccessExpression } from "#components/access-expression/access-expression.jsx";
2
- import { Children, memo, OutputSymbol, Refkey, resolve } from "@alloy-js/core";
2
+ import {
3
+ Children,
4
+ memo,
5
+ OutputSymbol,
6
+ Refkey,
7
+ resolve,
8
+ unresolvedRefkey,
9
+ } from "@alloy-js/core";
3
10
  import { CSharpScope } from "../scopes/csharp.js";
4
11
  import { CSharpNamespaceScope } from "../scopes/namespace.js";
5
12
  import { useSourceFileScope } from "../scopes/source-file.js";
@@ -17,7 +24,7 @@ export function ref(
17
24
  const resolveResult = resolve<CSharpScope, CSharpSymbol>(refkey as Refkey);
18
25
  return memo(() => {
19
26
  if (resolveResult.value === undefined) {
20
- return ["<Unresolved Symbol>", undefined];
27
+ return [unresolvedRefkey(refkey), undefined];
21
28
  }
22
29
 
23
30
  const result = resolveResult.value;
@@ -26,7 +33,7 @@ export function ref(
26
33
 
27
34
  if (!commonScope) {
28
35
  // this shouldn't be possible in csharp.
29
- return ["<Unresolved Symbol>", undefined];
36
+ return [unresolvedRefkey(refkey), undefined];
30
37
  }
31
38
 
32
39
  if (