@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
package/tsdoc-metadata.json
CHANGED
package/vitest.config.ts
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import { AccessModifier, MethodModifier } from "../modifiers.js";
|
|
3
|
-
import { ParameterProps } from "./Parameters.js";
|
|
4
|
-
export interface ClassProps extends Omit<core.DeclarationProps, "nameKind"> {
|
|
5
|
-
name: string;
|
|
6
|
-
refkey?: core.Refkey;
|
|
7
|
-
accessModifier?: AccessModifier;
|
|
8
|
-
typeParameters?: Record<string, core.Refkey>;
|
|
9
|
-
}
|
|
10
|
-
export declare function Class(props: ClassProps): core.Children;
|
|
11
|
-
export interface ClassConstructorProps {
|
|
12
|
-
accessModifier?: AccessModifier;
|
|
13
|
-
parameters?: Array<ParameterProps>;
|
|
14
|
-
refkey?: core.Refkey;
|
|
15
|
-
symbol?: core.OutputSymbol;
|
|
16
|
-
children?: core.Children;
|
|
17
|
-
}
|
|
18
|
-
export declare function ClassConstructor(props: ClassConstructorProps): core.Children;
|
|
19
|
-
export interface ClassMemberProps {
|
|
20
|
-
name: string;
|
|
21
|
-
type: core.Children;
|
|
22
|
-
accessModifier?: AccessModifier;
|
|
23
|
-
refkey?: core.Refkey;
|
|
24
|
-
}
|
|
25
|
-
export declare function ClassMember(props: ClassMemberProps): core.Children;
|
|
26
|
-
export interface ClassMethodProps {
|
|
27
|
-
name: string;
|
|
28
|
-
refkey?: core.Refkey;
|
|
29
|
-
children?: core.Children;
|
|
30
|
-
accessModifier?: AccessModifier;
|
|
31
|
-
methodModifier?: MethodModifier;
|
|
32
|
-
parameters?: Array<ParameterProps>;
|
|
33
|
-
returns?: core.Children;
|
|
34
|
-
}
|
|
35
|
-
export declare function ClassMethod(props: ClassMethodProps): core.Children;
|
|
36
|
-
//# sourceMappingURL=Class.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Class.d.ts","sourceRoot":"","sources":["../../../src/components/Class.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EACL,cAAc,EAGd,cAAc,EACf,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,cAAc,EAAc,MAAM,iBAAiB,CAAC;AAG7D,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;CAC9C;AAGD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,iBA2DtC;AAED,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC;IAC3B,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAGD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,iBAqC5D;AAGD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;CACtB;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,iBAyBlD;AAGD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACzB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CACzB;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,iBAsClD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import { AccessModifier } from "../modifiers.js";
|
|
3
|
-
export interface EnumProps {
|
|
4
|
-
name: string;
|
|
5
|
-
refkey?: core.Refkey;
|
|
6
|
-
children?: core.Children;
|
|
7
|
-
accessModifier?: AccessModifier;
|
|
8
|
-
}
|
|
9
|
-
export declare function Enum(props: EnumProps): core.Children;
|
|
10
|
-
export interface EnumMemberProps {
|
|
11
|
-
name: string;
|
|
12
|
-
refkey?: core.Refkey;
|
|
13
|
-
}
|
|
14
|
-
export declare function EnumMember(props: EnumMemberProps): core.Children;
|
|
15
|
-
//# sourceMappingURL=Enum.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Enum.d.ts","sourceRoot":"","sources":["../../../src/components/Enum.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAC;AAOpE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;IACzB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAGD,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,iBAgCpC;AAGD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;CACtB;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,iBAoBhD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"class.test.d.ts","sourceRoot":"","sources":["../../test/class.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projectdirectory.test.d.ts","sourceRoot":"","sources":["../../test/projectdirectory.test.tsx"],"names":[],"mappings":""}
|
package/src/components/Enum.tsx
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as core from "@alloy-js/core";
|
|
2
|
-
import { AccessModifier, getAccessModifier } from "../modifiers.js";
|
|
3
|
-
import { useCSharpNamePolicy } from "../name-policy.js";
|
|
4
|
-
import { CSharpOutputSymbol } from "../symbols/csharp-output-symbol.js";
|
|
5
|
-
import { createCSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
|
|
6
|
-
import { Name } from "./Name.jsx";
|
|
7
|
-
|
|
8
|
-
// properties for creating an enum
|
|
9
|
-
export interface EnumProps {
|
|
10
|
-
name: string;
|
|
11
|
-
refkey?: core.Refkey;
|
|
12
|
-
children?: core.Children;
|
|
13
|
-
accessModifier?: AccessModifier;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// a C# enum declaration
|
|
17
|
-
export function Enum(props: EnumProps) {
|
|
18
|
-
const name = useCSharpNamePolicy().getName(props.name!, "enum");
|
|
19
|
-
const scope = useCSharpScope();
|
|
20
|
-
|
|
21
|
-
const thisEnumSymbol = scope.binder.createSymbol<CSharpOutputSymbol>({
|
|
22
|
-
name: name,
|
|
23
|
-
scope,
|
|
24
|
-
refkey: props.refkey ?? core.refkey(props.name),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// this creates a new scope for the enum definition.
|
|
28
|
-
// members will automatically "inherit" this scope so
|
|
29
|
-
// that refkeys to them will produce the fully-qualified
|
|
30
|
-
// name e.g. Foo.Bar.
|
|
31
|
-
const thisEnumScope = createCSharpMemberScope(
|
|
32
|
-
scope.binder,
|
|
33
|
-
scope,
|
|
34
|
-
thisEnumSymbol,
|
|
35
|
-
"enum-decl",
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<core.Declaration symbol={thisEnumSymbol}>
|
|
40
|
-
{getAccessModifier(props.accessModifier)}enum <Name />
|
|
41
|
-
{!props.children && ";"}
|
|
42
|
-
{props.children && (
|
|
43
|
-
<core.Scope value={thisEnumScope}>
|
|
44
|
-
<core.Block newline>{props.children}</core.Block>
|
|
45
|
-
</core.Scope>
|
|
46
|
-
)}
|
|
47
|
-
</core.Declaration>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// properties for creating a C# enum member
|
|
52
|
-
export interface EnumMemberProps {
|
|
53
|
-
name: string;
|
|
54
|
-
refkey?: core.Refkey;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// a member within a C# enum
|
|
58
|
-
export function EnumMember(props: EnumMemberProps) {
|
|
59
|
-
const scope = useCSharpScope();
|
|
60
|
-
if (scope.kind === "member" && scope.name !== "enum-decl") {
|
|
61
|
-
throw new Error(
|
|
62
|
-
"can't define an enum member outside of an enum-decl scope",
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const name = useCSharpNamePolicy().getName(props.name, "enum-member");
|
|
67
|
-
const thisEnumValueSymbol = scope.binder.createSymbol<CSharpOutputSymbol>({
|
|
68
|
-
name: name,
|
|
69
|
-
scope,
|
|
70
|
-
refkey: props.refkey ?? core.refkey(props.name),
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<core.Declaration symbol={thisEnumValueSymbol}>
|
|
75
|
-
<Name />
|
|
76
|
-
</core.Declaration>
|
|
77
|
-
);
|
|
78
|
-
}
|