@alloy-js/csharp 0.20.0-dev.0 → 0.20.0-dev.10
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/src/components/Declaration.d.ts +2 -2
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +5 -14
- package/dist/src/components/Declaration.js.map +1 -0
- package/dist/src/components/Name.js +2 -1
- package/dist/src/components/Name.js.map +1 -0
- package/dist/src/components/ProjectDirectory.js +2 -1
- package/dist/src/components/ProjectDirectory.js.map +1 -0
- package/dist/src/components/Reference.d.ts.map +1 -1
- package/dist/src/components/Reference.js +7 -2
- package/dist/src/components/Reference.js.map +1 -0
- package/dist/src/components/UsingDirective.d.ts +5 -1
- package/dist/src/components/UsingDirective.d.ts.map +1 -1
- package/dist/src/components/UsingDirective.js +5 -2
- package/dist/src/components/UsingDirective.js.map +1 -0
- package/dist/src/components/access-expression/access-expression.d.ts +54 -0
- package/dist/src/components/access-expression/access-expression.d.ts.map +1 -0
- package/dist/src/components/access-expression/access-expression.js +277 -0
- package/dist/src/components/access-expression/access-expression.js.map +1 -0
- package/dist/src/components/access-expression/access-expression.test.d.ts +2 -0
- package/dist/src/components/access-expression/access-expression.test.d.ts.map +1 -0
- package/dist/src/components/access-expression/access-expression.test.js +336 -0
- package/dist/src/components/access-expression/access-expression.test.js.map +1 -0
- package/dist/src/components/access-expression/part-descriptors.d.ts +32 -0
- package/dist/src/components/access-expression/part-descriptors.d.ts.map +1 -0
- package/dist/src/components/access-expression/part-descriptors.js +99 -0
- package/dist/src/components/access-expression/part-descriptors.js.map +1 -0
- package/dist/src/components/attributes/attributes.js +2 -1
- package/dist/src/components/attributes/attributes.js.map +1 -0
- package/dist/src/components/attributes/attributes.test.js +2 -1
- package/dist/src/components/attributes/attributes.test.js.map +1 -0
- package/dist/src/components/{ClassDeclaration.d.ts → class/declaration.d.ts} +30 -12
- package/dist/src/components/class/declaration.d.ts.map +1 -0
- package/dist/src/components/class/declaration.js +87 -0
- package/dist/src/components/class/declaration.js.map +1 -0
- package/dist/src/components/class/declaration.test.d.ts +2 -0
- package/dist/src/components/class/declaration.test.d.ts.map +1 -0
- package/dist/src/components/class/declaration.test.js +573 -0
- package/dist/src/components/class/declaration.test.js.map +1 -0
- package/dist/src/components/constructor/constructor.d.ts.map +1 -1
- package/dist/src/components/constructor/constructor.js +13 -20
- package/dist/src/components/constructor/constructor.js.map +1 -0
- package/dist/src/components/constructor/constructor.test.js +13 -21
- package/dist/src/components/constructor/constructor.test.js.map +1 -0
- package/dist/src/components/doc/comment.js +2 -1
- package/dist/src/components/doc/comment.js.map +1 -0
- package/dist/src/components/doc/comment.test.js +2 -1
- package/dist/src/components/doc/comment.test.js.map +1 -0
- package/dist/src/components/doc/from-markdown.js +2 -1
- package/dist/src/components/doc/from-markdown.js.map +1 -0
- package/dist/src/components/doc/from-markdown.test.js +2 -1
- package/dist/src/components/doc/from-markdown.test.js.map +1 -0
- package/dist/src/components/{EnumDeclaration.d.ts → enum/declaration.d.ts} +6 -11
- package/dist/src/components/enum/declaration.d.ts.map +1 -0
- package/dist/src/components/enum/declaration.js +55 -0
- package/dist/src/components/enum/declaration.js.map +1 -0
- package/dist/src/components/enum/declaration.ref.test.d.ts +2 -0
- package/dist/src/components/enum/declaration.ref.test.d.ts.map +1 -0
- package/dist/src/components/enum/declaration.ref.test.js +121 -0
- package/dist/src/components/enum/declaration.ref.test.js.map +1 -0
- package/dist/src/components/enum/declaration.test.d.ts +2 -0
- package/dist/src/components/enum/declaration.test.d.ts.map +1 -0
- package/dist/src/components/enum/declaration.test.js +40 -0
- package/dist/src/components/enum/declaration.test.js.map +1 -0
- package/dist/src/components/enum/member.d.ts +7 -0
- package/dist/src/components/enum/member.d.ts.map +1 -0
- package/dist/src/components/enum/member.js +30 -0
- package/dist/src/components/enum/member.js.map +1 -0
- package/dist/src/components/enum/member.test.d.ts +2 -0
- package/dist/src/components/enum/member.test.d.ts.map +1 -0
- package/dist/src/components/enum/member.test.js +29 -0
- package/dist/src/components/enum/member.test.js.map +1 -0
- package/dist/src/components/field/field.d.ts.map +1 -1
- package/dist/src/components/field/field.js +11 -18
- package/dist/src/components/field/field.js.map +1 -0
- package/dist/src/components/field/field.test.js +10 -9
- package/dist/src/components/field/field.test.js.map +1 -0
- package/dist/src/components/index.d.ts +8 -4
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +10 -5
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/interface/declaration.d.ts.map +1 -1
- package/dist/src/components/interface/declaration.js +21 -22
- package/dist/src/components/interface/declaration.js.map +1 -0
- package/dist/src/components/interface/declaration.test.js +28 -36
- package/dist/src/components/interface/declaration.test.js.map +1 -0
- package/dist/src/components/interface/method.d.ts.map +1 -1
- package/dist/src/components/interface/method.js +9 -19
- package/dist/src/components/interface/method.js.map +1 -0
- package/dist/src/components/interface/method.test.js +40 -48
- package/dist/src/components/interface/method.test.js.map +1 -0
- package/dist/src/components/interface/property.d.ts.map +1 -1
- package/dist/src/components/interface/property.js +23 -40
- package/dist/src/components/interface/property.js.map +1 -0
- package/dist/src/components/interface/property.test.js +13 -12
- package/dist/src/components/interface/property.test.js.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.d.ts +29 -0
- package/dist/src/components/invocation-expression/invocation-expression.d.ts.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.js +70 -0
- package/dist/src/components/invocation-expression/invocation-expression.js.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.d.ts +2 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.d.ts.map +1 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.js +105 -0
- package/dist/src/components/invocation-expression/invocation-expression.test.js.map +1 -0
- package/dist/src/components/lexical-scope.d.ts +8 -0
- package/dist/src/components/lexical-scope.d.ts.map +1 -0
- package/dist/src/components/lexical-scope.js +25 -0
- package/dist/src/components/lexical-scope.js.map +1 -0
- package/dist/src/components/method/method.d.ts +5 -2
- package/dist/src/components/method/method.d.ts.map +1 -1
- package/dist/src/components/method/method.js +9 -17
- package/dist/src/components/method/method.js.map +1 -0
- package/dist/src/components/method/method.test.js +13 -12
- package/dist/src/components/method/method.test.js.map +1 -0
- package/dist/src/components/method-scope.d.ts +8 -0
- package/dist/src/components/method-scope.d.ts.map +1 -0
- package/dist/src/components/method-scope.js +25 -0
- package/dist/src/components/method-scope.js.map +1 -0
- package/dist/src/components/namespace-scopes.d.ts +13 -0
- package/dist/src/components/namespace-scopes.d.ts.map +1 -0
- package/dist/src/components/namespace-scopes.js +45 -0
- package/dist/src/components/namespace-scopes.js.map +1 -0
- package/dist/src/components/namespace.d.ts +7 -0
- package/dist/src/components/namespace.d.ts.map +1 -0
- package/dist/src/components/namespace.js +47 -0
- package/dist/src/components/namespace.js.map +1 -0
- package/dist/src/components/namespace.ref.test.d.ts +2 -0
- package/dist/src/components/namespace.ref.test.d.ts.map +1 -0
- package/dist/src/components/namespace.ref.test.js +182 -0
- package/dist/src/components/namespace.ref.test.js.map +1 -0
- package/dist/src/components/namespace.test.d.ts.map +1 -0
- package/dist/src/components/namespace.test.js +79 -0
- package/dist/src/components/namespace.test.js.map +1 -0
- package/dist/src/components/parameters/parameters.d.ts +2 -3
- package/dist/src/components/parameters/parameters.d.ts.map +1 -1
- package/dist/src/components/parameters/parameters.js +15 -15
- package/dist/src/components/parameters/parameters.js.map +1 -0
- package/dist/src/components/parameters/parameters.test.d.ts +2 -0
- package/dist/src/components/parameters/parameters.test.d.ts.map +1 -0
- package/dist/src/components/parameters/parameters.test.js +154 -0
- package/dist/src/components/parameters/parameters.test.js.map +1 -0
- package/dist/src/components/property/property.d.ts +2 -2
- package/dist/src/components/property/property.d.ts.map +1 -1
- package/dist/src/components/property/property.js +30 -40
- package/dist/src/components/property/property.js.map +1 -0
- package/dist/src/components/property/property.test.js +17 -16
- package/dist/src/components/property/property.test.js.map +1 -0
- package/dist/src/components/record/declaration.d.ts +18 -0
- package/dist/src/components/record/declaration.d.ts.map +1 -1
- package/dist/src/components/record/declaration.js +21 -14
- package/dist/src/components/record/declaration.js.map +1 -0
- package/dist/src/components/record/declaration.test.js +52 -4
- package/dist/src/components/record/declaration.test.js.map +1 -0
- package/dist/src/components/source-file/source-file.d.ts +19 -0
- package/dist/src/components/source-file/source-file.d.ts.map +1 -0
- package/dist/src/components/source-file/source-file.js +59 -0
- package/dist/src/components/source-file/source-file.js.map +1 -0
- package/dist/src/components/source-file/source-file.test.d.ts +2 -0
- package/dist/src/components/source-file/source-file.test.d.ts.map +1 -0
- package/dist/src/components/source-file/source-file.test.js +136 -0
- package/dist/src/components/source-file/source-file.test.js.map +1 -0
- package/dist/src/components/stc/index.js +2 -1
- package/dist/src/components/stc/index.js.map +1 -0
- package/dist/src/components/struct/declaration.d.ts.map +1 -1
- package/dist/src/components/struct/declaration.js +6 -7
- package/dist/src/components/struct/declaration.js.map +1 -0
- package/dist/src/components/struct/declaration.test.js +32 -40
- package/dist/src/components/struct/declaration.test.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameter-constraints.js +2 -1
- package/dist/src/components/type-parameters/type-parameter-constraints.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameter-constraints.test.js +2 -1
- package/dist/src/components/type-parameters/type-parameter-constraints.test.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameter.d.ts.map +1 -1
- package/dist/src/components/type-parameters/type-parameter.js +9 -11
- package/dist/src/components/type-parameters/type-parameter.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameters.js +2 -1
- package/dist/src/components/type-parameters/type-parameters.js.map +1 -0
- package/dist/src/components/type-parameters/type-parameters.test.js +5 -4
- package/dist/src/components/type-parameters/type-parameters.test.js.map +1 -0
- package/dist/src/components/var/declaration.d.ts.map +1 -1
- package/dist/src/components/var/declaration.js +8 -9
- package/dist/src/components/var/declaration.js.map +1 -0
- package/dist/src/components/var/declaration.test.js +13 -21
- package/dist/src/components/var/declaration.test.js.map +1 -0
- package/dist/src/contexts/format-options.d.ts +5 -0
- package/dist/src/contexts/format-options.d.ts.map +1 -0
- package/dist/src/contexts/format-options.js +9 -0
- package/dist/src/contexts/format-options.js.map +1 -0
- package/dist/src/contexts/global-namespace.d.ts +5 -0
- package/dist/src/contexts/global-namespace.d.ts.map +1 -0
- package/dist/src/contexts/global-namespace.js +25 -0
- package/dist/src/contexts/global-namespace.js.map +1 -0
- package/dist/src/contexts/namespace.d.ts +8 -0
- package/dist/src/contexts/namespace.d.ts.map +1 -0
- package/dist/src/contexts/namespace.js +6 -0
- package/dist/src/contexts/namespace.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 +4 -1
- package/dist/src/index.js.map +1 -0
- package/dist/src/modifiers.d.ts +11 -0
- package/dist/src/modifiers.d.ts.map +1 -1
- package/dist/src/modifiers.js +2 -1
- package/dist/src/modifiers.js.map +1 -0
- package/dist/src/name-policy.js +2 -1
- package/dist/src/name-policy.js.map +1 -0
- package/dist/src/scopes/class.d.ts +10 -0
- package/dist/src/scopes/class.d.ts.map +1 -0
- package/dist/src/scopes/class.js +11 -0
- package/dist/src/scopes/class.js.map +1 -0
- package/dist/src/scopes/contexts.d.ts +9 -0
- package/dist/src/scopes/contexts.d.ts.map +1 -0
- package/dist/src/scopes/contexts.js +34 -0
- package/dist/src/scopes/contexts.js.map +1 -0
- package/dist/src/scopes/csharp.d.ts +10 -0
- package/dist/src/scopes/csharp.d.ts.map +1 -0
- package/dist/src/scopes/csharp.js +15 -0
- package/dist/src/scopes/csharp.js.map +1 -0
- package/dist/src/scopes/factories.d.ts +9 -0
- package/dist/src/scopes/factories.d.ts.map +1 -0
- package/dist/src/scopes/factories.js +24 -0
- package/dist/src/scopes/factories.js.map +1 -0
- package/dist/src/scopes/index.d.ts +10 -0
- package/dist/src/scopes/index.d.ts.map +1 -0
- package/dist/src/scopes/index.js +10 -0
- package/dist/src/scopes/index.js.map +1 -0
- package/dist/src/scopes/lexical.d.ts +7 -0
- package/dist/src/scopes/lexical.d.ts.map +1 -0
- package/dist/src/scopes/lexical.js +8 -0
- package/dist/src/scopes/lexical.js.map +1 -0
- package/dist/src/scopes/method.d.ts +9 -0
- package/dist/src/scopes/method.d.ts.map +1 -0
- package/dist/src/scopes/method.js +14 -0
- package/dist/src/scopes/method.js.map +1 -0
- package/dist/src/scopes/named-type.d.ts +22 -0
- package/dist/src/scopes/named-type.d.ts.map +1 -0
- package/dist/src/scopes/named-type.js +33 -0
- package/dist/src/scopes/named-type.js.map +1 -0
- package/dist/src/scopes/namespace.d.ts +11 -0
- package/dist/src/scopes/namespace.d.ts.map +1 -0
- package/dist/src/scopes/namespace.js +39 -0
- package/dist/src/scopes/namespace.js.map +1 -0
- package/dist/src/scopes/source-file.d.ts +16 -0
- package/dist/src/scopes/source-file.d.ts.map +1 -0
- package/dist/src/scopes/source-file.js +44 -0
- package/dist/src/scopes/source-file.js.map +1 -0
- package/dist/src/symbols/csharp.d.ts +87 -0
- package/dist/src/symbols/csharp.d.ts.map +1 -0
- package/dist/src/symbols/csharp.js +246 -0
- package/dist/src/symbols/csharp.js.map +1 -0
- package/dist/src/symbols/factories.d.ts +25 -0
- package/dist/src/symbols/factories.d.ts.map +1 -0
- package/dist/src/symbols/factories.js +93 -0
- package/dist/src/symbols/factories.js.map +1 -0
- package/dist/src/symbols/index.d.ts +5 -2
- package/dist/src/symbols/index.d.ts.map +1 -1
- package/dist/src/symbols/index.js +6 -2
- package/dist/src/symbols/index.js.map +1 -0
- package/dist/src/symbols/method.d.ts +13 -0
- package/dist/src/symbols/method.d.ts.map +1 -0
- package/dist/src/symbols/method.js +16 -0
- package/dist/src/symbols/method.js.map +1 -0
- package/dist/src/symbols/named-type.d.ts +19 -0
- package/dist/src/symbols/named-type.d.ts.map +1 -0
- package/dist/src/symbols/named-type.js +31 -0
- package/dist/src/symbols/named-type.js.map +1 -0
- package/dist/src/symbols/namespace.d.ts +22 -0
- package/dist/src/symbols/namespace.d.ts.map +1 -0
- package/dist/src/symbols/namespace.js +45 -0
- package/dist/src/symbols/namespace.js.map +1 -0
- package/dist/src/symbols/reference.d.ts +2 -2
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js +50 -44
- package/dist/src/symbols/reference.js.map +1 -0
- package/dist/test/project-directory.test.js +20 -19
- package/dist/test/project-directory.test.js.map +1 -0
- package/dist/test/using.test.js +23 -21
- package/dist/test/using.test.js.map +1 -0
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +7 -4
- package/dist/test/utils.js.map +1 -0
- package/dist/test/vitest.setup.js +2 -1
- package/dist/test/vitest.setup.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -6
- package/src/components/Declaration.tsx +3 -6
- package/src/components/Reference.tsx +3 -1
- package/src/components/UsingDirective.tsx +12 -2
- package/src/components/access-expression/access-expression.test.tsx +284 -0
- package/src/components/access-expression/access-expression.tsx +375 -0
- package/src/components/access-expression/part-descriptors.ts +175 -0
- package/src/components/class/declaration.test.tsx +484 -0
- package/src/components/{ClassDeclaration.tsx → class/declaration.tsx} +63 -44
- package/src/components/constructor/constructor.test.tsx +11 -17
- package/src/components/constructor/constructor.tsx +13 -32
- package/src/components/enum/declaration.ref.test.tsx +93 -0
- package/src/components/enum/declaration.test.tsx +34 -0
- package/src/components/enum/declaration.tsx +65 -0
- package/src/components/enum/member.test.tsx +24 -0
- package/src/components/enum/member.tsx +36 -0
- package/src/components/field/field.test.tsx +8 -8
- package/src/components/field/field.tsx +12 -22
- package/src/components/index.ts +8 -4
- package/src/components/interface/declaration.test.tsx +26 -32
- package/src/components/interface/declaration.tsx +16 -18
- package/src/components/interface/method.test.tsx +38 -44
- package/src/components/interface/method.tsx +7 -20
- package/src/components/interface/property.test.tsx +11 -11
- package/src/components/interface/property.tsx +15 -34
- package/src/components/invocation-expression/invocation-expression.test.tsx +101 -0
- package/src/components/invocation-expression/invocation-expression.tsx +60 -0
- package/src/components/lexical-scope.tsx +29 -0
- package/src/components/method/method.test.tsx +11 -11
- package/src/components/method/method.tsx +12 -23
- package/src/components/method-scope.tsx +27 -0
- package/src/components/namespace-scopes.tsx +44 -0
- package/src/components/namespace.ref.test.tsx +139 -0
- package/src/components/namespace.test.tsx +52 -0
- package/src/components/namespace.tsx +45 -0
- package/src/components/parameters/parameters.test.tsx +117 -0
- package/src/components/parameters/parameters.tsx +11 -21
- package/src/components/property/property.test.tsx +15 -15
- package/src/components/property/property.tsx +23 -41
- package/src/components/record/declaration.test.tsx +47 -3
- package/src/components/record/declaration.tsx +34 -11
- package/src/components/source-file/source-file.test.tsx +96 -0
- package/src/components/source-file/source-file.tsx +98 -0
- package/src/components/struct/declaration.test.tsx +16 -22
- package/src/components/struct/declaration.tsx +4 -6
- package/src/components/type-parameters/type-parameter.tsx +14 -11
- package/src/components/type-parameters/type-parameters.test.tsx +4 -4
- package/src/components/var/declaration.test.tsx +8 -14
- package/src/components/var/declaration.tsx +12 -6
- package/src/contexts/format-options.ts +14 -0
- package/src/contexts/global-namespace.ts +29 -0
- package/src/contexts/namespace.ts +13 -0
- package/src/index.ts +2 -0
- package/src/modifiers.ts +14 -0
- package/src/scopes/class.ts +12 -0
- package/src/scopes/contexts.ts +45 -0
- package/src/scopes/csharp.ts +23 -0
- package/src/scopes/factories.ts +45 -0
- package/src/scopes/index.ts +9 -0
- package/src/scopes/lexical.ts +10 -0
- package/src/scopes/method.ts +22 -0
- package/src/scopes/named-type.ts +44 -0
- package/src/scopes/namespace.ts +59 -0
- package/src/scopes/source-file.ts +67 -0
- package/src/symbols/csharp.ts +339 -0
- package/src/symbols/factories.ts +215 -0
- package/src/symbols/index.ts +5 -2
- package/src/symbols/method.ts +26 -0
- package/src/symbols/named-type.ts +54 -0
- package/src/symbols/namespace.ts +62 -0
- package/src/symbols/reference.tsx +64 -0
- package/temp/api.json +6910 -2491
- package/test/project-directory.test.tsx +14 -16
- package/test/using.test.tsx +21 -21
- package/test/utils.tsx +2 -1
- package/tsconfig.json +4 -1
- package/tsdoc-metadata.json +1 -1
- package/dist/src/components/ClassDeclaration.d.ts.map +0 -1
- package/dist/src/components/ClassDeclaration.js +0 -92
- package/dist/src/components/EnumDeclaration.d.ts.map +0 -1
- package/dist/src/components/EnumDeclaration.js +0 -85
- package/dist/src/components/Namespace.d.ts +0 -11
- package/dist/src/components/Namespace.d.ts.map +0 -1
- package/dist/src/components/Namespace.js +0 -33
- package/dist/src/components/SourceFile.d.ts +0 -14
- package/dist/src/components/SourceFile.d.ts.map +0 -1
- package/dist/src/components/SourceFile.js +0 -69
- package/dist/src/symbols/csharp-output-symbol.d.ts +0 -8
- package/dist/src/symbols/csharp-output-symbol.d.ts.map +0 -1
- package/dist/src/symbols/csharp-output-symbol.js +0 -19
- package/dist/src/symbols/scopes.d.ts +0 -14
- package/dist/src/symbols/scopes.d.ts.map +0 -1
- package/dist/src/symbols/scopes.js +0 -31
- package/dist/test/class-declaration.test.d.ts +0 -2
- package/dist/test/class-declaration.test.d.ts.map +0 -1
- package/dist/test/class-declaration.test.js +0 -484
- package/dist/test/enum.test.d.ts +0 -2
- package/dist/test/enum.test.d.ts.map +0 -1
- package/dist/test/enum.test.js +0 -178
- package/dist/test/namespace.test.d.ts.map +0 -1
- package/dist/test/namespace.test.js +0 -81
- package/dist/test/sourcefile.test.d.ts +0 -2
- package/dist/test/sourcefile.test.d.ts.map +0 -1
- package/dist/test/sourcefile.test.js +0 -58
- package/src/components/EnumDeclaration.tsx +0 -99
- package/src/components/Namespace.tsx +0 -35
- package/src/components/SourceFile.tsx +0 -78
- package/src/symbols/csharp-output-symbol.ts +0 -22
- package/src/symbols/reference.ts +0 -65
- package/src/symbols/scopes.ts +0 -41
- package/test/class-declaration.test.tsx +0 -413
- package/test/enum.test.tsx +0 -149
- package/test/namespace.test.tsx +0 -55
- package/test/sourcefile.test.tsx +0 -47
- /package/dist/{test → src/components}/namespace.test.d.ts +0 -0
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import * as core from "@alloy-js/core";
|
|
3
|
-
import * as coretest from "@alloy-js/core/testing";
|
|
4
|
-
import { it } from "vitest";
|
|
5
|
-
import * as csharp from "../src/index.js";
|
|
6
|
-
import { assertFileContents } from "./utils.js";
|
|
7
|
-
it("defines multiple namespaces and source files with unique content", () => {
|
|
8
|
-
const res = core.render(_$createComponent(core.Output, {
|
|
9
|
-
get children() {
|
|
10
|
-
return [_$createComponent(csharp.Namespace, {
|
|
11
|
-
name: "Namespace1",
|
|
12
|
-
get children() {
|
|
13
|
-
return [_$createComponent(csharp.SourceFile, {
|
|
14
|
-
path: "Model1.cs",
|
|
15
|
-
get children() {
|
|
16
|
-
return _$createComponent(csharp.ClassDeclaration, {
|
|
17
|
-
"public": true,
|
|
18
|
-
name: "Model1"
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}), _$createComponent(csharp.SourceFile, {
|
|
22
|
-
path: "Model2.cs",
|
|
23
|
-
get children() {
|
|
24
|
-
return _$createComponent(csharp.ClassDeclaration, {
|
|
25
|
-
"public": true,
|
|
26
|
-
name: "Model2"
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
})];
|
|
30
|
-
}
|
|
31
|
-
}), _$createComponent(csharp.Namespace, {
|
|
32
|
-
name: "Namespace2",
|
|
33
|
-
get children() {
|
|
34
|
-
return [_$createComponent(csharp.SourceFile, {
|
|
35
|
-
path: "Model3.cs",
|
|
36
|
-
get children() {
|
|
37
|
-
return _$createComponent(csharp.ClassDeclaration, {
|
|
38
|
-
"public": true,
|
|
39
|
-
name: "Model3"
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}), _$createComponent(csharp.SourceFile, {
|
|
43
|
-
path: "Model4.cs",
|
|
44
|
-
get children() {
|
|
45
|
-
return _$createComponent(csharp.ClassDeclaration, {
|
|
46
|
-
"public": true,
|
|
47
|
-
name: "Model4"
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
})];
|
|
51
|
-
}
|
|
52
|
-
})];
|
|
53
|
-
}
|
|
54
|
-
}));
|
|
55
|
-
assertFileContents(res, {
|
|
56
|
-
"Model1.cs": coretest.d`
|
|
57
|
-
namespace Namespace1
|
|
58
|
-
{
|
|
59
|
-
public class Model1;
|
|
60
|
-
}
|
|
61
|
-
`,
|
|
62
|
-
"Model2.cs": coretest.d`
|
|
63
|
-
namespace Namespace1
|
|
64
|
-
{
|
|
65
|
-
public class Model2;
|
|
66
|
-
}
|
|
67
|
-
`,
|
|
68
|
-
"Model3.cs": coretest.d`
|
|
69
|
-
namespace Namespace2
|
|
70
|
-
{
|
|
71
|
-
public class Model3;
|
|
72
|
-
}
|
|
73
|
-
`,
|
|
74
|
-
"Model4.cs": coretest.d`
|
|
75
|
-
namespace Namespace2
|
|
76
|
-
{
|
|
77
|
-
public class Model4;
|
|
78
|
-
}
|
|
79
|
-
`
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sourcefile.test.d.ts","sourceRoot":"","sources":["../../test/sourcefile.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import * as core from "@alloy-js/core";
|
|
3
|
-
import * as coretest from "@alloy-js/core/testing";
|
|
4
|
-
import { expect, it } from "vitest";
|
|
5
|
-
import * as csharp from "../src/index.js";
|
|
6
|
-
import { assertFileContents } from "./utils.js";
|
|
7
|
-
it("defines multiple source files with unique content", () => {
|
|
8
|
-
const res = core.render(_$createComponent(core.Output, {
|
|
9
|
-
get children() {
|
|
10
|
-
return _$createComponent(csharp.Namespace, {
|
|
11
|
-
name: "TestCode",
|
|
12
|
-
get children() {
|
|
13
|
-
return [_$createComponent(csharp.SourceFile, {
|
|
14
|
-
path: "Test1.cs",
|
|
15
|
-
get children() {
|
|
16
|
-
return _$createComponent(csharp.ClassDeclaration, {
|
|
17
|
-
"public": true,
|
|
18
|
-
name: "TestClass1"
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}), _$createComponent(csharp.SourceFile, {
|
|
22
|
-
path: "Test2.cs",
|
|
23
|
-
get children() {
|
|
24
|
-
return _$createComponent(csharp.ClassDeclaration, {
|
|
25
|
-
"public": true,
|
|
26
|
-
name: "TestClass2"
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
})];
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}));
|
|
34
|
-
assertFileContents(res, {
|
|
35
|
-
"Test1.cs": coretest.d`
|
|
36
|
-
namespace TestCode
|
|
37
|
-
{
|
|
38
|
-
public class TestClass1;
|
|
39
|
-
}
|
|
40
|
-
`,
|
|
41
|
-
"Test2.cs": coretest.d`
|
|
42
|
-
namespace TestCode
|
|
43
|
-
{
|
|
44
|
-
public class TestClass2;
|
|
45
|
-
}
|
|
46
|
-
`
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
it("throws when declaring a source file outside a namespace", () => {
|
|
50
|
-
const decl = _$createComponent(core.Output, {
|
|
51
|
-
get children() {
|
|
52
|
-
return _$createComponent(csharp.SourceFile, {
|
|
53
|
-
path: "Test.cs"
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
expect(() => core.render(decl)).toThrow("SourceFile must be declared inside a namespace");
|
|
58
|
-
});
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import {
|
|
3
|
-
AccessModifiers,
|
|
4
|
-
computeModifiersPrefix,
|
|
5
|
-
getAccessModifier,
|
|
6
|
-
} from "../modifiers.js";
|
|
7
|
-
import { useCSharpNamePolicy } from "../name-policy.js";
|
|
8
|
-
import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
|
|
9
|
-
import { CSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
|
|
10
|
-
import { Name } from "./Name.jsx";
|
|
11
|
-
|
|
12
|
-
// properties for creating an enum
|
|
13
|
-
export interface EnumDeclarationProps extends AccessModifiers {
|
|
14
|
-
name: string;
|
|
15
|
-
refkey?: core.Refkey;
|
|
16
|
-
children?: core.Children;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* A C# enum declaration
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* <EnumDeclaration public name="Color">
|
|
24
|
-
* <EnumMember name="Red" />
|
|
25
|
-
* <EnumMember name="Green" />
|
|
26
|
-
* <EnumMember name="Blue" />
|
|
27
|
-
* </EnumDeclaration>
|
|
28
|
-
* ```
|
|
29
|
-
* This will produce:
|
|
30
|
-
* ```csharp
|
|
31
|
-
* public enum Color
|
|
32
|
-
* {
|
|
33
|
-
* Red,
|
|
34
|
-
* Green,
|
|
35
|
-
* Blue
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export function EnumDeclaration(props: EnumDeclarationProps) {
|
|
40
|
-
const name = useCSharpNamePolicy().getName(props.name!, "enum");
|
|
41
|
-
const scope = useCSharpScope();
|
|
42
|
-
|
|
43
|
-
const thisEnumSymbol = new CSharpOutputSymbol(name, {
|
|
44
|
-
scope,
|
|
45
|
-
refkeys: props.refkey ?? core.refkey(props.name),
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// this creates a new scope for the enum definition.
|
|
49
|
-
// members will automatically "inherit" this scope so
|
|
50
|
-
// that refkeys to them will produce the fully-qualified
|
|
51
|
-
// name e.g. Foo.Bar.
|
|
52
|
-
const thisEnumScope = new CSharpMemberScope("enum-decl", {
|
|
53
|
-
parent: scope,
|
|
54
|
-
owner: thisEnumSymbol,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
const modifiers = computeModifiersPrefix([getAccessModifier(props)]);
|
|
58
|
-
|
|
59
|
-
if (thisEnumScope.owner)
|
|
60
|
-
return (
|
|
61
|
-
<core.Declaration symbol={thisEnumSymbol}>
|
|
62
|
-
{modifiers}enum <Name />
|
|
63
|
-
{!props.children && ";"}
|
|
64
|
-
{props.children && (
|
|
65
|
-
<core.Scope value={thisEnumScope}>
|
|
66
|
-
<core.Block newline>{props.children}</core.Block>
|
|
67
|
-
</core.Scope>
|
|
68
|
-
)}
|
|
69
|
-
</core.Declaration>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// properties for creating a C# enum member
|
|
74
|
-
export interface EnumMemberProps {
|
|
75
|
-
name: string;
|
|
76
|
-
refkey?: core.Refkey;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// a member within a C# enum
|
|
80
|
-
export function EnumMember(props: EnumMemberProps) {
|
|
81
|
-
const scope = useCSharpScope();
|
|
82
|
-
if (scope.kind === "member" && scope.name !== "enum-decl") {
|
|
83
|
-
throw new Error(
|
|
84
|
-
"can't define an enum member outside of an enum-decl scope",
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const name = useCSharpNamePolicy().getName(props.name, "enum-member");
|
|
89
|
-
const thisEnumValueSymbol = new CSharpOutputSymbol(name, {
|
|
90
|
-
scope,
|
|
91
|
-
refkeys: props.refkey ?? core.refkey(props.name),
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<core.Declaration symbol={thisEnumValueSymbol}>
|
|
96
|
-
<Name />
|
|
97
|
-
</core.Declaration>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import { CSharpNamespaceScope } from "../symbols/scopes.js";
|
|
3
|
-
|
|
4
|
-
// contains the info for the current namespace
|
|
5
|
-
export interface NamespaceContext {
|
|
6
|
-
name: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const NamespaceContext = core.createContext<NamespaceContext>();
|
|
10
|
-
|
|
11
|
-
// returns the current namespace
|
|
12
|
-
export function useNamespace(): NamespaceContext | undefined {
|
|
13
|
-
return core.useContext(NamespaceContext) as NamespaceContext;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// properties for creating a C# namespace
|
|
17
|
-
export interface NamespaceProps {
|
|
18
|
-
name: string;
|
|
19
|
-
children?: core.Children;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// a C# namespace. contains one or more source files
|
|
23
|
-
export function Namespace(props: NamespaceProps) {
|
|
24
|
-
const scope = new CSharpNamespaceScope(props.name);
|
|
25
|
-
|
|
26
|
-
const namespaceCtx: NamespaceContext = {
|
|
27
|
-
name: props.name,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<NamespaceContext.Provider value={namespaceCtx}>
|
|
32
|
-
<core.Scope value={scope}>{props.children}</core.Scope>
|
|
33
|
-
</NamespaceContext.Provider>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import { useNamespace } from "./Namespace.jsx";
|
|
3
|
-
import { Reference } from "./Reference.jsx";
|
|
4
|
-
import { UsingDirective } from "./UsingDirective.jsx";
|
|
5
|
-
|
|
6
|
-
// contains the info for the current source file
|
|
7
|
-
export interface SourceFileContext {
|
|
8
|
-
// adds a namespace to the array of using statements
|
|
9
|
-
addUsing(namespace: string): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const SourceFileContext = core.createContext<SourceFileContext>();
|
|
13
|
-
|
|
14
|
-
// returns the current source file
|
|
15
|
-
export function useSourceFile(): SourceFileContext | undefined {
|
|
16
|
-
return core.useContext(SourceFileContext) as SourceFileContext;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface SourceFileProps {
|
|
20
|
-
/** Path of the source file */
|
|
21
|
-
path: string;
|
|
22
|
-
|
|
23
|
-
/** A list of namespaces to use */
|
|
24
|
-
using?: Array<string>;
|
|
25
|
-
|
|
26
|
-
children?: core.Children;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// a C# source file. exists within the context of a namespace
|
|
30
|
-
// contains using statements and declarations
|
|
31
|
-
export function SourceFile(props: SourceFileProps) {
|
|
32
|
-
const namespaceCtx = useNamespace();
|
|
33
|
-
|
|
34
|
-
if (!namespaceCtx) {
|
|
35
|
-
throw new Error("SourceFile must be declared inside a namespace");
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const using: Array<string> = core.reactive(new Array<string>());
|
|
39
|
-
if (props.using) {
|
|
40
|
-
using.push(...props.using);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// adds the specified namespace to the array of using statements.
|
|
44
|
-
// called via SourceFileContext.addUsing when resolving refkeys.
|
|
45
|
-
function addUsing(namespace: string): void {
|
|
46
|
-
if (!using.includes(namespace)) {
|
|
47
|
-
using.push(namespace);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const sourceFileCtx: SourceFileContext = {
|
|
52
|
-
addUsing,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<core.SourceFile
|
|
57
|
-
path={props.path}
|
|
58
|
-
filetype="cs"
|
|
59
|
-
reference={Reference}
|
|
60
|
-
tabWidth={4}
|
|
61
|
-
printWidth={120}
|
|
62
|
-
>
|
|
63
|
-
<SourceFileContext.Provider value={sourceFileCtx}>
|
|
64
|
-
<core.Scope name={props.path} kind="source-file">
|
|
65
|
-
{using.length > 0 && (
|
|
66
|
-
<>
|
|
67
|
-
<UsingDirective namespaces={using} />
|
|
68
|
-
<hbr />
|
|
69
|
-
<hbr />
|
|
70
|
-
</>
|
|
71
|
-
)}
|
|
72
|
-
namespace {namespaceCtx.name}
|
|
73
|
-
<core.Block newline>{props.children}</core.Block>
|
|
74
|
-
</core.Scope>
|
|
75
|
-
</SourceFileContext.Provider>
|
|
76
|
-
</core.SourceFile>
|
|
77
|
-
);
|
|
78
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import { useNamespace } from "../components/Namespace.jsx";
|
|
3
|
-
import { CSharpOutputScope } from "./scopes.js";
|
|
4
|
-
|
|
5
|
-
// represents a symbol from a .cs file. Class, enum, interface etc.
|
|
6
|
-
|
|
7
|
-
export class CSharpOutputSymbol extends core.OutputSymbol {
|
|
8
|
-
get scope() {
|
|
9
|
-
return super.scope as CSharpOutputScope;
|
|
10
|
-
}
|
|
11
|
-
set scope(value: CSharpOutputScope) {
|
|
12
|
-
super.scope = value;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
constructor(name: string, options?: core.OutputSymbolOptions) {
|
|
16
|
-
const namespaceCtx = useNamespace();
|
|
17
|
-
if (!namespaceCtx) {
|
|
18
|
-
throw new Error("symbol must be declared inside a namespace");
|
|
19
|
-
}
|
|
20
|
-
super(name, options);
|
|
21
|
-
}
|
|
22
|
-
}
|
package/src/symbols/reference.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import { useNamespace } from "../components/Namespace.jsx";
|
|
3
|
-
import { useSourceFile } from "../components/SourceFile.jsx";
|
|
4
|
-
import { CSharpOutputSymbol } from "./csharp-output-symbol.js";
|
|
5
|
-
import { CSharpOutputScope } from "./scopes.js";
|
|
6
|
-
|
|
7
|
-
// when resolving references across source files, the last element
|
|
8
|
-
// in pathDown will be the containing source file. we only need this
|
|
9
|
-
// here so we can find and remove this scope as it's not useful
|
|
10
|
-
// when building the reference
|
|
11
|
-
interface SourceFileScope extends core.OutputScope {
|
|
12
|
-
kind: "source-file";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type ReferenceScope = CSharpOutputScope | SourceFileScope;
|
|
16
|
-
|
|
17
|
-
// converts a refkey to its fully qualified name
|
|
18
|
-
// e.g. if refkey is for bar in enum type foo, and
|
|
19
|
-
// foo is in the same namespace as the refkey, then
|
|
20
|
-
// the result would be foo.bar.
|
|
21
|
-
export function ref(refkey: core.Refkey): () => string {
|
|
22
|
-
const targetNamespaceCtx = useNamespace();
|
|
23
|
-
const resolveResult = core.resolve<ReferenceScope, CSharpOutputSymbol>(
|
|
24
|
-
refkey as core.Refkey,
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
return core.memo(() => {
|
|
28
|
-
if (resolveResult.value === undefined) {
|
|
29
|
-
return "<Unresolved Symbol>";
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// targetDeclaration is the symbol with the refkey
|
|
33
|
-
// pathDown is an array of scopes to that symbol and can be empty.
|
|
34
|
-
// the entries are top-down, so namespace, source-file, member
|
|
35
|
-
// - referencing a type within the same namespace will have an empty path
|
|
36
|
-
// - referencing a member (e.g. enum value) within the same namespace will
|
|
37
|
-
// have a single path entry that contains the owning type
|
|
38
|
-
// - referencing a type within the same namespace but in a different source
|
|
39
|
-
// file will have at least a source-file entry
|
|
40
|
-
// - referencing a symbol outside the current namespace will have at least
|
|
41
|
-
// two entries, namespace, source-file
|
|
42
|
-
const { targetDeclaration, pathDown } = resolveResult.value;
|
|
43
|
-
|
|
44
|
-
const sourceNamespace = pathDown.find((v) => {
|
|
45
|
-
return v.kind === "namespace";
|
|
46
|
-
});
|
|
47
|
-
if (sourceNamespace && sourceNamespace.name !== targetNamespaceCtx!.name) {
|
|
48
|
-
// the source symbol is in a different namespace that the target refkey.
|
|
49
|
-
// add the applicable using statement to the target's source file.
|
|
50
|
-
const targetSrc = useSourceFile();
|
|
51
|
-
targetSrc!.addUsing(sourceNamespace.name);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// we only need to build the fully-qualified name for members
|
|
55
|
-
// TODO: possibly a subset of members
|
|
56
|
-
const syms = (pathDown as ReferenceScope[])
|
|
57
|
-
.filter((v) => {
|
|
58
|
-
return v.kind === "member";
|
|
59
|
-
})
|
|
60
|
-
.map((s) => s.owner!);
|
|
61
|
-
syms.push(targetDeclaration);
|
|
62
|
-
|
|
63
|
-
return syms.map((sym) => sym.name).join(".");
|
|
64
|
-
});
|
|
65
|
-
}
|
package/src/symbols/scopes.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import { CSharpOutputSymbol } from "./csharp-output-symbol.js";
|
|
3
|
-
|
|
4
|
-
// indicates that the scope for a symbols is at the namespace level
|
|
5
|
-
export class CSharpNamespaceScope extends core.OutputScope {
|
|
6
|
-
get kind() {
|
|
7
|
-
return "namespace";
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// the kind of member scope. i.e. are we in an enum, class, etc
|
|
12
|
-
export type CSharpMemberScopeName =
|
|
13
|
-
| "class-decl"
|
|
14
|
-
| "constructor-decl"
|
|
15
|
-
| "enum-decl"
|
|
16
|
-
| "method-decl";
|
|
17
|
-
|
|
18
|
-
// indicates that the scope for a symbol resides within a type
|
|
19
|
-
// e.g. for an enum value, class field etc, these would have
|
|
20
|
-
// member scope where the owner is the containing type.
|
|
21
|
-
export class CSharpMemberScope extends core.OutputScope {
|
|
22
|
-
get kind() {
|
|
23
|
-
return "member";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get name() {
|
|
27
|
-
return super.name as CSharpMemberScopeName;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get owner() {
|
|
31
|
-
return super.owner as CSharpOutputSymbol;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// contains the possible scopes where a declaration can reside
|
|
36
|
-
export type CSharpOutputScope = CSharpMemberScope | CSharpNamespaceScope;
|
|
37
|
-
|
|
38
|
-
// returns the current C# scope
|
|
39
|
-
export function useCSharpScope(): CSharpOutputScope {
|
|
40
|
-
return core.useScope() as CSharpOutputScope;
|
|
41
|
-
}
|