@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
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
computed,
|
|
6
6
|
For,
|
|
7
7
|
isComponentCreator,
|
|
8
|
-
|
|
8
|
+
Refkeyable,
|
|
9
9
|
Show,
|
|
10
10
|
takeSymbols,
|
|
11
11
|
} from "@alloy-js/core";
|
|
@@ -92,7 +92,7 @@ export interface AccessExpressionPartProps {
|
|
|
92
92
|
* A refkey for the symbol whose name becomes this part's identifier. When a refkey is provided for the first
|
|
93
93
|
* part, it will be fully resolved. Otherwise, just the symbol's name is used.
|
|
94
94
|
*/
|
|
95
|
-
refkey?:
|
|
95
|
+
refkey?: Refkeyable;
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* The symbol whose name becomes this part's identifier.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Namespace } from "#components/namespace.jsx";
|
|
1
|
+
import { Namespace } from "#components/namespace/namespace.jsx";
|
|
2
2
|
import { SourceFile } from "#components/source-file/source-file.jsx";
|
|
3
3
|
import { Output, refkey } from "@alloy-js/core";
|
|
4
4
|
import { d } from "@alloy-js/core/testing";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { toSourceText } from "#test/utils.jsx";
|
|
1
|
+
import { TestNamespace, toSourceText } from "#test/utils.jsx";
|
|
2
|
+
import { namekey } from "@alloy-js/core";
|
|
2
3
|
import { d } from "@alloy-js/core/testing";
|
|
3
4
|
import { expect, it } from "vitest";
|
|
4
5
|
import { EnumDeclaration } from "./declaration.jsx";
|
|
@@ -32,3 +33,15 @@ it("applies naming policy to enum and members", () => {
|
|
|
32
33
|
}
|
|
33
34
|
`);
|
|
34
35
|
});
|
|
36
|
+
|
|
37
|
+
it("takes a namekey", () => {
|
|
38
|
+
const key = namekey("my-enum");
|
|
39
|
+
const tree = (
|
|
40
|
+
<TestNamespace>
|
|
41
|
+
<EnumDeclaration name={key} />
|
|
42
|
+
</TestNamespace>
|
|
43
|
+
);
|
|
44
|
+
expect(tree).toRenderTo(`
|
|
45
|
+
enum MyEnum;
|
|
46
|
+
`);
|
|
47
|
+
});
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
Children,
|
|
4
4
|
Declaration,
|
|
5
5
|
MemberScope,
|
|
6
|
+
Namekey,
|
|
6
7
|
Refkey,
|
|
7
8
|
} from "@alloy-js/core";
|
|
8
9
|
import {
|
|
@@ -17,7 +18,7 @@ import { Name } from "../Name.jsx";
|
|
|
17
18
|
|
|
18
19
|
// properties for creating an enum
|
|
19
20
|
export interface EnumDeclarationProps extends AccessModifiers {
|
|
20
|
-
name: string;
|
|
21
|
+
name: string | Namekey;
|
|
21
22
|
refkey?: Refkey | Refkey[];
|
|
22
23
|
children?: Children;
|
|
23
24
|
}
|
|
@@ -43,9 +44,9 @@ export interface EnumDeclarationProps extends AccessModifiers {
|
|
|
43
44
|
* ```
|
|
44
45
|
*/
|
|
45
46
|
export function EnumDeclaration(props: EnumDeclarationProps) {
|
|
46
|
-
const
|
|
47
|
-
const symbol = createNamedTypeSymbol(name, "enum", {
|
|
47
|
+
const symbol = createNamedTypeSymbol(props.name, "enum", {
|
|
48
48
|
refkeys: props.refkey,
|
|
49
|
+
namePolicy: useCSharpNamePolicy().for("enum"),
|
|
49
50
|
});
|
|
50
51
|
const scope = createNamedTypeScope(symbol);
|
|
51
52
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { toSourceText } from "#test/utils.jsx";
|
|
1
|
+
import { TestNamespace, toSourceText } from "#test/utils.jsx";
|
|
2
|
+
import { namekey } from "@alloy-js/core";
|
|
2
3
|
import { d } from "@alloy-js/core/testing";
|
|
3
4
|
import { expect, it } from "vitest";
|
|
4
5
|
import { EnumDeclaration } from "./declaration.jsx";
|
|
@@ -22,3 +23,23 @@ it("declares enum with members", () => {
|
|
|
22
23
|
}
|
|
23
24
|
`);
|
|
24
25
|
});
|
|
26
|
+
|
|
27
|
+
it("takes a namekey", () => {
|
|
28
|
+
const memberKey = namekey("MyMember");
|
|
29
|
+
const tree = (
|
|
30
|
+
<TestNamespace>
|
|
31
|
+
<EnumDeclaration name="Foo">
|
|
32
|
+
<EnumMember name={memberKey} />
|
|
33
|
+
</EnumDeclaration>
|
|
34
|
+
<hbr />
|
|
35
|
+
{memberKey};
|
|
36
|
+
</TestNamespace>
|
|
37
|
+
);
|
|
38
|
+
expect(tree).toRenderTo(`
|
|
39
|
+
enum Foo
|
|
40
|
+
{
|
|
41
|
+
MyMember
|
|
42
|
+
}
|
|
43
|
+
Foo.MyMember;
|
|
44
|
+
`);
|
|
45
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { MemberDeclaration, MemberName, Refkey } from "@alloy-js/core";
|
|
1
|
+
import { MemberDeclaration, MemberName, Namekey, Refkey } from "@alloy-js/core";
|
|
2
2
|
import { useCSharpNamePolicy } from "../../name-policy.js";
|
|
3
3
|
import { useNamedTypeScope } from "../../scopes/contexts.js";
|
|
4
4
|
import { CSharpSymbol } from "../../symbols/csharp.js";
|
|
5
5
|
|
|
6
6
|
// properties for creating a C# enum member
|
|
7
7
|
export interface EnumMemberProps {
|
|
8
|
-
name: string;
|
|
8
|
+
name: string | Namekey;
|
|
9
9
|
refkey?: Refkey;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -23,9 +23,9 @@ export function EnumMember(props: EnumMemberProps) {
|
|
|
23
23
|
throw new Error("EnumMember must be used within an EnumDeclaration.");
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const
|
|
27
|
-
const thisEnumValueSymbol = new CSharpSymbol(name, symbol.members, {
|
|
26
|
+
const thisEnumValueSymbol = new CSharpSymbol(props.name, symbol.members, {
|
|
28
27
|
refkeys: props.refkey,
|
|
28
|
+
namePolicy: useCSharpNamePolicy().for("enum-member"),
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { List } from "@alloy-js/core";
|
|
1
|
+
import { List, namekey } from "@alloy-js/core";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
3
|
import { TestNamespace } from "../../../test/utils.jsx";
|
|
4
4
|
import { ClassDeclaration } from "../class/declaration.jsx";
|
|
@@ -30,6 +30,19 @@ it("declares multiple fields", () => {
|
|
|
30
30
|
`);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
+
it("takes a namekey", () => {
|
|
34
|
+
expect(
|
|
35
|
+
<Wrapper>
|
|
36
|
+
<Field name={namekey("my-field")} type="string" public />
|
|
37
|
+
</Wrapper>,
|
|
38
|
+
).toRenderTo(`
|
|
39
|
+
public class TestClass
|
|
40
|
+
{
|
|
41
|
+
public string MyField;
|
|
42
|
+
}
|
|
43
|
+
`);
|
|
44
|
+
});
|
|
45
|
+
|
|
33
46
|
describe("modifiers", () => {
|
|
34
47
|
describe("access modifiers", () => {
|
|
35
48
|
it.each(["public", "private", "protected", "internal"] as const)(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Children, Declaration, Name, Refkey } from "@alloy-js/core";
|
|
1
|
+
import { Children, Declaration, Name, Namekey, Refkey } from "@alloy-js/core";
|
|
2
2
|
import {
|
|
3
3
|
AccessModifiers,
|
|
4
4
|
computeModifiersPrefix,
|
|
@@ -28,7 +28,7 @@ const getModifiers = makeModifiers<FieldModifiers>([
|
|
|
28
28
|
]);
|
|
29
29
|
|
|
30
30
|
export interface FieldProps extends AccessModifiers, FieldModifiers {
|
|
31
|
-
name: string;
|
|
31
|
+
name: string | Namekey;
|
|
32
32
|
type: Children;
|
|
33
33
|
refkey?: Refkey;
|
|
34
34
|
/** Doc comment */
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { d } from "@alloy-js/core/testing";
|
|
2
|
+
import { expect, it } from "vitest";
|
|
3
|
+
import { ElseClause, ElseIfClause, IfStatement } from "./if-statement.jsx";
|
|
4
|
+
|
|
5
|
+
it("works with blocks", () => {
|
|
6
|
+
expect(
|
|
7
|
+
<>
|
|
8
|
+
<IfStatement condition="x === 1">// do thing</IfStatement>
|
|
9
|
+
<ElseIfClause condition="x === 2">// do another thing</ElseIfClause>
|
|
10
|
+
<ElseClause>// do default thing</ElseClause>
|
|
11
|
+
</>,
|
|
12
|
+
).toRenderTo(d`
|
|
13
|
+
if (x === 1)
|
|
14
|
+
{
|
|
15
|
+
// do thing
|
|
16
|
+
}
|
|
17
|
+
else if (x === 2)
|
|
18
|
+
{
|
|
19
|
+
// do another thing
|
|
20
|
+
}
|
|
21
|
+
else
|
|
22
|
+
{
|
|
23
|
+
// do default thing
|
|
24
|
+
}
|
|
25
|
+
`);
|
|
26
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Block, type Children } from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
export interface IfStatementProps {
|
|
4
|
+
condition: Children;
|
|
5
|
+
children: Children;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* An if statement.
|
|
10
|
+
*/
|
|
11
|
+
export function IfStatement(props: IfStatementProps) {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
if ({props.condition}) <Block newline>{props.children}</Block>
|
|
15
|
+
</>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ElseIfClauseProps {
|
|
20
|
+
condition: Children;
|
|
21
|
+
children: Children;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An else clause with an if statement.
|
|
26
|
+
*/
|
|
27
|
+
export function ElseIfClause(props: ElseIfClauseProps) {
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
<hardline />
|
|
31
|
+
else if ({props.condition}) <Block newline>{props.children}</Block>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ElseClauseProps {
|
|
37
|
+
children: Children;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The else clause of an if statement.
|
|
42
|
+
*/
|
|
43
|
+
export function ElseClause(props: ElseClauseProps) {
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<hardline />
|
|
47
|
+
else <Block newline>{props.children}</Block>
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./access-expression/access-expression.jsx";
|
|
1
2
|
export * from "./attributes/attributes.jsx";
|
|
2
3
|
export * from "./class/declaration.jsx";
|
|
3
4
|
export * from "./constructor/constructor.jsx";
|
|
@@ -7,6 +8,7 @@ export * from "./doc/from-markdown.jsx";
|
|
|
7
8
|
export * from "./enum/declaration.jsx";
|
|
8
9
|
export * from "./enum/member.jsx";
|
|
9
10
|
export * from "./field/field.jsx";
|
|
11
|
+
export * from "./if/if-statement.jsx";
|
|
10
12
|
export * from "./interface/declaration.js";
|
|
11
13
|
export * from "./interface/method.js";
|
|
12
14
|
export * from "./interface/property.js";
|
|
@@ -15,7 +17,7 @@ export * from "./lexical-scope.jsx";
|
|
|
15
17
|
export * from "./method-scope.jsx";
|
|
16
18
|
export * from "./method/method.jsx";
|
|
17
19
|
export * from "./Name.js";
|
|
18
|
-
export
|
|
20
|
+
export { Namespace, type NamespaceProps } from "./namespace/namespace.jsx";
|
|
19
21
|
export * from "./parameters/parameters.jsx";
|
|
20
22
|
export * from "./ProjectDirectory.js";
|
|
21
23
|
export * from "./property/property.jsx";
|
|
@@ -24,5 +26,5 @@ export * from "./Reference.js";
|
|
|
24
26
|
export * from "./source-file/source-file.jsx";
|
|
25
27
|
export * from "./struct/declaration.jsx";
|
|
26
28
|
export type { TypeParameterProps } from "./type-parameters/type-parameter.jsx";
|
|
27
|
-
export * from "./
|
|
29
|
+
export * from "./using/using.jsx";
|
|
28
30
|
export * from "./var/declaration.jsx";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { List, refkey } from "@alloy-js/core";
|
|
1
|
+
import { List, namekey, refkey } from "@alloy-js/core";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
3
|
import { TestNamespace } from "../../../test/utils.jsx";
|
|
4
4
|
import { Attribute } from "../attributes/attributes.jsx";
|
|
@@ -59,6 +59,16 @@ it("specify doc comment", () => {
|
|
|
59
59
|
`);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
+
it("takes a namekey", () => {
|
|
63
|
+
expect(
|
|
64
|
+
<TestNamespace>
|
|
65
|
+
<InterfaceDeclaration name={namekey("my-interface")} />
|
|
66
|
+
</TestNamespace>,
|
|
67
|
+
).toRenderTo(`
|
|
68
|
+
interface MyInterface;
|
|
69
|
+
`);
|
|
70
|
+
});
|
|
71
|
+
|
|
62
72
|
describe("with type parameters", () => {
|
|
63
73
|
it("reference parameters", () => {
|
|
64
74
|
const typeParameters: TypeParameterProps[] = [
|
|
@@ -26,7 +26,7 @@ export interface InterfaceDeclarationProps
|
|
|
26
26
|
extends Omit<core.DeclarationProps, "nameKind">,
|
|
27
27
|
AccessModifiers,
|
|
28
28
|
InterfaceModifiers {
|
|
29
|
-
name: string;
|
|
29
|
+
name: string | core.Namekey;
|
|
30
30
|
|
|
31
31
|
/** Doc comment */
|
|
32
32
|
doc?: core.Children;
|
|
@@ -86,10 +86,9 @@ export interface InterfaceDeclarationProps
|
|
|
86
86
|
* ```
|
|
87
87
|
*/
|
|
88
88
|
export function InterfaceDeclaration(props: InterfaceDeclarationProps) {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
const symbol = createNamedTypeSymbol(name, "interface", {
|
|
89
|
+
const symbol = createNamedTypeSymbol(props.name!, "interface", {
|
|
92
90
|
refkeys: props.refkey,
|
|
91
|
+
namePolicy: useCSharpNamePolicy().for("interface"),
|
|
93
92
|
});
|
|
94
93
|
|
|
95
94
|
// this creates a new scope for the interface definition.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { refkey } from "@alloy-js/core";
|
|
1
|
+
import { namekey, refkey } from "@alloy-js/core";
|
|
2
2
|
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
3
3
|
import { describe, expect, it } from "vitest";
|
|
4
4
|
import { TestNamespace } from "../../../test/utils.jsx";
|
|
@@ -188,6 +188,19 @@ it("specify attributes", () => {
|
|
|
188
188
|
`);
|
|
189
189
|
});
|
|
190
190
|
|
|
191
|
+
it("takes a namekey", () => {
|
|
192
|
+
expect(
|
|
193
|
+
<Wrapper>
|
|
194
|
+
<InterfaceMethod name={namekey("my-method")} />
|
|
195
|
+
</Wrapper>,
|
|
196
|
+
).toRenderTo(`
|
|
197
|
+
public interface TestInterface
|
|
198
|
+
{
|
|
199
|
+
void MyMethod();
|
|
200
|
+
}
|
|
201
|
+
`);
|
|
202
|
+
});
|
|
203
|
+
|
|
191
204
|
describe("with type parameters", () => {
|
|
192
205
|
it("reference parameters", () => {
|
|
193
206
|
const typeParameters: TypeParameterProps[] = [
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
Children,
|
|
4
4
|
MemberDeclaration,
|
|
5
5
|
MemberName,
|
|
6
|
+
Namekey,
|
|
6
7
|
Refkey,
|
|
7
8
|
Scope,
|
|
8
9
|
} from "@alloy-js/core";
|
|
@@ -32,7 +33,7 @@ const getMethodModifier = makeModifiers<InterfaceMethodModifiers>(["new"]);
|
|
|
32
33
|
export interface InterfaceMethodProps
|
|
33
34
|
extends AccessModifiers,
|
|
34
35
|
InterfaceMethodModifiers {
|
|
35
|
-
name: string;
|
|
36
|
+
name: string | Namekey;
|
|
36
37
|
refkey?: Refkey;
|
|
37
38
|
children?: Children;
|
|
38
39
|
parameters?: Array<ParameterProps>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { namekey } from "../../../../core/src/refkey.js";
|
|
3
4
|
import { TestNamespace } from "../../../test/utils.jsx";
|
|
4
5
|
import { Attribute } from "../attributes/attributes.jsx";
|
|
5
6
|
import { InterfaceDeclaration } from "./declaration.jsx";
|
|
@@ -144,6 +145,18 @@ it("specify doc comment", () => {
|
|
|
144
145
|
`);
|
|
145
146
|
});
|
|
146
147
|
|
|
148
|
+
it("takes a namekey", () => {
|
|
149
|
+
expect(
|
|
150
|
+
<Wrapper>
|
|
151
|
+
<InterfaceProperty name={namekey("my-property")} type="string" get />
|
|
152
|
+
</Wrapper>,
|
|
153
|
+
).toRenderTo(`
|
|
154
|
+
public interface TestInterface
|
|
155
|
+
{
|
|
156
|
+
string MyProperty { get; }
|
|
157
|
+
}
|
|
158
|
+
`);
|
|
159
|
+
});
|
|
147
160
|
it("specify attributes", () => {
|
|
148
161
|
expect(
|
|
149
162
|
<Wrapper>
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
List,
|
|
5
5
|
MemberDeclaration,
|
|
6
6
|
MemberName,
|
|
7
|
+
Namekey,
|
|
7
8
|
Refkey,
|
|
8
9
|
} from "@alloy-js/core";
|
|
9
10
|
import {
|
|
@@ -27,7 +28,7 @@ const getModifiers = makeModifiers<InterfacePropertyModifiers>(["new"]);
|
|
|
27
28
|
export interface InterfacePropertyProps
|
|
28
29
|
extends AccessModifiers,
|
|
29
30
|
InterfacePropertyModifiers {
|
|
30
|
-
name: string;
|
|
31
|
+
name: string | Namekey;
|
|
31
32
|
refkey?: Refkey;
|
|
32
33
|
|
|
33
34
|
/** Property type */
|
|
@@ -158,3 +158,52 @@ it("use expression body form", () => {
|
|
|
158
158
|
}
|
|
159
159
|
`);
|
|
160
160
|
});
|
|
161
|
+
|
|
162
|
+
describe("format", () => {
|
|
163
|
+
it("split expression after => if too long", () => {
|
|
164
|
+
expect(
|
|
165
|
+
<TestNamespace printWidth={60}>
|
|
166
|
+
<ClassDeclaration name="Test">
|
|
167
|
+
<Method public override name="ThisIsAVeryLongMethodName" expression>
|
|
168
|
+
this.WithAVeryLongPropertyName.AndAnEvenLongerMemberName
|
|
169
|
+
</Method>
|
|
170
|
+
</ClassDeclaration>
|
|
171
|
+
</TestNamespace>,
|
|
172
|
+
).toRenderTo(`
|
|
173
|
+
class Test
|
|
174
|
+
{
|
|
175
|
+
public override void ThisIsAVeryLongMethodName() =>
|
|
176
|
+
this.WithAVeryLongPropertyName.AndAnEvenLongerMemberName;
|
|
177
|
+
}
|
|
178
|
+
`);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it("split parameters first if too long", () => {
|
|
182
|
+
expect(
|
|
183
|
+
<TestNamespace printWidth={60}>
|
|
184
|
+
<ClassDeclaration name="Test">
|
|
185
|
+
<Method
|
|
186
|
+
public
|
|
187
|
+
override
|
|
188
|
+
name="ThisIsAVeryLongMethodName"
|
|
189
|
+
expression
|
|
190
|
+
parameters={[
|
|
191
|
+
{ name: "firstParameter", type: "int" },
|
|
192
|
+
{ name: "secondParameter", type: "string" },
|
|
193
|
+
]}
|
|
194
|
+
>
|
|
195
|
+
this.Short
|
|
196
|
+
</Method>
|
|
197
|
+
</ClassDeclaration>
|
|
198
|
+
</TestNamespace>,
|
|
199
|
+
).toRenderTo(`
|
|
200
|
+
class Test
|
|
201
|
+
{
|
|
202
|
+
public override void ThisIsAVeryLongMethodName(
|
|
203
|
+
int firstParameter,
|
|
204
|
+
string secondParameter
|
|
205
|
+
) => this.Short;
|
|
206
|
+
}
|
|
207
|
+
`);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
@@ -154,9 +154,12 @@ export function Method(props: MethodProps) {
|
|
|
154
154
|
|
|
155
155
|
const ExpressionBody = (props: { children?: Children }) => {
|
|
156
156
|
return (
|
|
157
|
-
|
|
158
|
-
{" =>
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
<group>
|
|
158
|
+
{" =>"}
|
|
159
|
+
<indent>
|
|
160
|
+
<line />
|
|
161
|
+
{props.children};
|
|
162
|
+
</indent>
|
|
163
|
+
</group>
|
|
161
164
|
);
|
|
162
165
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useNamespaceContext } from "../../contexts/namespace.js";
|
|
2
|
+
import { NamespaceSymbol } from "../../symbols/namespace.js";
|
|
3
|
+
|
|
4
|
+
/** @internal */
|
|
5
|
+
export interface NamespaceNameProps {
|
|
6
|
+
symbol: NamespaceSymbol;
|
|
7
|
+
|
|
8
|
+
/** If it should print relative to the parent context */
|
|
9
|
+
relative?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** @internal */
|
|
13
|
+
export function NamespaceName(props: NamespaceNameProps) {
|
|
14
|
+
const names = [props.symbol.name];
|
|
15
|
+
const parent = props.relative ? useNamespaceContext()?.symbol : undefined;
|
|
16
|
+
|
|
17
|
+
let current = props.symbol.ownerSymbol;
|
|
18
|
+
while (current) {
|
|
19
|
+
if (
|
|
20
|
+
current === parent ||
|
|
21
|
+
!(current instanceof NamespaceSymbol) ||
|
|
22
|
+
current.isGlobal
|
|
23
|
+
) {
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
names.unshift(current.name);
|
|
27
|
+
current = current.ownerSymbol;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return names.join(".");
|
|
31
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { TestNamespace } from "#test/utils.jsx";
|
|
2
|
+
import { Output } from "@alloy-js/core";
|
|
3
|
+
import { d } from "@alloy-js/core/testing";
|
|
4
|
+
import { expect, it } from "vitest";
|
|
5
|
+
import { ClassDeclaration } from "../class/declaration.jsx";
|
|
6
|
+
import { SourceFile } from "../source-file/source-file.jsx";
|
|
7
|
+
import { Namespace } from "./namespace.jsx";
|
|
8
|
+
|
|
9
|
+
it("defines multiple namespaces and source files with unique content", () => {
|
|
10
|
+
const tree = (
|
|
11
|
+
<Output>
|
|
12
|
+
<Namespace name="Namespace1">
|
|
13
|
+
<SourceFile path="Model1.cs">
|
|
14
|
+
<ClassDeclaration public name="Model1" />
|
|
15
|
+
</SourceFile>
|
|
16
|
+
<SourceFile path="Model2.cs">
|
|
17
|
+
<ClassDeclaration public name="Model2" />
|
|
18
|
+
</SourceFile>
|
|
19
|
+
</Namespace>
|
|
20
|
+
<Namespace name="Namespace2">
|
|
21
|
+
<SourceFile path="Model3.cs">
|
|
22
|
+
<ClassDeclaration public name="Model3" />
|
|
23
|
+
</SourceFile>
|
|
24
|
+
<SourceFile path="Model4.cs">
|
|
25
|
+
<ClassDeclaration public name="Model4" />
|
|
26
|
+
</SourceFile>
|
|
27
|
+
</Namespace>
|
|
28
|
+
</Output>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
expect(tree).toRenderTo({
|
|
32
|
+
"Model1.cs": d`
|
|
33
|
+
namespace Namespace1;
|
|
34
|
+
|
|
35
|
+
public class Model1;
|
|
36
|
+
`,
|
|
37
|
+
"Model2.cs": d`
|
|
38
|
+
namespace Namespace1;
|
|
39
|
+
|
|
40
|
+
public class Model2;
|
|
41
|
+
`,
|
|
42
|
+
"Model3.cs": d`
|
|
43
|
+
namespace Namespace2;
|
|
44
|
+
|
|
45
|
+
public class Model3;
|
|
46
|
+
`,
|
|
47
|
+
"Model4.cs": d`
|
|
48
|
+
namespace Namespace2;
|
|
49
|
+
|
|
50
|
+
public class Model4;
|
|
51
|
+
`,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("nest namespaces", () => {
|
|
56
|
+
const tree = (
|
|
57
|
+
<Output>
|
|
58
|
+
<Namespace name={["Namespace1"]}>
|
|
59
|
+
<Namespace name={["Namespace2"]}>
|
|
60
|
+
<SourceFile path="Model1.cs">
|
|
61
|
+
<ClassDeclaration public name="Model1" />
|
|
62
|
+
</SourceFile>
|
|
63
|
+
</Namespace>
|
|
64
|
+
</Namespace>
|
|
65
|
+
</Output>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
expect(tree).toRenderTo(`
|
|
69
|
+
namespace Namespace1.Namespace2;
|
|
70
|
+
|
|
71
|
+
public class Model1;
|
|
72
|
+
`);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("define nested namespace directly with array", () => {
|
|
76
|
+
const tree = (
|
|
77
|
+
<Output>
|
|
78
|
+
<Namespace name={["Namespace1", "Namespace2"]}>
|
|
79
|
+
<SourceFile path="Model1.cs">
|
|
80
|
+
<ClassDeclaration public name="Model1" />
|
|
81
|
+
</SourceFile>
|
|
82
|
+
</Namespace>
|
|
83
|
+
</Output>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
expect(tree).toRenderTo(`
|
|
87
|
+
namespace Namespace1.Namespace2;
|
|
88
|
+
|
|
89
|
+
public class Model1;
|
|
90
|
+
`);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("define nested namespace directly as dotted notation", () => {
|
|
94
|
+
const tree = (
|
|
95
|
+
<Output>
|
|
96
|
+
<Namespace name="Namespace1.Namespace2">
|
|
97
|
+
<SourceFile path="Model1.cs">
|
|
98
|
+
<ClassDeclaration public name="Model1" />
|
|
99
|
+
</SourceFile>
|
|
100
|
+
</Namespace>
|
|
101
|
+
</Output>
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
expect(tree).toRenderTo({
|
|
105
|
+
"Model1.cs": d`
|
|
106
|
+
namespace Namespace1.Namespace2;
|
|
107
|
+
|
|
108
|
+
public class Model1;
|
|
109
|
+
`,
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("uses a name policy", () => {
|
|
114
|
+
expect(
|
|
115
|
+
<TestNamespace>
|
|
116
|
+
<Namespace name="my-namespace" />
|
|
117
|
+
</TestNamespace>,
|
|
118
|
+
).toRenderTo(`
|
|
119
|
+
namespace MyNamespace {
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
`);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("define nested namespace in sourcefile", () => {
|
|
126
|
+
const tree = (
|
|
127
|
+
<Output>
|
|
128
|
+
<Namespace name="Base">
|
|
129
|
+
<SourceFile path="Model1.cs">
|
|
130
|
+
<Namespace name="Namespace1.Namespace2">
|
|
131
|
+
<ClassDeclaration public name="Model1" />
|
|
132
|
+
</Namespace>
|
|
133
|
+
</SourceFile>
|
|
134
|
+
</Namespace>
|
|
135
|
+
</Output>
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
expect(tree).toRenderTo(`
|
|
139
|
+
namespace Base {
|
|
140
|
+
namespace Namespace1.Namespace2 {
|
|
141
|
+
public class Model1;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
`);
|
|
145
|
+
});
|