@alloy-js/csharp 0.21.0-dev.0 → 0.21.0-dev.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scripts/components/library-interface.d.ts +9 -0
- package/dist/scripts/components/library-interface.d.ts.map +1 -0
- package/dist/scripts/components/library-interface.js +43 -0
- package/dist/scripts/components/library-interface.js.map +1 -0
- package/dist/scripts/components/namespace-directory.d.ts +7 -0
- package/dist/scripts/components/namespace-directory.d.ts.map +1 -0
- package/dist/scripts/components/namespace-directory.js +96 -0
- package/dist/scripts/components/namespace-directory.js.map +1 -0
- package/dist/scripts/generate-builtins.d.ts +11 -0
- package/dist/scripts/generate-builtins.d.ts.map +1 -0
- package/dist/scripts/generate-builtins.js +35 -0
- package/dist/scripts/generate-builtins.js.map +1 -0
- package/dist/scripts/process-docfx.d.ts +3 -0
- package/dist/scripts/process-docfx.d.ts.map +1 -0
- package/dist/scripts/process-docfx.js +288 -0
- package/dist/scripts/process-docfx.js.map +1 -0
- package/dist/src/access.d.ts +13 -0
- package/dist/src/access.d.ts.map +1 -0
- package/dist/src/access.js +65 -0
- package/dist/src/access.js.map +1 -0
- package/dist/src/access.test.d.ts +2 -0
- package/dist/src/access.test.d.ts.map +1 -0
- package/dist/src/access.test.js +43 -0
- package/dist/src/access.test.js.map +1 -0
- package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.d.ts +32 -0
- package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.d.ts.map +1 -0
- package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.js +117 -0
- package/dist/src/builtins/Microsoft/Win32/SafeHandles/index.js.map +1 -0
- package/dist/src/builtins/Microsoft/Win32/index.d.ts +6 -0
- package/dist/src/builtins/Microsoft/Win32/index.d.ts.map +1 -0
- package/dist/src/builtins/Microsoft/Win32/index.js +5 -0
- package/dist/src/builtins/Microsoft/Win32/index.js.map +1 -0
- package/dist/src/builtins/Microsoft/index.d.ts +6 -0
- package/dist/src/builtins/Microsoft/index.d.ts.map +1 -0
- package/dist/src/builtins/Microsoft/index.js +5 -0
- package/dist/src/builtins/Microsoft/index.js.map +1 -0
- package/dist/src/builtins/System/Buffers/Text/index.d.ts +31 -0
- package/dist/src/builtins/System/Buffers/Text/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Buffers/Text/index.js +122 -0
- package/dist/src/builtins/System/Buffers/Text/index.js.map +1 -0
- package/dist/src/builtins/System/Buffers/index.d.ts +57 -0
- package/dist/src/builtins/System/Buffers/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Buffers/index.js +214 -0
- package/dist/src/builtins/System/Buffers/index.js.map +1 -0
- package/dist/src/builtins/System/CodeDom/Compiler/index.d.ts +31 -0
- package/dist/src/builtins/System/CodeDom/Compiler/index.d.ts.map +1 -0
- package/dist/src/builtins/System/CodeDom/Compiler/index.js +131 -0
- package/dist/src/builtins/System/CodeDom/Compiler/index.js.map +1 -0
- package/dist/src/builtins/System/CodeDom/index.d.ts +6 -0
- package/dist/src/builtins/System/CodeDom/index.d.ts.map +1 -0
- package/dist/src/builtins/System/CodeDom/index.js +5 -0
- package/dist/src/builtins/System/CodeDom/index.js.map +1 -0
- package/dist/src/builtins/System/Collections/Generic/index.d.ts +99 -0
- package/dist/src/builtins/System/Collections/Generic/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Collections/Generic/index.js +342 -0
- package/dist/src/builtins/System/Collections/Generic/index.js.map +1 -0
- package/dist/src/builtins/System/Collections/ObjectModel/index.d.ts +49 -0
- package/dist/src/builtins/System/Collections/ObjectModel/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Collections/ObjectModel/index.js +185 -0
- package/dist/src/builtins/System/Collections/ObjectModel/index.js.map +1 -0
- package/dist/src/builtins/System/Collections/index.d.ts +142 -0
- package/dist/src/builtins/System/Collections/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Collections/index.js +634 -0
- package/dist/src/builtins/System/Collections/index.js.map +1 -0
- package/dist/src/builtins/System/ComponentModel/index.d.ts +24 -0
- package/dist/src/builtins/System/ComponentModel/index.d.ts.map +1 -0
- package/dist/src/builtins/System/ComponentModel/index.js +86 -0
- package/dist/src/builtins/System/ComponentModel/index.js.map +1 -0
- package/dist/src/builtins/System/Configuration/Assemblies/index.d.ts +19 -0
- package/dist/src/builtins/System/Configuration/Assemblies/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Configuration/Assemblies/index.js +69 -0
- package/dist/src/builtins/System/Configuration/Assemblies/index.js.map +1 -0
- package/dist/src/builtins/System/Configuration/index.d.ts +6 -0
- package/dist/src/builtins/System/Configuration/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Configuration/index.js +5 -0
- package/dist/src/builtins/System/Configuration/index.js.map +1 -0
- package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.d.ts +155 -0
- package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.js +705 -0
- package/dist/src/builtins/System/Diagnostics/CodeAnalysis/index.js.map +1 -0
- package/dist/src/builtins/System/Diagnostics/index.d.ts +115 -0
- package/dist/src/builtins/System/Diagnostics/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Diagnostics/index.js +509 -0
- package/dist/src/builtins/System/Diagnostics/index.js.map +1 -0
- package/dist/src/builtins/System/Globalization/index.d.ts +737 -0
- package/dist/src/builtins/System/Globalization/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Globalization/index.js +3848 -0
- package/dist/src/builtins/System/Globalization/index.js.map +1 -0
- package/dist/src/builtins/System/IO/Enumeration/index.d.ts +53 -0
- package/dist/src/builtins/System/IO/Enumeration/index.d.ts.map +1 -0
- package/dist/src/builtins/System/IO/Enumeration/index.js +218 -0
- package/dist/src/builtins/System/IO/Enumeration/index.js.map +1 -0
- package/dist/src/builtins/System/IO/index.d.ts +622 -0
- package/dist/src/builtins/System/IO/index.d.ts.map +1 -0
- package/dist/src/builtins/System/IO/index.js +3083 -0
- package/dist/src/builtins/System/IO/index.js.map +1 -0
- package/dist/src/builtins/System/Net/index.d.ts +14 -0
- package/dist/src/builtins/System/Net/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Net/index.js +41 -0
- package/dist/src/builtins/System/Net/index.js.map +1 -0
- package/dist/src/builtins/System/Numerics/index.d.ts +204 -0
- package/dist/src/builtins/System/Numerics/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Numerics/index.js +952 -0
- package/dist/src/builtins/System/Numerics/index.js.map +1 -0
- package/dist/src/builtins/System/Reflection/index.d.ts +918 -0
- package/dist/src/builtins/System/Reflection/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Reflection/index.js +4675 -0
- package/dist/src/builtins/System/Reflection/index.js.map +1 -0
- package/dist/src/builtins/System/Resources/index.d.ts +56 -0
- package/dist/src/builtins/System/Resources/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Resources/index.js +235 -0
- package/dist/src/builtins/System/Resources/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/CompilerServices/index.d.ts +396 -0
- package/dist/src/builtins/System/Runtime/CompilerServices/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/CompilerServices/index.js +1531 -0
- package/dist/src/builtins/System/Runtime/CompilerServices/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.d.ts +29 -0
- package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.js +103 -0
- package/dist/src/builtins/System/Runtime/ConstrainedExecution/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/ExceptionServices/index.d.ts +20 -0
- package/dist/src/builtins/System/Runtime/ExceptionServices/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/ExceptionServices/index.js +62 -0
- package/dist/src/builtins/System/Runtime/ExceptionServices/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.d.ts +84 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.js +310 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Marshalling/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.d.ts +18 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.js +49 -0
- package/dist/src/builtins/System/Runtime/InteropServices/Swift/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/index.d.ts +165 -0
- package/dist/src/builtins/System/Runtime/InteropServices/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/InteropServices/index.js +774 -0
- package/dist/src/builtins/System/Runtime/InteropServices/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/Remoting/index.d.ts +10 -0
- package/dist/src/builtins/System/Runtime/Remoting/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/Remoting/index.js +18 -0
- package/dist/src/builtins/System/Runtime/Remoting/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/Serialization/index.d.ts +118 -0
- package/dist/src/builtins/System/Runtime/Serialization/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/Serialization/index.js +468 -0
- package/dist/src/builtins/System/Runtime/Serialization/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/Versioning/index.d.ts +81 -0
- package/dist/src/builtins/System/Runtime/Versioning/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/Versioning/index.js +336 -0
- package/dist/src/builtins/System/Runtime/Versioning/index.js.map +1 -0
- package/dist/src/builtins/System/Runtime/index.d.ts +65 -0
- package/dist/src/builtins/System/Runtime/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Runtime/index.js +243 -0
- package/dist/src/builtins/System/Runtime/index.js.map +1 -0
- package/dist/src/builtins/System/Security/Cryptography/index.d.ts +9 -0
- package/dist/src/builtins/System/Security/Cryptography/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Security/Cryptography/index.js +14 -0
- package/dist/src/builtins/System/Security/Cryptography/index.js.map +1 -0
- package/dist/src/builtins/System/Security/Permissions/index.d.ts +67 -0
- package/dist/src/builtins/System/Security/Permissions/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Security/Permissions/index.js +325 -0
- package/dist/src/builtins/System/Security/Permissions/index.js.map +1 -0
- package/dist/src/builtins/System/Security/Principal/index.d.ts +27 -0
- package/dist/src/builtins/System/Security/Principal/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Security/Principal/index.js +104 -0
- package/dist/src/builtins/System/Security/Principal/index.js.map +1 -0
- package/dist/src/builtins/System/Security/index.d.ts +141 -0
- package/dist/src/builtins/System/Security/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Security/index.js +590 -0
- package/dist/src/builtins/System/Security/index.js.map +1 -0
- package/dist/src/builtins/System/Text/Unicode/index.d.ts +12 -0
- package/dist/src/builtins/System/Text/Unicode/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Text/Unicode/index.js +31 -0
- package/dist/src/builtins/System/Text/Unicode/index.js.map +1 -0
- package/dist/src/builtins/System/Text/index.d.ts +268 -0
- package/dist/src/builtins/System/Text/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Text/index.js +1278 -0
- package/dist/src/builtins/System/Text/index.js.map +1 -0
- package/dist/src/builtins/System/Threading/Tasks/Sources/index.d.ts +32 -0
- package/dist/src/builtins/System/Threading/Tasks/Sources/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Threading/Tasks/Sources/index.js +117 -0
- package/dist/src/builtins/System/Threading/Tasks/Sources/index.js.map +1 -0
- package/dist/src/builtins/System/Threading/Tasks/index.d.ts +140 -0
- package/dist/src/builtins/System/Threading/Tasks/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Threading/Tasks/index.js +621 -0
- package/dist/src/builtins/System/Threading/Tasks/index.js.map +1 -0
- package/dist/src/builtins/System/Threading/index.d.ts +92 -0
- package/dist/src/builtins/System/Threading/index.d.ts.map +1 -0
- package/dist/src/builtins/System/Threading/index.js +372 -0
- package/dist/src/builtins/System/Threading/index.js.map +1 -0
- package/dist/src/builtins/System/index.d.ts +2746 -0
- package/dist/src/builtins/System/index.d.ts.map +1 -0
- package/dist/src/builtins/System/index.js +13070 -0
- package/dist/src/builtins/System/index.js.map +1 -0
- package/dist/src/builtins/index.d.ts +3 -0
- package/dist/src/builtins/index.d.ts.map +1 -0
- package/dist/src/builtins/index.js +3 -0
- package/dist/src/builtins/index.js.map +1 -0
- package/dist/src/components/access-expression/access-expression.d.ts +3 -3
- package/dist/src/components/access-expression/access-expression.d.ts.map +1 -1
- package/dist/src/components/enum/declaration.d.ts +2 -2
- package/dist/src/components/enum/declaration.d.ts.map +1 -1
- package/dist/src/components/enum/declaration.js +3 -3
- package/dist/src/components/enum/declaration.js.map +1 -1
- package/dist/src/components/enum/declaration.ref.test.js +1 -1
- package/dist/src/components/enum/declaration.test.js +15 -1
- package/dist/src/components/enum/declaration.test.js.map +1 -1
- package/dist/src/components/enum/member.d.ts +2 -2
- package/dist/src/components/enum/member.d.ts.map +1 -1
- package/dist/src/components/enum/member.js +3 -3
- package/dist/src/components/enum/member.js.map +1 -1
- package/dist/src/components/enum/member.test.js +24 -1
- package/dist/src/components/enum/member.test.js.map +1 -1
- package/dist/src/components/field/field.d.ts +2 -2
- package/dist/src/components/field/field.d.ts.map +1 -1
- package/dist/src/components/field/field.js.map +1 -1
- package/dist/src/components/field/field.test.js +19 -1
- package/dist/src/components/field/field.test.js.map +1 -1
- package/dist/src/components/if/if-statement.d.ts +25 -0
- package/dist/src/components/if/if-statement.d.ts.map +1 -0
- package/dist/src/components/if/if-statement.js +36 -0
- package/dist/src/components/if/if-statement.js.map +1 -0
- package/dist/src/components/if/if-statement.test.d.ts +2 -0
- package/dist/src/components/if/if-statement.test.d.ts.map +1 -0
- package/dist/src/components/if/if-statement.test.js +29 -0
- package/dist/src/components/if/if-statement.test.js.map +1 -0
- package/dist/src/components/index.d.ts +4 -2
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +4 -3
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/interface/declaration.d.ts +1 -1
- package/dist/src/components/interface/declaration.d.ts.map +1 -1
- package/dist/src/components/interface/declaration.js +3 -3
- package/dist/src/components/interface/declaration.js.map +1 -1
- package/dist/src/components/interface/declaration.test.js +14 -1
- package/dist/src/components/interface/declaration.test.js.map +1 -1
- package/dist/src/components/interface/method.d.ts +2 -2
- package/dist/src/components/interface/method.d.ts.map +1 -1
- package/dist/src/components/interface/method.js.map +1 -1
- package/dist/src/components/interface/method.test.js +17 -1
- package/dist/src/components/interface/method.test.js.map +1 -1
- package/dist/src/components/interface/property.d.ts +2 -2
- package/dist/src/components/interface/property.d.ts.map +1 -1
- package/dist/src/components/interface/property.js.map +1 -1
- package/dist/src/components/interface/property.test.js +19 -0
- package/dist/src/components/interface/property.test.js.map +1 -1
- package/dist/src/components/method/method.js +10 -2
- package/dist/src/components/method/method.js.map +1 -1
- package/dist/src/components/method/method.test.js +61 -0
- package/dist/src/components/method/method.test.js.map +1 -1
- package/dist/src/components/namespace/namespace-name.d.ts +10 -0
- package/dist/src/components/namespace/namespace-name.d.ts.map +1 -0
- package/dist/src/components/namespace/namespace-name.js +20 -0
- package/dist/src/components/namespace/namespace-name.js.map +1 -0
- package/dist/src/components/{namespace.d.ts → namespace/namespace.d.ts} +3 -1
- package/dist/src/components/namespace/namespace.d.ts.map +1 -0
- package/dist/src/components/{namespace.js → namespace/namespace.js} +12 -13
- package/dist/src/components/namespace/namespace.js.map +1 -0
- package/dist/src/components/namespace/namespace.test.d.ts.map +1 -0
- package/dist/src/components/namespace/namespace.test.js +207 -0
- package/dist/src/components/namespace/namespace.test.js.map +1 -0
- package/dist/src/components/namespace.ref.test.js +42 -10
- package/dist/src/components/namespace.ref.test.js.map +1 -1
- package/dist/src/components/parameters/parameters.d.ts.map +1 -1
- package/dist/src/components/parameters/parameters.js +2 -2
- package/dist/src/components/parameters/parameters.js.map +1 -1
- package/dist/src/components/property/property.d.ts.map +1 -1
- package/dist/src/components/property/property.js +21 -12
- package/dist/src/components/property/property.js.map +1 -1
- package/dist/src/components/property/property.test.js +28 -0
- package/dist/src/components/property/property.test.js.map +1 -1
- package/dist/src/components/record/declaration.d.ts +1 -1
- package/dist/src/components/record/declaration.d.ts.map +1 -1
- package/dist/src/components/record/declaration.js +3 -4
- package/dist/src/components/record/declaration.js.map +1 -1
- package/dist/src/components/record/declaration.test.js +14 -1
- package/dist/src/components/record/declaration.test.js.map +1 -1
- package/dist/src/components/source-file/source-file.d.ts.map +1 -1
- package/dist/src/components/source-file/source-file.js +6 -4
- package/dist/src/components/source-file/source-file.js.map +1 -1
- package/dist/src/components/source-file/source-file.test.js +1 -1
- package/dist/src/components/source-file/using.test.d.ts.map +1 -0
- package/dist/{test → src/components/source-file}/using.test.js +30 -49
- package/dist/src/components/source-file/using.test.js.map +1 -0
- package/dist/src/components/stc/index.d.ts +1 -1
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +1 -1
- package/dist/src/components/stc/index.js.map +1 -1
- package/dist/src/components/struct/declaration.d.ts +1 -1
- package/dist/src/components/struct/declaration.d.ts.map +1 -1
- package/dist/src/components/struct/declaration.js +3 -3
- package/dist/src/components/struct/declaration.js.map +1 -1
- package/dist/src/components/struct/declaration.test.js +14 -1
- package/dist/src/components/struct/declaration.test.js.map +1 -1
- package/dist/src/components/type-parameters/type-parameter.d.ts +2 -2
- package/dist/src/components/type-parameters/type-parameter.d.ts.map +1 -1
- package/dist/src/components/type-parameters/type-parameter.js.map +1 -1
- package/dist/src/components/type-parameters/type-parameters.test.js +14 -0
- package/dist/src/components/type-parameters/type-parameters.test.js.map +1 -1
- package/dist/src/components/using/using.d.ts +28 -0
- package/dist/src/components/using/using.d.ts.map +1 -0
- package/dist/src/components/using/using.js +37 -0
- package/dist/src/components/using/using.js.map +1 -0
- package/dist/src/components/using/using.test.d.ts +2 -0
- package/dist/src/components/using/using.test.d.ts.map +1 -0
- package/dist/src/components/using/using.test.js +19 -0
- package/dist/src/components/using/using.test.js.map +1 -0
- package/dist/src/components/var/declaration.d.ts +4 -2
- package/dist/src/components/var/declaration.d.ts.map +1 -1
- package/dist/src/components/var/declaration.js +17 -3
- package/dist/src/components/var/declaration.js.map +1 -1
- package/dist/src/components/var/declaration.test.js +22 -1
- package/dist/src/components/var/declaration.test.js.map +1 -1
- package/dist/src/contexts/global-namespace.d.ts +1 -0
- package/dist/src/contexts/global-namespace.d.ts.map +1 -1
- package/dist/src/contexts/global-namespace.js +6 -1
- package/dist/src/contexts/global-namespace.js.map +1 -1
- package/dist/src/create-library.d.ts +62 -0
- package/dist/src/create-library.d.ts.map +1 -0
- package/dist/src/create-library.js +128 -0
- package/dist/src/create-library.js.map +1 -0
- package/dist/src/create-library.test.d.ts +10 -0
- package/dist/src/create-library.test.d.ts.map +1 -0
- package/dist/src/create-library.test.js +220 -0
- package/dist/src/create-library.test.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/name-policy.d.ts +1 -1
- package/dist/src/name-policy.d.ts.map +1 -1
- package/dist/src/name-policy.js +1 -0
- package/dist/src/name-policy.js.map +1 -1
- package/dist/src/symbols/factories.d.ts +1 -1
- package/dist/src/symbols/factories.d.ts.map +1 -1
- package/dist/src/symbols/factories.js +27 -7
- package/dist/src/symbols/factories.js.map +1 -1
- package/dist/src/symbols/named-type.d.ts +3 -3
- package/dist/src/symbols/named-type.d.ts.map +1 -1
- package/dist/src/symbols/named-type.js.map +1 -1
- package/dist/src/symbols/namespace.d.ts +2 -2
- package/dist/src/symbols/namespace.d.ts.map +1 -1
- package/dist/src/symbols/namespace.js.map +1 -1
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js +3 -3
- package/dist/src/symbols/reference.js.map +1 -1
- package/dist/test/utils.d.ts +4 -2
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +5 -4
- package/dist/test/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -3
- package/scripts/components/library-interface.tsx +41 -0
- package/scripts/components/namespace-directory.tsx +104 -0
- package/scripts/generate-builtins.tsx +35 -0
- package/scripts/process-docfx.tsx +309 -0
- package/src/access.test.tsx +49 -0
- package/src/access.tsx +70 -0
- package/src/builtins/Microsoft/Win32/SafeHandles/index.ts +147 -0
- package/src/builtins/Microsoft/Win32/index.ts +8 -0
- package/src/builtins/Microsoft/index.ts +8 -0
- package/src/builtins/System/Buffers/Text/index.ts +150 -0
- package/src/builtins/System/Buffers/index.ts +267 -0
- package/src/builtins/System/CodeDom/Compiler/index.ts +160 -0
- package/src/builtins/System/CodeDom/index.ts +8 -0
- package/src/builtins/System/Collections/Generic/index.ts +439 -0
- package/src/builtins/System/Collections/ObjectModel/index.ts +232 -0
- package/src/builtins/System/Collections/index.ts +771 -0
- package/src/builtins/System/ComponentModel/index.ts +108 -0
- package/src/builtins/System/Configuration/Assemblies/index.ts +85 -0
- package/src/builtins/System/Configuration/index.ts +8 -0
- package/src/builtins/System/Diagnostics/CodeAnalysis/index.ts +858 -0
- package/src/builtins/System/Diagnostics/index.ts +620 -0
- package/src/builtins/System/Globalization/index.ts +4583 -0
- package/src/builtins/System/IO/Enumeration/index.ts +269 -0
- package/src/builtins/System/IO/index.ts +3701 -0
- package/src/builtins/System/Net/index.ts +52 -0
- package/src/builtins/System/Numerics/index.ts +1184 -0
- package/src/builtins/System/Reflection/index.ts +5591 -0
- package/src/builtins/System/Resources/index.ts +289 -0
- package/src/builtins/System/Runtime/CompilerServices/index.ts +1929 -0
- package/src/builtins/System/Runtime/ConstrainedExecution/index.ts +129 -0
- package/src/builtins/System/Runtime/ExceptionServices/index.ts +80 -0
- package/src/builtins/System/Runtime/InteropServices/Marshalling/index.ts +394 -0
- package/src/builtins/System/Runtime/InteropServices/Swift/index.ts +65 -0
- package/src/builtins/System/Runtime/InteropServices/index.ts +934 -0
- package/src/builtins/System/Runtime/Remoting/index.ts +25 -0
- package/src/builtins/System/Runtime/Serialization/index.ts +584 -0
- package/src/builtins/System/Runtime/Versioning/index.ts +415 -0
- package/src/builtins/System/Runtime/index.ts +298 -0
- package/src/builtins/System/Security/Cryptography/index.ts +20 -0
- package/src/builtins/System/Security/Permissions/index.ts +390 -0
- package/src/builtins/System/Security/Principal/index.ts +129 -0
- package/src/builtins/System/Security/index.ts +725 -0
- package/src/builtins/System/Text/Unicode/index.ts +40 -0
- package/src/builtins/System/Text/index.ts +1542 -0
- package/src/builtins/System/Threading/Tasks/Sources/index.ts +147 -0
- package/src/builtins/System/Threading/Tasks/index.ts +757 -0
- package/src/builtins/System/Threading/index.ts +460 -0
- package/src/builtins/System/index.ts +15803 -0
- package/src/builtins/index.ts +2 -0
- package/src/components/access-expression/access-expression.tsx +2 -2
- package/src/components/enum/declaration.ref.test.tsx +1 -1
- package/src/components/enum/declaration.test.tsx +14 -1
- package/src/components/enum/declaration.tsx +4 -3
- package/src/components/enum/member.test.tsx +22 -1
- package/src/components/enum/member.tsx +4 -4
- package/src/components/field/field.test.tsx +14 -1
- package/src/components/field/field.tsx +2 -2
- package/src/components/if/if-statement.test.tsx +26 -0
- package/src/components/if/if-statement.tsx +50 -0
- package/src/components/index.ts +4 -2
- package/src/components/interface/declaration.test.tsx +11 -1
- package/src/components/interface/declaration.tsx +3 -4
- package/src/components/interface/method.test.tsx +14 -1
- package/src/components/interface/method.tsx +2 -1
- package/src/components/interface/property.test.tsx +13 -0
- package/src/components/interface/property.tsx +2 -1
- package/src/components/method/method.test.tsx +49 -0
- package/src/components/method/method.tsx +7 -4
- package/src/components/namespace/namespace-name.tsx +31 -0
- package/src/components/namespace/namespace.test.tsx +145 -0
- package/src/components/{namespace.tsx → namespace/namespace.tsx} +12 -15
- package/src/components/namespace.ref.test.tsx +34 -9
- package/src/components/parameters/parameters.tsx +7 -2
- package/src/components/property/property.test.tsx +25 -0
- package/src/components/property/property.tsx +22 -11
- package/src/components/record/declaration.test.tsx +11 -1
- package/src/components/record/declaration.tsx +3 -4
- package/src/components/source-file/source-file.test.tsx +1 -1
- package/src/components/source-file/source-file.tsx +4 -4
- package/src/components/source-file/using.test.tsx +94 -0
- package/src/components/stc/index.ts +1 -1
- package/src/components/struct/declaration.test.tsx +11 -1
- package/src/components/struct/declaration.tsx +3 -4
- package/src/components/type-parameters/type-parameter.tsx +2 -1
- package/src/components/type-parameters/type-parameters.test.tsx +9 -0
- package/src/components/using/using.test.tsx +15 -0
- package/src/components/using/using.tsx +52 -0
- package/src/components/var/declaration.test.tsx +16 -1
- package/src/components/var/declaration.tsx +17 -2
- package/src/contexts/global-namespace.ts +8 -1
- package/src/create-library.test.tsx +202 -0
- package/src/create-library.ts +270 -0
- package/src/index.ts +2 -0
- package/src/name-policy.ts +3 -1
- package/src/symbols/factories.ts +47 -10
- package/src/symbols/named-type.ts +3 -3
- package/src/symbols/namespace.ts +2 -2
- package/src/symbols/reference.tsx +10 -3
- package/temp/api.json +3934 -683
- package/test/utils.tsx +6 -3
- package/tsconfig.json +11 -2
- package/dist/src/components/UsingDirective.d.ts +0 -10
- package/dist/src/components/UsingDirective.d.ts.map +0 -1
- package/dist/src/components/UsingDirective.js +0 -15
- package/dist/src/components/UsingDirective.js.map +0 -1
- package/dist/src/components/namespace.d.ts.map +0 -1
- package/dist/src/components/namespace.js.map +0 -1
- package/dist/src/components/namespace.test.d.ts.map +0 -1
- package/dist/src/components/namespace.test.js +0 -79
- package/dist/src/components/namespace.test.js.map +0 -1
- package/dist/test/using.test.d.ts.map +0 -1
- package/dist/test/using.test.js.map +0 -1
- package/src/components/UsingDirective.tsx +0 -28
- package/src/components/namespace.test.tsx +0 -52
- package/test/using.test.tsx +0 -118
- /package/dist/src/components/{namespace.test.d.ts → namespace/namespace.test.d.ts} +0 -0
- /package/dist/{test → src/components/source-file}/using.test.d.ts +0 -0
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { Block } from "@alloy-js/core";
|
|
1
|
+
import { Block, Namekey, Refkey } from "@alloy-js/core";
|
|
2
2
|
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { NamespaceContext } from "
|
|
4
|
-
import { useSourceFileScope } from "
|
|
5
|
-
import { createNamespaceSymbol } from "
|
|
6
|
-
import { NamespaceScope } from "
|
|
3
|
+
import { NamespaceContext } from "../../contexts/namespace.js";
|
|
4
|
+
import { useSourceFileScope } from "../../scopes/source-file.js";
|
|
5
|
+
import { createNamespaceSymbol } from "../../symbols/factories.js";
|
|
6
|
+
import { NamespaceScope } from "../namespace-scopes.jsx";
|
|
7
|
+
import { NamespaceName } from "./namespace-name.jsx";
|
|
7
8
|
|
|
8
9
|
export interface NamespaceProps {
|
|
9
|
-
name: string;
|
|
10
|
+
name: string | Namekey | (string | Namekey)[];
|
|
11
|
+
refkey?: Refkey | Refkey[];
|
|
10
12
|
children?: Children;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export function Namespace(props: NamespaceProps) {
|
|
14
|
-
const namespaceSymbol = createNamespaceSymbol(props.name
|
|
16
|
+
const namespaceSymbol = createNamespaceSymbol(props.name, {
|
|
17
|
+
refkeys: props.refkey,
|
|
18
|
+
});
|
|
15
19
|
const sfScope = useSourceFileScope();
|
|
16
20
|
|
|
17
21
|
if (!sfScope) {
|
|
@@ -24,7 +28,7 @@ export function Namespace(props: NamespaceProps) {
|
|
|
24
28
|
sfScope.hasBlockNamespace = true;
|
|
25
29
|
return (
|
|
26
30
|
<>
|
|
27
|
-
namespace {namespaceSymbol
|
|
31
|
+
namespace <NamespaceName symbol={namespaceSymbol} relative />{" "}
|
|
28
32
|
<Block>
|
|
29
33
|
<NamespaceContext.Provider value={{ symbol: namespaceSymbol }}>
|
|
30
34
|
<NamespaceScope symbol={namespaceSymbol}>
|
|
@@ -36,10 +40,3 @@ export function Namespace(props: NamespaceProps) {
|
|
|
36
40
|
);
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
|
-
|
|
40
|
-
/*
|
|
41
|
-
const scope = createCSharpNamespaceScope(namespaceSymbol);
|
|
42
|
-
|
|
43
|
-
return <Scope value={scope}>{props.children}</Scope>;
|
|
44
|
-
}
|
|
45
|
-
*/
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Output, refkey } from "@alloy-js/core";
|
|
2
|
-
import { d } from "@alloy-js/core/testing";
|
|
1
|
+
import { List, memberRefkey, namekey, Output, refkey } from "@alloy-js/core";
|
|
3
2
|
import { expect, it } from "vitest";
|
|
4
3
|
import { ClassDeclaration } from "./class/declaration.jsx";
|
|
5
|
-
import { Namespace } from "./namespace.jsx";
|
|
4
|
+
import { Namespace } from "./namespace/namespace.jsx";
|
|
6
5
|
import { SourceFile } from "./source-file/source-file.jsx";
|
|
7
6
|
|
|
8
7
|
it("references types in the same namespace", () => {
|
|
@@ -20,7 +19,7 @@ it("references types in the same namespace", () => {
|
|
|
20
19
|
</Output>
|
|
21
20
|
);
|
|
22
21
|
|
|
23
|
-
expect(tree).toRenderTo(
|
|
22
|
+
expect(tree).toRenderTo(`
|
|
24
23
|
namespace Test;
|
|
25
24
|
|
|
26
25
|
class TestClass;
|
|
@@ -43,7 +42,7 @@ it("references types in a parent namespace", () => {
|
|
|
43
42
|
</Output>
|
|
44
43
|
);
|
|
45
44
|
|
|
46
|
-
expect(tree).toRenderTo(
|
|
45
|
+
expect(tree).toRenderTo(`
|
|
47
46
|
namespace Test {
|
|
48
47
|
class TestClass;
|
|
49
48
|
namespace Nested {
|
|
@@ -69,7 +68,7 @@ it("references types in a child namespace", () => {
|
|
|
69
68
|
</Output>
|
|
70
69
|
);
|
|
71
70
|
|
|
72
|
-
expect(tree).toRenderTo(
|
|
71
|
+
expect(tree).toRenderTo(`
|
|
73
72
|
namespace Test {
|
|
74
73
|
Nested.TestClass;
|
|
75
74
|
namespace Nested {
|
|
@@ -94,7 +93,7 @@ it("references types in a different top-level namespace declared in the same fil
|
|
|
94
93
|
</Output>
|
|
95
94
|
);
|
|
96
95
|
|
|
97
|
-
expect(tree).toRenderTo(
|
|
96
|
+
expect(tree).toRenderTo(`
|
|
98
97
|
using TestCode2;
|
|
99
98
|
|
|
100
99
|
namespace TestCode1 {
|
|
@@ -123,17 +122,43 @@ it("references types in a different top-level namespace declared in a different
|
|
|
123
122
|
);
|
|
124
123
|
|
|
125
124
|
expect(tree).toRenderTo({
|
|
126
|
-
"test.cs":
|
|
125
|
+
"test.cs": `
|
|
127
126
|
using TestCode2;
|
|
128
127
|
|
|
129
128
|
namespace TestCode1 {
|
|
130
129
|
TestClass;
|
|
131
130
|
}
|
|
132
131
|
`,
|
|
133
|
-
"other.cs":
|
|
132
|
+
"other.cs": `
|
|
134
133
|
namespace TestCode2 {
|
|
135
134
|
class TestClass;
|
|
136
135
|
}
|
|
137
136
|
`,
|
|
138
137
|
});
|
|
139
138
|
});
|
|
139
|
+
|
|
140
|
+
it("can be referenced by refkey", () => {
|
|
141
|
+
const classRef = namekey("TestClass");
|
|
142
|
+
const nsRef = namekey("TestCode2");
|
|
143
|
+
const tree = (
|
|
144
|
+
<Output>
|
|
145
|
+
<SourceFile path="other.cs">
|
|
146
|
+
<List>
|
|
147
|
+
<Namespace name={nsRef}>
|
|
148
|
+
<ClassDeclaration name={classRef} />
|
|
149
|
+
</Namespace>
|
|
150
|
+
<>{memberRefkey(nsRef, classRef)};</>
|
|
151
|
+
</List>
|
|
152
|
+
</SourceFile>
|
|
153
|
+
</Output>
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
expect(tree).toRenderTo(`
|
|
157
|
+
using TestCode2;
|
|
158
|
+
|
|
159
|
+
namespace TestCode2 {
|
|
160
|
+
class TestClass;
|
|
161
|
+
}
|
|
162
|
+
TestClass;
|
|
163
|
+
`);
|
|
164
|
+
});
|
|
@@ -51,9 +51,14 @@ export function Parameters(props: ParametersProps) {
|
|
|
51
51
|
<group>
|
|
52
52
|
{"("}
|
|
53
53
|
{props.parameters && (
|
|
54
|
-
<Indent
|
|
54
|
+
<Indent nobreak>
|
|
55
55
|
<For each={props.parameters} joiner={", "}>
|
|
56
|
-
{(param) =>
|
|
56
|
+
{(param) => (
|
|
57
|
+
<>
|
|
58
|
+
<softline />
|
|
59
|
+
<Parameter {...param} />
|
|
60
|
+
</>
|
|
61
|
+
)}
|
|
57
62
|
</For>
|
|
58
63
|
</Indent>
|
|
59
64
|
)}
|
|
@@ -207,3 +207,28 @@ it("specify attributes", () => {
|
|
|
207
207
|
}
|
|
208
208
|
`);
|
|
209
209
|
});
|
|
210
|
+
|
|
211
|
+
describe("format", () => {
|
|
212
|
+
it("split after = if initializer too long", () => {
|
|
213
|
+
expect(
|
|
214
|
+
<TestNamespace printWidth={60}>
|
|
215
|
+
<ClassDeclaration name="Test">
|
|
216
|
+
<Property
|
|
217
|
+
public
|
|
218
|
+
get
|
|
219
|
+
set
|
|
220
|
+
name="ThisIsAVeryLongPropertyName"
|
|
221
|
+
type="string"
|
|
222
|
+
initializer={`"Some very long initializer value"`}
|
|
223
|
+
/>
|
|
224
|
+
</ClassDeclaration>
|
|
225
|
+
</TestNamespace>,
|
|
226
|
+
).toRenderTo(`
|
|
227
|
+
class Test
|
|
228
|
+
{
|
|
229
|
+
public string ThisIsAVeryLongPropertyName { get; set; } =
|
|
230
|
+
"Some very long initializer value";
|
|
231
|
+
}
|
|
232
|
+
`);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Block,
|
|
3
2
|
Children,
|
|
4
|
-
code,
|
|
5
3
|
createSymbolSlot,
|
|
6
4
|
List,
|
|
7
5
|
MemberDeclaration,
|
|
@@ -142,15 +140,28 @@ export function Property(props: PropertyProps) {
|
|
|
142
140
|
<AttributeList attributes={props.attributes} endline />
|
|
143
141
|
{modifiers}
|
|
144
142
|
<TypeSlot>{props.type}</TypeSlot>
|
|
145
|
-
{props.nullable && "?"} <MemberName />{" "}
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
143
|
+
{props.nullable && "?"} <MemberName /> {"{ "}
|
|
144
|
+
<List joiner=" ">
|
|
145
|
+
{props.get && "get;"}
|
|
146
|
+
{props.set && "set;"}
|
|
147
|
+
{props.init && "init;"}
|
|
148
|
+
</List>
|
|
149
|
+
{" }"}
|
|
150
|
+
{props.initializer && (
|
|
151
|
+
<PropertyInitializer>{props.initializer}</PropertyInitializer>
|
|
152
|
+
)}
|
|
154
153
|
</MemberDeclaration>
|
|
155
154
|
);
|
|
156
155
|
}
|
|
156
|
+
|
|
157
|
+
function PropertyInitializer(props: { children: Children }) {
|
|
158
|
+
return (
|
|
159
|
+
<group>
|
|
160
|
+
{" ="}
|
|
161
|
+
<indent>
|
|
162
|
+
<line />
|
|
163
|
+
{props.children};
|
|
164
|
+
</indent>
|
|
165
|
+
</group>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Children, code, refkey } from "@alloy-js/core";
|
|
1
|
+
import { Children, code, namekey, refkey } from "@alloy-js/core";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
3
|
import { TestNamespace } from "../../../test/utils.jsx";
|
|
4
4
|
import { Property } from "../property/property.jsx";
|
|
@@ -19,6 +19,16 @@ it("declares record with no members", () => {
|
|
|
19
19
|
`);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
+
it("takes a namekey", () => {
|
|
23
|
+
expect(
|
|
24
|
+
<TestNamespace>
|
|
25
|
+
<RecordDeclaration name={namekey("my-record")} />
|
|
26
|
+
</TestNamespace>,
|
|
27
|
+
).toRenderTo(`
|
|
28
|
+
record MyRecord;
|
|
29
|
+
`);
|
|
30
|
+
});
|
|
31
|
+
|
|
22
32
|
describe("modifiers", () => {
|
|
23
33
|
it.each(["public", "private", "internal"])("%s", (mod) => {
|
|
24
34
|
expect(
|
|
@@ -26,7 +26,7 @@ export interface RecordDeclarationProps
|
|
|
26
26
|
extends Omit<core.DeclarationProps, "nameKind">,
|
|
27
27
|
AccessModifiers,
|
|
28
28
|
RecordModifiers {
|
|
29
|
-
name: string;
|
|
29
|
+
name: string | core.Namekey;
|
|
30
30
|
|
|
31
31
|
/** Doc comment */
|
|
32
32
|
doc?: core.Children;
|
|
@@ -73,12 +73,11 @@ export interface RecordDeclarationProps
|
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
75
|
export function RecordDeclaration(props: RecordDeclarationProps) {
|
|
76
|
-
const name = useCSharpNamePolicy().getName(props.name!, "record");
|
|
77
|
-
|
|
78
76
|
// records don't have their own type kind but instead use class or struct
|
|
79
77
|
// depending on what kind of record we have.
|
|
80
|
-
const thisRecordSymbol = createNamedTypeSymbol(name, "record", {
|
|
78
|
+
const thisRecordSymbol = createNamedTypeSymbol(props.name, "record", {
|
|
81
79
|
refkeys: props.refkey,
|
|
80
|
+
namePolicy: useCSharpNamePolicy().for("record"),
|
|
82
81
|
});
|
|
83
82
|
|
|
84
83
|
const thisRecordScope = createClassScope(thisRecordSymbol);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClassDeclaration } from "#components/class/declaration.jsx";
|
|
2
|
-
import { Namespace } from "#components/namespace.jsx";
|
|
2
|
+
import { Namespace } from "#components/namespace/namespace.jsx";
|
|
3
3
|
import { Children, FormatOptions, Indent, Output, Prose } from "@alloy-js/core";
|
|
4
4
|
import { describe, expect, it } from "vitest";
|
|
5
5
|
import { CSharpFormatOptions } from "../../contexts/format-options.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NamespaceScopes } from "#components/namespace-scopes.jsx";
|
|
2
|
+
import { NamespaceName } from "#components/namespace/namespace-name.jsx";
|
|
2
3
|
import { Reference } from "#components/Reference.jsx";
|
|
3
|
-
import {
|
|
4
|
+
import { Usings } from "#components/using/using.jsx";
|
|
4
5
|
import {
|
|
5
6
|
Block,
|
|
6
7
|
Children,
|
|
@@ -42,7 +43,6 @@ export function SourceFile(props: SourceFileProps) {
|
|
|
42
43
|
const nsContext = useNamespaceContext();
|
|
43
44
|
const globalNs = getGlobalNamespace(useBinder());
|
|
44
45
|
const nsSymbol = nsContext ? nsContext.symbol : globalNs;
|
|
45
|
-
const nsRef = nsContext ? nsContext.symbol.name : undefined;
|
|
46
46
|
const usings = computed(() => {
|
|
47
47
|
return (
|
|
48
48
|
Array.from(sourceFileScope.usings) as (NamespaceSymbol | string)[]
|
|
@@ -70,7 +70,7 @@ export function SourceFile(props: SourceFileProps) {
|
|
|
70
70
|
{(sourceFileScope.usings.size > 0 ||
|
|
71
71
|
(props.using && props.using.length > 0)) && (
|
|
72
72
|
<>
|
|
73
|
-
<
|
|
73
|
+
<Usings namespaces={usings.value} />
|
|
74
74
|
<hbr />
|
|
75
75
|
<hbr />
|
|
76
76
|
</>
|
|
@@ -78,7 +78,7 @@ export function SourceFile(props: SourceFileProps) {
|
|
|
78
78
|
{nsSymbol === globalNs ?
|
|
79
79
|
content
|
|
80
80
|
: <>
|
|
81
|
-
namespace {
|
|
81
|
+
namespace <NamespaceName symbol={nsSymbol} />
|
|
82
82
|
{sourceFileScope.hasBlockNamespace ?
|
|
83
83
|
<>
|
|
84
84
|
{" "}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ClassDeclaration } from "#components/class/declaration.jsx";
|
|
2
|
+
import { EnumDeclaration } from "#components/enum/declaration.jsx";
|
|
3
|
+
import { EnumMember } from "#components/enum/member.jsx";
|
|
4
|
+
import { Method } from "#components/method/method.jsx";
|
|
5
|
+
import { Namespace } from "#components/namespace/namespace.jsx";
|
|
6
|
+
import { SourceFile } from "#components/source-file/source-file.jsx";
|
|
7
|
+
import { Output, refkey } from "@alloy-js/core";
|
|
8
|
+
import * as coretest from "@alloy-js/core/testing";
|
|
9
|
+
import { expect, it } from "vitest";
|
|
10
|
+
import { createCSharpNamePolicy } from "../../name-policy.js";
|
|
11
|
+
|
|
12
|
+
it("using on source file are placed above file namespace statement", () => {
|
|
13
|
+
expect(
|
|
14
|
+
<Output>
|
|
15
|
+
<Namespace name="TestCode">
|
|
16
|
+
<SourceFile path="Test1.cs" using={["Foo"]} />
|
|
17
|
+
</Namespace>
|
|
18
|
+
</Output>,
|
|
19
|
+
).toRenderTo(`
|
|
20
|
+
using Foo;
|
|
21
|
+
|
|
22
|
+
namespace TestCode;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
`);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("adds using statement across namespaces", () => {
|
|
29
|
+
const inputTypeRefkey = refkey();
|
|
30
|
+
const outputTypeRefkey = refkey();
|
|
31
|
+
const twoValRefkey = refkey();
|
|
32
|
+
|
|
33
|
+
const params = [
|
|
34
|
+
{
|
|
35
|
+
name: "BodyParam",
|
|
36
|
+
type: inputTypeRefkey,
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
expect(
|
|
41
|
+
<Output namePolicy={createCSharpNamePolicy()}>
|
|
42
|
+
<Namespace name="Models">
|
|
43
|
+
<SourceFile path="Models.cs">
|
|
44
|
+
<ClassDeclaration public name="Input" refkey={inputTypeRefkey} />
|
|
45
|
+
<hbr />
|
|
46
|
+
<ClassDeclaration public name="Output" refkey={outputTypeRefkey} />
|
|
47
|
+
<hbr />
|
|
48
|
+
<EnumDeclaration public name="TestEnum">
|
|
49
|
+
<EnumMember name="One" />,<hbr />
|
|
50
|
+
<EnumMember name="Two" refkey={twoValRefkey} />
|
|
51
|
+
</EnumDeclaration>
|
|
52
|
+
</SourceFile>
|
|
53
|
+
</Namespace>
|
|
54
|
+
<Namespace name="Client">
|
|
55
|
+
<SourceFile path="Client.cs" using={["System"]}>
|
|
56
|
+
<ClassDeclaration public name="Client">
|
|
57
|
+
<Method
|
|
58
|
+
public
|
|
59
|
+
name="MethodOne"
|
|
60
|
+
parameters={params}
|
|
61
|
+
returns={outputTypeRefkey}
|
|
62
|
+
/>
|
|
63
|
+
</ClassDeclaration>
|
|
64
|
+
<hbr />
|
|
65
|
+
{twoValRefkey};
|
|
66
|
+
</SourceFile>
|
|
67
|
+
</Namespace>
|
|
68
|
+
</Output>,
|
|
69
|
+
).toRenderTo({
|
|
70
|
+
"Models.cs": coretest.d`
|
|
71
|
+
namespace Models;
|
|
72
|
+
|
|
73
|
+
public class Input;
|
|
74
|
+
public class Output;
|
|
75
|
+
public enum TestEnum
|
|
76
|
+
{
|
|
77
|
+
One,
|
|
78
|
+
Two
|
|
79
|
+
}
|
|
80
|
+
`,
|
|
81
|
+
"Client.cs": coretest.d`
|
|
82
|
+
using Models;
|
|
83
|
+
using System;
|
|
84
|
+
|
|
85
|
+
namespace Client;
|
|
86
|
+
|
|
87
|
+
public class Client
|
|
88
|
+
{
|
|
89
|
+
public Output MethodOne(Input bodyParam) {}
|
|
90
|
+
}
|
|
91
|
+
TestEnum.Two;
|
|
92
|
+
`,
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -10,5 +10,5 @@ export const EnumMember = core.stc(base.EnumMember);
|
|
|
10
10
|
export const Parameter = core.stc(base.Parameter);
|
|
11
11
|
export const Parameters = core.stc(base.Parameters);
|
|
12
12
|
export const ProjectDirectory = core.stc(base.ProjectDirectory);
|
|
13
|
-
export const UsingDirective = core.stc(base.
|
|
13
|
+
export const UsingDirective = core.stc(base.Usings);
|
|
14
14
|
export const StructDeclaration = core.stc(base.StructDeclaration);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { List, refkey } from "@alloy-js/core";
|
|
1
|
+
import { List, namekey, refkey } from "@alloy-js/core";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
3
|
import { TestNamespace } from "../../../test/utils.jsx";
|
|
4
4
|
import { Attribute } from "../attributes/attributes.jsx";
|
|
@@ -19,6 +19,16 @@ it("declares struct with no members", () => {
|
|
|
19
19
|
`);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
+
it("takes a namekey", () => {
|
|
23
|
+
expect(
|
|
24
|
+
<TestNamespace>
|
|
25
|
+
<StructDeclaration name={namekey("my-struct")} />
|
|
26
|
+
</TestNamespace>,
|
|
27
|
+
).toRenderTo(`
|
|
28
|
+
struct MyStruct;
|
|
29
|
+
`);
|
|
30
|
+
});
|
|
31
|
+
|
|
22
32
|
describe("modifiers", () => {
|
|
23
33
|
it.each(["public", "private", "internal"])("%s", (mod) => {
|
|
24
34
|
expect(
|
|
@@ -35,7 +35,7 @@ export interface StructDeclarationProps
|
|
|
35
35
|
extends Omit<core.DeclarationProps, "nameKind">,
|
|
36
36
|
AccessModifiers,
|
|
37
37
|
StructModifiers {
|
|
38
|
-
name: string;
|
|
38
|
+
name: string | core.Namekey;
|
|
39
39
|
|
|
40
40
|
/** Doc comment */
|
|
41
41
|
doc?: core.Children;
|
|
@@ -98,10 +98,9 @@ export interface StructDeclarationProps
|
|
|
98
98
|
* ```
|
|
99
99
|
*/
|
|
100
100
|
export function StructDeclaration(props: StructDeclarationProps) {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
const thisStructSymbol = createNamedTypeSymbol(name, "struct", {
|
|
101
|
+
const thisStructSymbol = createNamedTypeSymbol(props.name, "struct", {
|
|
104
102
|
refkeys: props.refkey,
|
|
103
|
+
namePolicy: useCSharpNamePolicy().for("struct"),
|
|
105
104
|
});
|
|
106
105
|
|
|
107
106
|
const thisStructScope = createNamedTypeScope(thisStructSymbol);
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
Children,
|
|
3
3
|
MemberDeclaration,
|
|
4
4
|
MemberName,
|
|
5
|
+
Namekey,
|
|
5
6
|
Refkey,
|
|
6
7
|
} from "@alloy-js/core";
|
|
7
8
|
import { createTypeParameterSymbol } from "../../symbols/factories.js";
|
|
@@ -13,7 +14,7 @@ export interface TypeParameterProps {
|
|
|
13
14
|
/**
|
|
14
15
|
* The name of the type parameter.
|
|
15
16
|
*/
|
|
16
|
-
readonly name: string;
|
|
17
|
+
readonly name: string | Namekey;
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* The parameter constraint
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { namekey } from "@alloy-js/core";
|
|
1
2
|
import { expect, it } from "vitest";
|
|
2
3
|
import { TestNamespace } from "../../../test/utils.jsx";
|
|
3
4
|
import { TypeParameters } from "./type-parameters.jsx";
|
|
@@ -44,3 +45,11 @@ it("declare type parameters using parameters", () => {
|
|
|
44
45
|
</TestNamespace>,
|
|
45
46
|
).toRenderTo(`<A, B>`);
|
|
46
47
|
});
|
|
48
|
+
|
|
49
|
+
it("takes a namekey", () => {
|
|
50
|
+
expect(
|
|
51
|
+
<TestNamespace>
|
|
52
|
+
<TypeParameters parameters={[{ name: namekey("my-param") }]} />
|
|
53
|
+
</TestNamespace>,
|
|
54
|
+
).toRenderTo(`<MyParam>`);
|
|
55
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { expect, it } from "vitest";
|
|
2
|
+
import { Usings } from "./using.jsx";
|
|
3
|
+
|
|
4
|
+
it("single using", () => {
|
|
5
|
+
expect(<Usings namespaces={["Foo"]} />).toRenderTo(`
|
|
6
|
+
using Foo;
|
|
7
|
+
`);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("multiple using", () => {
|
|
11
|
+
expect(<Usings namespaces={["Foo", "Bar"]} />).toRenderTo(`
|
|
12
|
+
using Bar;
|
|
13
|
+
using Foo;
|
|
14
|
+
`);
|
|
15
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { computed, For } from "@alloy-js/core";
|
|
2
|
+
import { NamespaceSymbol } from "../../symbols/namespace.js";
|
|
3
|
+
|
|
4
|
+
export interface UsingsProps {
|
|
5
|
+
/**
|
|
6
|
+
* Namespace symbols or namespace names to use to generate using statements.
|
|
7
|
+
*/
|
|
8
|
+
namespaces: (NamespaceSymbol | string)[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Component rendering csharp using directive
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Usings namespaces={["System", "Models"]} />
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* will render
|
|
20
|
+
*
|
|
21
|
+
* ```csharp
|
|
22
|
+
* using Models;
|
|
23
|
+
* using System;
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function Usings(props: UsingsProps) {
|
|
27
|
+
const sortedNamespaces = computed(() => {
|
|
28
|
+
return props.namespaces
|
|
29
|
+
.map(getNamespaceName)
|
|
30
|
+
.sort((n1, n2) => n1.localeCompare(n2));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<For each={sortedNamespaces}>
|
|
35
|
+
{(namespace) => <UsingNamespaceDirective namespace={namespace} />}
|
|
36
|
+
</For>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface UsingNamespaceDirective {
|
|
41
|
+
namespace: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function UsingNamespaceDirective(props: UsingNamespaceDirective) {
|
|
45
|
+
return `using ${getNamespaceName(props.namespace)};`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getNamespaceName(namespace: string | NamespaceSymbol): string {
|
|
49
|
+
return typeof namespace === "string" ? namespace : (
|
|
50
|
+
namespace.getFullyQualifiedName({ omitGlobal: true })
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { List, refkey } from "@alloy-js/core";
|
|
1
|
+
import { List, namekey, refkey } from "@alloy-js/core";
|
|
2
2
|
import { expect, it } from "vitest";
|
|
3
3
|
import { TestNamespace } from "../../../test/utils.jsx";
|
|
4
4
|
import { VarDeclaration } from "./declaration.jsx";
|
|
@@ -51,3 +51,18 @@ it("links refkey", () => {
|
|
|
51
51
|
var testVar2 = testVar;
|
|
52
52
|
`);
|
|
53
53
|
});
|
|
54
|
+
|
|
55
|
+
it("links namekey", () => {
|
|
56
|
+
const key = namekey("test-var");
|
|
57
|
+
expect(
|
|
58
|
+
<TestNamespace>
|
|
59
|
+
<List>
|
|
60
|
+
<VarDeclaration name={key}>42</VarDeclaration>
|
|
61
|
+
<VarDeclaration name="testVar2">{key}</VarDeclaration>
|
|
62
|
+
</List>
|
|
63
|
+
</TestNamespace>,
|
|
64
|
+
).toRenderTo(`
|
|
65
|
+
var testVar = 42;
|
|
66
|
+
var testVar2 = testVar;
|
|
67
|
+
`);
|
|
68
|
+
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Children,
|
|
3
|
+
createSymbolSlot,
|
|
3
4
|
Declaration,
|
|
4
5
|
DeclarationProps,
|
|
5
6
|
Name,
|
|
7
|
+
Namekey,
|
|
6
8
|
Refkey,
|
|
7
9
|
} from "@alloy-js/core";
|
|
8
10
|
import { createVariableSymbol } from "../../symbols/factories.js";
|
|
@@ -11,13 +13,16 @@ import { createVariableSymbol } from "../../symbols/factories.js";
|
|
|
11
13
|
export interface VarDeclarationProps
|
|
12
14
|
extends Omit<DeclarationProps, "nameKind"> {
|
|
13
15
|
/** Variable name */
|
|
14
|
-
name: string;
|
|
16
|
+
name: string | Namekey;
|
|
15
17
|
/** Type of the variable declaration. If not specified, defaults to "var" */
|
|
16
18
|
type?: Children;
|
|
17
19
|
/** Variable refkey */
|
|
18
20
|
refkey?: Refkey;
|
|
19
21
|
/** Variable value */
|
|
20
22
|
children?: Children;
|
|
23
|
+
|
|
24
|
+
/** Constant variable. Add the const modifier. */
|
|
25
|
+
const?: boolean;
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
/**
|
|
@@ -42,12 +47,22 @@ export interface VarDeclarationProps
|
|
|
42
47
|
* ```
|
|
43
48
|
*/
|
|
44
49
|
export function VarDeclaration(props: VarDeclarationProps) {
|
|
50
|
+
const TypeSlot = createSymbolSlot();
|
|
51
|
+
const ValueSlot = createSymbolSlot();
|
|
52
|
+
|
|
45
53
|
const sym = createVariableSymbol(props.name, {
|
|
46
54
|
refkeys: props.refkey,
|
|
55
|
+
type: props.type ? TypeSlot.firstSymbol : ValueSlot.firstSymbol,
|
|
47
56
|
});
|
|
57
|
+
|
|
58
|
+
if (props.const && !props.type) {
|
|
59
|
+
throw new Error("Implicitly-typed variables cannot be constant");
|
|
60
|
+
}
|
|
48
61
|
return (
|
|
49
62
|
<Declaration symbol={sym}>
|
|
50
|
-
{props.
|
|
63
|
+
{props.const ? "const " : ""}
|
|
64
|
+
<TypeSlot>{props.type ?? "var"}</TypeSlot> <Name /> ={" "}
|
|
65
|
+
<ValueSlot>{props.children}</ValueSlot>;
|
|
51
66
|
</Declaration>
|
|
52
67
|
);
|
|
53
68
|
}
|
|
@@ -7,9 +7,16 @@ export function useGlobalNamespace() {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const globalNamespaces = new WeakMap<Binder, NamespaceSymbol>();
|
|
10
|
-
|
|
10
|
+
let defaultGlobalNamespace = new NamespaceSymbol("global", undefined, {
|
|
11
11
|
isGlobal: true,
|
|
12
12
|
});
|
|
13
|
+
|
|
14
|
+
export function resetGlobalNamespace() {
|
|
15
|
+
defaultGlobalNamespace = new NamespaceSymbol("global", undefined, {
|
|
16
|
+
isGlobal: true,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
export function getGlobalNamespace(binder: Binder | undefined) {
|
|
14
21
|
if (!binder) {
|
|
15
22
|
return defaultGlobalNamespace;
|