@alloy-js/csharp 0.16.0 → 0.18.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/CHANGELOG.md +4 -0
- package/dist/src/components/ClassDeclaration.d.ts +57 -0
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -0
- package/dist/src/components/{Class.js → ClassDeclaration.js} +58 -69
- package/dist/src/components/ClassMethod.d.ts +25 -0
- package/dist/src/components/ClassMethod.d.ts.map +1 -0
- package/dist/src/components/ClassMethod.js +60 -0
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +4 -2
- package/dist/src/components/EnumDeclaration.d.ts +34 -0
- package/dist/src/components/EnumDeclaration.d.ts.map +1 -0
- package/dist/src/components/{Enum.js → EnumDeclaration.js} +36 -14
- package/dist/src/components/Namespace.d.ts.map +1 -1
- package/dist/src/components/Namespace.js +2 -2
- package/dist/src/components/Parameters.d.ts.map +1 -1
- package/dist/src/components/Parameters.js +3 -3
- package/dist/src/components/doc/comment.d.ts +70 -0
- package/dist/src/components/doc/comment.d.ts.map +1 -0
- package/dist/src/components/doc/comment.js +88 -0
- package/dist/src/components/doc/comment.test.d.ts +2 -0
- package/dist/src/components/doc/comment.test.d.ts.map +1 -0
- package/dist/src/components/doc/comment.test.js +348 -0
- package/dist/src/components/doc/from-markdown.d.ts +6 -0
- package/dist/src/components/doc/from-markdown.d.ts.map +1 -0
- package/dist/src/components/doc/from-markdown.js +58 -0
- package/dist/src/components/doc/from-markdown.test.d.ts +2 -0
- package/dist/src/components/doc/from-markdown.test.d.ts.map +1 -0
- package/dist/src/components/doc/from-markdown.test.js +83 -0
- package/dist/src/components/index.d.ts +7 -2
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +7 -2
- package/dist/src/components/interface/declaration.d.ts +34 -0
- package/dist/src/components/interface/declaration.d.ts.map +1 -0
- package/dist/src/components/interface/declaration.js +90 -0
- package/dist/src/components/interface/declaration.test.d.ts +2 -0
- package/dist/src/components/interface/declaration.test.d.ts.map +1 -0
- package/dist/src/components/interface/declaration.test.js +69 -0
- package/dist/src/components/interface/method.d.ts +18 -0
- package/dist/src/components/interface/method.d.ts.map +1 -0
- package/dist/src/components/interface/method.js +59 -0
- package/dist/src/components/interface/method.test.d.ts +2 -0
- package/dist/src/components/interface/method.test.d.ts.map +1 -0
- package/dist/src/components/interface/method.test.js +131 -0
- package/dist/src/components/interface/property.d.ts +21 -0
- package/dist/src/components/interface/property.d.ts.map +1 -0
- package/dist/src/components/interface/property.js +59 -0
- package/dist/src/components/interface/property.test.d.ts +2 -0
- package/dist/src/components/interface/property.test.d.ts.map +1 -0
- package/dist/src/components/interface/property.test.js +165 -0
- package/dist/src/components/stc/index.d.ts +2 -2
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +2 -2
- package/dist/src/modifiers.d.ts +13 -4
- package/dist/src/modifiers.d.ts.map +1 -1
- package/dist/src/modifiers.js +13 -27
- 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/symbols/csharp-output-symbol.d.ts +4 -4
- package/dist/src/symbols/csharp-output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/csharp-output-symbol.js +13 -13
- package/dist/src/symbols/scopes.d.ts +6 -8
- package/dist/src/symbols/scopes.d.ts.map +1 -1
- package/dist/src/symbols/scopes.js +14 -19
- package/dist/test/class-declaration.test.d.ts +2 -0
- package/dist/test/class-declaration.test.d.ts.map +1 -0
- package/dist/test/{class.test.js → class-declaration.test.js} +123 -73
- package/dist/test/class-method.test.d.ts +2 -0
- package/dist/test/class-method.test.d.ts.map +1 -0
- package/dist/test/class-method.test.js +161 -0
- package/dist/test/enum.test.js +12 -12
- package/dist/test/namespace.test.js +8 -8
- package/dist/test/project-directory.test.d.ts +2 -0
- package/dist/test/project-directory.test.d.ts.map +1 -0
- package/dist/test/{projectdirectory.test.js → project-directory.test.js} +8 -8
- package/dist/test/sourcefile.test.js +4 -4
- package/dist/test/using.test.js +9 -9
- package/dist/test/utils.d.ts +3 -0
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +15 -0
- package/dist/test/vitest.setup.d.ts +2 -0
- package/dist/test/vitest.setup.d.ts.map +1 -0
- package/dist/test/vitest.setup.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -7
- package/src/components/{Class.tsx → ClassDeclaration.tsx} +84 -98
- package/src/components/ClassMethod.tsx +94 -0
- package/src/components/Declaration.tsx +5 -2
- package/src/components/EnumDeclaration.tsx +99 -0
- package/src/components/Namespace.tsx +2 -6
- package/src/components/Parameters.tsx +2 -3
- package/src/components/doc/comment.test.tsx +337 -0
- package/src/components/doc/comment.tsx +152 -0
- package/src/components/doc/from-markdown.test.tsx +103 -0
- package/src/components/doc/from-markdown.tsx +58 -0
- package/src/components/index.ts +7 -2
- package/src/components/interface/declaration.test.tsx +56 -0
- package/src/components/interface/declaration.tsx +109 -0
- package/src/components/interface/method.test.tsx +120 -0
- package/src/components/interface/method.tsx +82 -0
- package/src/components/interface/property.test.tsx +144 -0
- package/src/components/interface/property.tsx +90 -0
- package/src/components/stc/index.ts +2 -2
- package/src/modifiers.ts +32 -37
- package/src/name-policy.ts +2 -0
- package/src/symbols/csharp-output-symbol.ts +13 -18
- package/src/symbols/reference.ts +1 -1
- package/src/symbols/scopes.ts +15 -34
- package/temp/api.json +3470 -649
- package/test/{class.test.tsx → class-declaration.test.tsx} +103 -99
- package/test/class-method.test.tsx +147 -0
- package/test/enum.test.tsx +11 -11
- package/test/namespace.test.tsx +4 -4
- package/test/{projectdirectory.test.tsx → project-directory.test.tsx} +4 -4
- package/test/sourcefile.test.tsx +2 -2
- package/test/using.test.tsx +9 -9
- package/test/utils.tsx +9 -0
- package/test/vitest.setup.ts +1 -0
- package/tsconfig.json +2 -1
- package/tsdoc-metadata.json +1 -1
- package/vitest.config.ts +3 -0
- package/dist/src/components/Class.d.ts +0 -36
- package/dist/src/components/Class.d.ts.map +0 -1
- package/dist/src/components/Enum.d.ts +0 -15
- package/dist/src/components/Enum.d.ts.map +0 -1
- package/dist/test/class.test.d.ts +0 -2
- package/dist/test/class.test.d.ts.map +0 -1
- package/dist/test/projectdirectory.test.d.ts +0 -2
- package/dist/test/projectdirectory.test.d.ts.map +0 -1
- package/src/components/Enum.tsx +0 -78
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { memo as _$memo, createComponent as _$createComponent, mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { ClassDeclaration, ClassMethod } from "../src/index.js";
|
|
4
|
+
import { TestNamespace } from "./utils.js";
|
|
5
|
+
const Wrapper = props => _$createComponent(TestNamespace, {
|
|
6
|
+
get children() {
|
|
7
|
+
return _$createComponent(ClassDeclaration, {
|
|
8
|
+
"public": true,
|
|
9
|
+
name: "TestClass",
|
|
10
|
+
get children() {
|
|
11
|
+
return props.children;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
describe("modifiers", () => {
|
|
17
|
+
describe("access modifiers", () => {
|
|
18
|
+
it.each(["public", "private", "protected", "internal"])("%s", accessModifier => {
|
|
19
|
+
expect(_$createComponent(Wrapper, {
|
|
20
|
+
get children() {
|
|
21
|
+
return _$createComponent(ClassMethod, _$mergeProps({
|
|
22
|
+
[accessModifier]: true
|
|
23
|
+
}, {
|
|
24
|
+
name: "MethodOne"
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
})).toRenderTo(`
|
|
28
|
+
public class TestClass
|
|
29
|
+
{
|
|
30
|
+
${accessModifier} void MethodOne() {}
|
|
31
|
+
}
|
|
32
|
+
`);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
describe("method modifiers", () => {
|
|
36
|
+
it.each(["static", "virtual", "sealed"])("%s", methodModifier => {
|
|
37
|
+
expect(_$createComponent(Wrapper, {
|
|
38
|
+
get children() {
|
|
39
|
+
return _$createComponent(ClassMethod, _$mergeProps({
|
|
40
|
+
[methodModifier]: true
|
|
41
|
+
}, {
|
|
42
|
+
name: "MethodOne"
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
})).toRenderTo(`
|
|
46
|
+
public class TestClass
|
|
47
|
+
{
|
|
48
|
+
${methodModifier} void MethodOne() {}
|
|
49
|
+
}
|
|
50
|
+
`);
|
|
51
|
+
});
|
|
52
|
+
it("abstract exclude body", () => {
|
|
53
|
+
expect(_$createComponent(Wrapper, {
|
|
54
|
+
get children() {
|
|
55
|
+
return _$createComponent(ClassMethod, {
|
|
56
|
+
abstract: true,
|
|
57
|
+
name: "MethodOne"
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
})).toRenderTo(`
|
|
61
|
+
public class TestClass
|
|
62
|
+
{
|
|
63
|
+
abstract void MethodOne();
|
|
64
|
+
}
|
|
65
|
+
`);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
it("mark method async", () => {
|
|
69
|
+
expect(_$createComponent(Wrapper, {
|
|
70
|
+
get children() {
|
|
71
|
+
return _$createComponent(ClassMethod, {
|
|
72
|
+
async: true,
|
|
73
|
+
name: "MethodOne"
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
})).toRenderTo(`
|
|
77
|
+
public class TestClass
|
|
78
|
+
{
|
|
79
|
+
async Task MethodOne() {}
|
|
80
|
+
}
|
|
81
|
+
`);
|
|
82
|
+
});
|
|
83
|
+
it("combine modifiers", () => {
|
|
84
|
+
expect(_$createComponent(Wrapper, {
|
|
85
|
+
get children() {
|
|
86
|
+
return _$createComponent(ClassMethod, {
|
|
87
|
+
async: true,
|
|
88
|
+
returns: "Task",
|
|
89
|
+
"public": true,
|
|
90
|
+
abstract: true,
|
|
91
|
+
name: "MethodOne"
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
})).toRenderTo(`
|
|
95
|
+
public class TestClass
|
|
96
|
+
{
|
|
97
|
+
public abstract async Task MethodOne();
|
|
98
|
+
}
|
|
99
|
+
`);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
it("applies PascalCase naming policy", () => {
|
|
103
|
+
expect(_$createComponent(Wrapper, {
|
|
104
|
+
get children() {
|
|
105
|
+
return _$createComponent(ClassMethod, {
|
|
106
|
+
name: "method_one"
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
})).toRenderTo(`
|
|
110
|
+
public class TestClass
|
|
111
|
+
{
|
|
112
|
+
void MethodOne() {}
|
|
113
|
+
}
|
|
114
|
+
`);
|
|
115
|
+
});
|
|
116
|
+
it("defines params and return type", () => {
|
|
117
|
+
const params = [{
|
|
118
|
+
name: "intParam",
|
|
119
|
+
type: "int"
|
|
120
|
+
}, {
|
|
121
|
+
name: "stringParam",
|
|
122
|
+
type: "string"
|
|
123
|
+
}];
|
|
124
|
+
const res = _$createComponent(Wrapper, {
|
|
125
|
+
get children() {
|
|
126
|
+
return _$createComponent(ClassMethod, {
|
|
127
|
+
"public": true,
|
|
128
|
+
name: "MethodOne",
|
|
129
|
+
parameters: params,
|
|
130
|
+
returns: "string"
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
expect(res).toRenderTo(`
|
|
135
|
+
public class TestClass
|
|
136
|
+
{
|
|
137
|
+
public string MethodOne(int intParam, string stringParam) {}
|
|
138
|
+
}
|
|
139
|
+
`);
|
|
140
|
+
});
|
|
141
|
+
it("specify doc comment", () => {
|
|
142
|
+
expect(_$createComponent(TestNamespace, {
|
|
143
|
+
get children() {
|
|
144
|
+
return _$createComponent(ClassDeclaration, {
|
|
145
|
+
name: "Test",
|
|
146
|
+
get children() {
|
|
147
|
+
return _$createComponent(ClassMethod, {
|
|
148
|
+
name: "Method",
|
|
149
|
+
doc: "This is a test"
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
})).toRenderTo(`
|
|
155
|
+
class Test
|
|
156
|
+
{
|
|
157
|
+
/// This is a test
|
|
158
|
+
void Method() {}
|
|
159
|
+
}
|
|
160
|
+
`);
|
|
161
|
+
});
|
package/dist/test/enum.test.js
CHANGED
|
@@ -5,8 +5,8 @@ import { expect, it } from "vitest";
|
|
|
5
5
|
import * as csharp from "../src/index.js";
|
|
6
6
|
import * as utils from "./utils.js";
|
|
7
7
|
it("declares enum with no members", () => {
|
|
8
|
-
const res = utils.toSourceText(_$createComponent(csharp.
|
|
9
|
-
|
|
8
|
+
const res = utils.toSourceText(_$createComponent(csharp.EnumDeclaration, {
|
|
9
|
+
"public": true,
|
|
10
10
|
name: "TestEnum"
|
|
11
11
|
}));
|
|
12
12
|
expect(res).toBe(coretest.d`
|
|
@@ -17,8 +17,8 @@ it("declares enum with no members", () => {
|
|
|
17
17
|
`);
|
|
18
18
|
});
|
|
19
19
|
it("declares enum with members", () => {
|
|
20
|
-
const res = utils.toSourceText(_$createComponent(csharp.
|
|
21
|
-
|
|
20
|
+
const res = utils.toSourceText(_$createComponent(csharp.EnumDeclaration, {
|
|
21
|
+
"public": true,
|
|
22
22
|
name: "TestEnum",
|
|
23
23
|
get children() {
|
|
24
24
|
return [_$createComponent(csharp.EnumMember, {
|
|
@@ -40,8 +40,8 @@ it("declares enum with members", () => {
|
|
|
40
40
|
`);
|
|
41
41
|
});
|
|
42
42
|
it("applies naming policy to enum and members", () => {
|
|
43
|
-
const res = utils.toSourceText(_$createComponent(csharp.
|
|
44
|
-
|
|
43
|
+
const res = utils.toSourceText(_$createComponent(csharp.EnumDeclaration, {
|
|
44
|
+
"public": true,
|
|
45
45
|
name: "testEnum",
|
|
46
46
|
get children() {
|
|
47
47
|
return [_$createComponent(csharp.EnumMember, {
|
|
@@ -73,8 +73,8 @@ it("can reference things by refkey", () => {
|
|
|
73
73
|
return _$createComponent(csharp.SourceFile, {
|
|
74
74
|
path: "Test.cs",
|
|
75
75
|
get children() {
|
|
76
|
-
return [_$createComponent(csharp.
|
|
77
|
-
|
|
76
|
+
return [_$createComponent(csharp.EnumDeclaration, {
|
|
77
|
+
"public": true,
|
|
78
78
|
name: "TestEnum",
|
|
79
79
|
refkey: enumRK,
|
|
80
80
|
get children() {
|
|
@@ -116,8 +116,8 @@ it("can reference things by refkey across files", () => {
|
|
|
116
116
|
return [_$createComponent(csharp.SourceFile, {
|
|
117
117
|
path: "Test.cs",
|
|
118
118
|
get children() {
|
|
119
|
-
return [_$createComponent(csharp.
|
|
120
|
-
|
|
119
|
+
return [_$createComponent(csharp.EnumDeclaration, {
|
|
120
|
+
"public": true,
|
|
121
121
|
name: "TestEnum",
|
|
122
122
|
get children() {
|
|
123
123
|
return [_$createComponent(csharp.EnumMember, {
|
|
@@ -131,8 +131,8 @@ it("can reference things by refkey across files", () => {
|
|
|
131
131
|
}), _$createComponent(csharp.SourceFile, {
|
|
132
132
|
path: "Other.cs",
|
|
133
133
|
get children() {
|
|
134
|
-
return [_$createComponent(csharp.
|
|
135
|
-
|
|
134
|
+
return [_$createComponent(csharp.EnumDeclaration, {
|
|
135
|
+
"public": true,
|
|
136
136
|
name: "OtherEnum",
|
|
137
137
|
refkey: enumRK,
|
|
138
138
|
get children() {
|
|
@@ -12,16 +12,16 @@ it("defines multiple namespaces and source files with unique content", () => {
|
|
|
12
12
|
return [_$createComponent(csharp.SourceFile, {
|
|
13
13
|
path: "Model1.cs",
|
|
14
14
|
get children() {
|
|
15
|
-
return _$createComponent(csharp.
|
|
16
|
-
|
|
15
|
+
return _$createComponent(csharp.ClassDeclaration, {
|
|
16
|
+
"public": true,
|
|
17
17
|
name: "Model1"
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
}), _$createComponent(csharp.SourceFile, {
|
|
21
21
|
path: "Model2.cs",
|
|
22
22
|
get children() {
|
|
23
|
-
return _$createComponent(csharp.
|
|
24
|
-
|
|
23
|
+
return _$createComponent(csharp.ClassDeclaration, {
|
|
24
|
+
"public": true,
|
|
25
25
|
name: "Model2"
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -33,16 +33,16 @@ it("defines multiple namespaces and source files with unique content", () => {
|
|
|
33
33
|
return [_$createComponent(csharp.SourceFile, {
|
|
34
34
|
path: "Model3.cs",
|
|
35
35
|
get children() {
|
|
36
|
-
return _$createComponent(csharp.
|
|
37
|
-
|
|
36
|
+
return _$createComponent(csharp.ClassDeclaration, {
|
|
37
|
+
"public": true,
|
|
38
38
|
name: "Model3"
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}), _$createComponent(csharp.SourceFile, {
|
|
42
42
|
path: "Model4.cs",
|
|
43
43
|
get children() {
|
|
44
|
-
return _$createComponent(csharp.
|
|
45
|
-
|
|
44
|
+
return _$createComponent(csharp.ClassDeclaration, {
|
|
45
|
+
"public": true,
|
|
46
46
|
name: "Model4"
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-directory.test.d.ts","sourceRoot":"","sources":["../../test/project-directory.test.tsx"],"names":[],"mappings":""}
|
|
@@ -18,16 +18,16 @@ it("defines a project directory file with multiple source files", () => {
|
|
|
18
18
|
return [_$createComponent(csharp.SourceFile, {
|
|
19
19
|
path: "Test1.cs",
|
|
20
20
|
get children() {
|
|
21
|
-
return _$createComponent(csharp.
|
|
22
|
-
|
|
21
|
+
return _$createComponent(csharp.ClassDeclaration, {
|
|
22
|
+
"public": true,
|
|
23
23
|
name: "TestClass1"
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
}), _$createComponent(csharp.SourceFile, {
|
|
27
27
|
path: "Test2.cs",
|
|
28
28
|
get children() {
|
|
29
|
-
return _$createComponent(csharp.
|
|
30
|
-
|
|
29
|
+
return _$createComponent(csharp.ClassDeclaration, {
|
|
30
|
+
"public": true,
|
|
31
31
|
name: "TestClass2"
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -82,16 +82,16 @@ it("defines a project directory file with multiple source files and a custom TFM
|
|
|
82
82
|
return [_$createComponent(csharp.SourceFile, {
|
|
83
83
|
path: "Test1.cs",
|
|
84
84
|
get children() {
|
|
85
|
-
return _$createComponent(csharp.
|
|
86
|
-
|
|
85
|
+
return _$createComponent(csharp.ClassDeclaration, {
|
|
86
|
+
"public": true,
|
|
87
87
|
name: "TestClass1"
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
}), _$createComponent(csharp.SourceFile, {
|
|
91
91
|
path: "Test2.cs",
|
|
92
92
|
get children() {
|
|
93
|
-
return _$createComponent(csharp.
|
|
94
|
-
|
|
93
|
+
return _$createComponent(csharp.ClassDeclaration, {
|
|
94
|
+
"public": true,
|
|
95
95
|
name: "TestClass2"
|
|
96
96
|
});
|
|
97
97
|
}
|
|
@@ -12,16 +12,16 @@ it("defines multiple source files with unique content", () => {
|
|
|
12
12
|
return [_$createComponent(csharp.SourceFile, {
|
|
13
13
|
path: "Test1.cs",
|
|
14
14
|
get children() {
|
|
15
|
-
return _$createComponent(csharp.
|
|
16
|
-
|
|
15
|
+
return _$createComponent(csharp.ClassDeclaration, {
|
|
16
|
+
"public": true,
|
|
17
17
|
name: "TestClass1"
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
}), _$createComponent(csharp.SourceFile, {
|
|
21
21
|
path: "Test2.cs",
|
|
22
22
|
get children() {
|
|
23
|
-
return _$createComponent(csharp.
|
|
24
|
-
|
|
23
|
+
return _$createComponent(csharp.ClassDeclaration, {
|
|
24
|
+
"public": true,
|
|
25
25
|
name: "TestClass2"
|
|
26
26
|
});
|
|
27
27
|
}
|
package/dist/test/using.test.js
CHANGED
|
@@ -63,16 +63,16 @@ it("adds using statement across namespaces", () => {
|
|
|
63
63
|
return _$createComponent(csharp.SourceFile, {
|
|
64
64
|
path: "Models.cs",
|
|
65
65
|
get children() {
|
|
66
|
-
return [_$createComponent(csharp.
|
|
67
|
-
|
|
66
|
+
return [_$createComponent(csharp.ClassDeclaration, {
|
|
67
|
+
"public": true,
|
|
68
68
|
name: "Input",
|
|
69
69
|
refkey: inputTypeRefkey
|
|
70
|
-
}), _$createIntrinsic("hbr", {}), _$createComponent(csharp.
|
|
71
|
-
|
|
70
|
+
}), _$createIntrinsic("hbr", {}), _$createComponent(csharp.ClassDeclaration, {
|
|
71
|
+
"public": true,
|
|
72
72
|
name: "Output",
|
|
73
73
|
refkey: outputTypeRefkey
|
|
74
|
-
}), _$createIntrinsic("hbr", {}), _$createComponent(csharp.
|
|
75
|
-
|
|
74
|
+
}), _$createIntrinsic("hbr", {}), _$createComponent(csharp.EnumDeclaration, {
|
|
75
|
+
"public": true,
|
|
76
76
|
name: "TestEnum",
|
|
77
77
|
get children() {
|
|
78
78
|
return [_$createComponent(csharp.EnumMember, {
|
|
@@ -93,12 +93,12 @@ it("adds using statement across namespaces", () => {
|
|
|
93
93
|
path: "Client.cs",
|
|
94
94
|
using: ["System"],
|
|
95
95
|
get children() {
|
|
96
|
-
return [_$createComponent(csharp.
|
|
97
|
-
|
|
96
|
+
return [_$createComponent(csharp.ClassDeclaration, {
|
|
97
|
+
"public": true,
|
|
98
98
|
name: "Client",
|
|
99
99
|
get children() {
|
|
100
100
|
return _$createComponent(csharp.ClassMethod, {
|
|
101
|
-
|
|
101
|
+
"public": true,
|
|
102
102
|
name: "MethodOne",
|
|
103
103
|
parameters: params,
|
|
104
104
|
returns: outputTypeRefkey
|
package/dist/test/utils.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as core from "@alloy-js/core";
|
|
2
|
+
export declare function TestNamespace(props: {
|
|
3
|
+
children: core.Children;
|
|
4
|
+
}): core.Children;
|
|
2
5
|
export declare function toSourceText(c: core.Children): string;
|
|
3
6
|
export declare function testRender(c: core.Children): core.OutputDirectory;
|
|
4
7
|
export declare function findFile(res: core.OutputDirectory, path: string): core.OutputFile;
|
package/dist/test/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../test/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAKvC,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAWrD;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAMjE;AAED,wBAAgB,QAAQ,CACtB,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,IAAI,EAAE,MAAM,GACX,IAAI,CAAC,UAAU,CA2BjB;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,IAAI,CAKN"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../test/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAKvC,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC;CACzB,GAAG,IAAI,CAAC,QAAQ,CAMhB;AACD,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAWrD;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAMjE;AAED,wBAAgB,QAAQ,CACtB,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,IAAI,EAAE,MAAM,GACX,IAAI,CAAC,UAAU,CA2BjB;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,IAAI,CAKN"}
|
package/dist/test/utils.js
CHANGED
|
@@ -3,6 +3,21 @@ import * as core from "@alloy-js/core";
|
|
|
3
3
|
import * as coretest from "@alloy-js/core/testing";
|
|
4
4
|
import { expect } from "vitest";
|
|
5
5
|
import * as csharp from "../src/index.js";
|
|
6
|
+
export function TestNamespace(props) {
|
|
7
|
+
return _$createComponent(core.Output, {
|
|
8
|
+
get namePolicy() {
|
|
9
|
+
return csharp.createCSharpNamePolicy();
|
|
10
|
+
},
|
|
11
|
+
get children() {
|
|
12
|
+
return _$createComponent(csharp.Namespace, {
|
|
13
|
+
name: "TestCode",
|
|
14
|
+
get children() {
|
|
15
|
+
return props.children;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
6
21
|
export function toSourceText(c) {
|
|
7
22
|
const res = core.render(_$createComponent(core.Output, {
|
|
8
23
|
get namePolicy() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.setup.d.ts","sourceRoot":"","sources":["../../test/vitest.setup.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@alloy-js/core/testing";
|