@alloy-js/csharp 0.21.0-dev.0 → 0.21.0-dev.2
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/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.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/index.d.ts +1 -1
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -1
- 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/namespace.d.ts +3 -1
- package/dist/src/components/namespace.d.ts.map +1 -1
- package/dist/src/components/namespace.js +3 -1
- package/dist/src/components/namespace.js.map +1 -1
- package/dist/src/components/namespace.ref.test.js +41 -9
- package/dist/src/components/namespace.ref.test.js.map +1 -1
- package/dist/src/components/namespace.test.js +14 -0
- package/dist/src/components/namespace.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.js +2 -2
- package/dist/src/components/source-file/source-file.js.map +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 +2 -2
- package/dist/src/components/var/declaration.d.ts.map +1 -1
- 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/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 +6 -4
- package/dist/src/symbols/factories.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/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- 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/index.ts +1 -1
- 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/namespace.ref.test.tsx +33 -8
- package/src/components/namespace.test.tsx +13 -0
- package/src/components/namespace.tsx +6 -3
- package/src/components/record/declaration.test.tsx +11 -1
- package/src/components/record/declaration.tsx +3 -4
- package/src/components/source-file/source-file.tsx +2 -2
- 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 +2 -1
- package/src/name-policy.ts +3 -1
- package/src/symbols/factories.ts +12 -4
- package/src/symbols/namespace.ts +2 -2
- package/temp/api.json +266 -48
- 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/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/test/using.test.tsx +0 -118
- /package/dist/{test → src/components/source-file}/using.test.d.ts +0 -0
package/test/using.test.tsx
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import * as coretest from "@alloy-js/core/testing";
|
|
3
|
-
import { expect, it } from "vitest";
|
|
4
|
-
import * as csharp from "../src/index.js";
|
|
5
|
-
import { findFile } from "./utils.jsx";
|
|
6
|
-
|
|
7
|
-
it("uses a single namespace", () => {
|
|
8
|
-
const res = core.render(
|
|
9
|
-
<core.Output>
|
|
10
|
-
<csharp.Namespace name="TestCode">
|
|
11
|
-
<csharp.SourceFile path="Test1.cs" using={["Foo"]} />
|
|
12
|
-
</csharp.Namespace>
|
|
13
|
-
</core.Output>,
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
expect(findFile(res, "Test1.cs").contents).toBe(coretest.d`
|
|
17
|
-
using Foo;
|
|
18
|
-
|
|
19
|
-
namespace TestCode;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
`);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("uses multiple namespaces", () => {
|
|
26
|
-
const res = core.render(
|
|
27
|
-
<core.Output>
|
|
28
|
-
<csharp.Namespace name="TestCode">
|
|
29
|
-
<csharp.SourceFile path="Test1.cs" using={["Foo", "Bar.Baz"]} />
|
|
30
|
-
</csharp.Namespace>
|
|
31
|
-
</core.Output>,
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
expect(findFile(res, "Test1.cs").contents).toBe(coretest.d`
|
|
35
|
-
using Bar.Baz;
|
|
36
|
-
using Foo;
|
|
37
|
-
|
|
38
|
-
namespace TestCode;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
`);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("adds using statement across namespaces", () => {
|
|
45
|
-
const inputTypeRefkey = core.refkey();
|
|
46
|
-
const outputTypeRefkey = core.refkey();
|
|
47
|
-
const twoValRefkey = core.refkey();
|
|
48
|
-
|
|
49
|
-
const params = [
|
|
50
|
-
{
|
|
51
|
-
name: "BodyParam",
|
|
52
|
-
type: inputTypeRefkey,
|
|
53
|
-
},
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
expect(
|
|
57
|
-
<core.Output namePolicy={csharp.createCSharpNamePolicy()}>
|
|
58
|
-
<csharp.Namespace name="Models">
|
|
59
|
-
<csharp.SourceFile path="Models.cs">
|
|
60
|
-
<csharp.ClassDeclaration
|
|
61
|
-
public
|
|
62
|
-
name="Input"
|
|
63
|
-
refkey={inputTypeRefkey}
|
|
64
|
-
/>
|
|
65
|
-
<hbr />
|
|
66
|
-
<csharp.ClassDeclaration
|
|
67
|
-
public
|
|
68
|
-
name="Output"
|
|
69
|
-
refkey={outputTypeRefkey}
|
|
70
|
-
/>
|
|
71
|
-
<hbr />
|
|
72
|
-
<csharp.EnumDeclaration public name="TestEnum">
|
|
73
|
-
<csharp.EnumMember name="One" />,<hbr />
|
|
74
|
-
<csharp.EnumMember name="Two" refkey={twoValRefkey} />
|
|
75
|
-
</csharp.EnumDeclaration>
|
|
76
|
-
</csharp.SourceFile>
|
|
77
|
-
</csharp.Namespace>
|
|
78
|
-
<csharp.Namespace name="Client">
|
|
79
|
-
<csharp.SourceFile path="Client.cs" using={["System"]}>
|
|
80
|
-
<csharp.ClassDeclaration public name="Client">
|
|
81
|
-
<csharp.Method
|
|
82
|
-
public
|
|
83
|
-
name="MethodOne"
|
|
84
|
-
parameters={params}
|
|
85
|
-
returns={outputTypeRefkey}
|
|
86
|
-
/>
|
|
87
|
-
</csharp.ClassDeclaration>
|
|
88
|
-
<hbr />
|
|
89
|
-
{twoValRefkey};
|
|
90
|
-
</csharp.SourceFile>
|
|
91
|
-
</csharp.Namespace>
|
|
92
|
-
</core.Output>,
|
|
93
|
-
).toRenderTo({
|
|
94
|
-
"Models.cs": coretest.d`
|
|
95
|
-
namespace Models;
|
|
96
|
-
|
|
97
|
-
public class Input;
|
|
98
|
-
public class Output;
|
|
99
|
-
public enum TestEnum
|
|
100
|
-
{
|
|
101
|
-
One,
|
|
102
|
-
Two
|
|
103
|
-
}
|
|
104
|
-
`,
|
|
105
|
-
"Client.cs": coretest.d`
|
|
106
|
-
using Models;
|
|
107
|
-
using System;
|
|
108
|
-
|
|
109
|
-
namespace Client;
|
|
110
|
-
|
|
111
|
-
public class Client
|
|
112
|
-
{
|
|
113
|
-
public Output MethodOne(Input bodyParam) {}
|
|
114
|
-
}
|
|
115
|
-
TestEnum.Two;
|
|
116
|
-
`,
|
|
117
|
-
});
|
|
118
|
-
});
|
|
File without changes
|