@alloy-js/csharp 0.18.0-dev.7 → 0.18.0-dev.8
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/ClassDeclaration.d.ts +2 -0
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassDeclaration.js +6 -1
- package/dist/src/components/ClassMethod.d.ts +2 -0
- package/dist/src/components/ClassMethod.d.ts.map +1 -1
- package/dist/src/components/ClassMethod.js +6 -1
- package/dist/src/components/doc/comment.d.ts +69 -0
- package/dist/src/components/doc/comment.d.ts.map +1 -0
- package/dist/src/components/doc/comment.js +71 -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 +338 -0
- package/dist/src/components/interface/declaration.d.ts +2 -0
- package/dist/src/components/interface/declaration.d.ts.map +1 -1
- package/dist/src/components/interface/declaration.js +6 -1
- package/dist/src/components/interface/declaration.test.js +13 -0
- package/dist/src/components/interface/method.d.ts +2 -0
- package/dist/src/components/interface/method.d.ts.map +1 -1
- package/dist/src/components/interface/method.js +6 -1
- package/dist/src/components/interface/method.test.js +21 -0
- package/dist/src/components/interface/property.d.ts +2 -0
- package/dist/src/components/interface/property.d.ts.map +1 -1
- package/dist/src/components/interface/property.js +7 -2
- package/dist/src/components/interface/property.test.js +24 -0
- package/dist/test/class-method.test.js +21 -0
- package/dist/test/class.test.js +13 -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 +2 -2
- package/src/components/ClassDeclaration.tsx +4 -0
- package/src/components/ClassMethod.tsx +5 -0
- package/src/components/doc/comment.test.tsx +336 -0
- package/src/components/doc/comment.tsx +122 -0
- package/src/components/interface/declaration.test.tsx +11 -0
- package/src/components/interface/declaration.tsx +5 -0
- package/src/components/interface/method.test.tsx +16 -0
- package/src/components/interface/method.tsx +5 -0
- package/src/components/interface/property.test.tsx +22 -0
- package/src/components/interface/property.tsx +5 -0
- package/temp/api.json +112 -0
- package/test/class-method.test.tsx +16 -0
- package/test/class.test.tsx +11 -0
- package/test/vitest.setup.ts +1 -0
- package/vitest.config.ts +3 -0
|
@@ -107,4 +107,25 @@ it("defines params and return type", () => {
|
|
|
107
107
|
public string MethodOne(int intParam, string stringParam);
|
|
108
108
|
}
|
|
109
109
|
`);
|
|
110
|
+
});
|
|
111
|
+
it("specify doc comment", () => {
|
|
112
|
+
expect(_$createComponent(TestNamespace, {
|
|
113
|
+
get children() {
|
|
114
|
+
return _$createComponent(InterfaceDeclaration, {
|
|
115
|
+
name: "Test",
|
|
116
|
+
get children() {
|
|
117
|
+
return _$createComponent(InterfaceMethod, {
|
|
118
|
+
name: "Method",
|
|
119
|
+
doc: "This is a test"
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
})).toRenderTo(`
|
|
125
|
+
interface Test
|
|
126
|
+
{
|
|
127
|
+
/// This is a test
|
|
128
|
+
void Method();
|
|
129
|
+
}
|
|
130
|
+
`);
|
|
110
131
|
});
|
|
@@ -14,6 +14,8 @@ export interface InterfacePropertyProps extends AccessModifiers, InterfaceProper
|
|
|
14
14
|
get?: boolean;
|
|
15
15
|
/** If property should have a setter */
|
|
16
16
|
set?: boolean;
|
|
17
|
+
/** Doc comment */
|
|
18
|
+
doc?: Children;
|
|
17
19
|
}
|
|
18
20
|
export declare function InterfaceProperty(props: InterfacePropertyProps): Children;
|
|
19
21
|
//# sourceMappingURL=property.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../../../src/components/interface/property.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAIR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../../../src/components/interface/property.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAIR,MAAM,EAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAM5B,yCAAyC;AACzC,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,8CAE5B,CAAC;AAGH,MAAM,WAAW,sBACf,SAAQ,eAAe,EACrB,0BAA0B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,oBAAoB;IACpB,IAAI,EAAE,QAAQ,CAAC;IAEf,uCAAuC;IACvC,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,uCAAuC;IACvC,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,kBAAkB;IAClB,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB;AAGD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,YAuC9D"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createComponent as _$createComponent, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { Block, List, MemberDeclaration, refkey, Scope } from "@alloy-js/core";
|
|
3
3
|
import { computeModifiersPrefix, getAccessModifier, makeModifiers } from "../../modifiers.js";
|
|
4
4
|
import { useCSharpNamePolicy } from "../../name-policy.js";
|
|
5
5
|
import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
|
|
6
6
|
import { CSharpMemberScope, useCSharpScope } from "../../symbols/scopes.js";
|
|
7
|
+
import { DocWhen } from "../doc/comment.js";
|
|
7
8
|
|
|
8
9
|
/** Method modifiers. Can only be one. */
|
|
9
10
|
|
|
@@ -35,7 +36,11 @@ export function InterfaceProperty(props) {
|
|
|
35
36
|
return _$createComponent(Scope, {
|
|
36
37
|
value: propertyScope,
|
|
37
38
|
get children() {
|
|
38
|
-
return [
|
|
39
|
+
return [_$createComponent(DocWhen, {
|
|
40
|
+
get doc() {
|
|
41
|
+
return props.doc;
|
|
42
|
+
}
|
|
43
|
+
}), modifiers, _$memo(() => props.type), " ", name, " ", _$createComponent(Block, {
|
|
39
44
|
newline: true,
|
|
40
45
|
inline: true,
|
|
41
46
|
get children() {
|
|
@@ -138,4 +138,28 @@ it("has getter and setter", () => {
|
|
|
138
138
|
string TestProp { get; set; }
|
|
139
139
|
}
|
|
140
140
|
`);
|
|
141
|
+
});
|
|
142
|
+
it("specify doc comment", () => {
|
|
143
|
+
expect(_$createComponent(TestNamespace, {
|
|
144
|
+
get children() {
|
|
145
|
+
return _$createComponent(InterfaceDeclaration, {
|
|
146
|
+
name: "Test",
|
|
147
|
+
get children() {
|
|
148
|
+
return _$createComponent(InterfaceProperty, {
|
|
149
|
+
name: "Method",
|
|
150
|
+
type: "string",
|
|
151
|
+
get: true,
|
|
152
|
+
set: true,
|
|
153
|
+
doc: "This is a test"
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
})).toRenderTo(`
|
|
159
|
+
interface Test
|
|
160
|
+
{
|
|
161
|
+
/// This is a test
|
|
162
|
+
string Method { get; set; }
|
|
163
|
+
}
|
|
164
|
+
`);
|
|
141
165
|
});
|
|
@@ -137,4 +137,25 @@ it("defines params and return type", () => {
|
|
|
137
137
|
public string MethodOne(int intParam, string stringParam) {}
|
|
138
138
|
}
|
|
139
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
|
+
`);
|
|
140
161
|
});
|
package/dist/test/class.test.js
CHANGED
|
@@ -337,4 +337,17 @@ it("declares class with constructor params and assigns values to fields", () =>
|
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
`);
|
|
340
|
+
});
|
|
341
|
+
it("specify doc comment", () => {
|
|
342
|
+
expect(_$createComponent(utils.TestNamespace, {
|
|
343
|
+
get children() {
|
|
344
|
+
return _$createComponent(ClassDeclaration, {
|
|
345
|
+
name: "Test",
|
|
346
|
+
doc: "This is a test"
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
})).toRenderTo(`
|
|
350
|
+
/// This is a test
|
|
351
|
+
class Test;
|
|
352
|
+
`);
|
|
340
353
|
});
|
|
@@ -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";
|