@alloy-js/csharp 0.18.0-dev.4 → 0.18.0-dev.6
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 +53 -0
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -0
- package/dist/src/components/{Class.js → ClassDeclaration.js} +28 -4
- 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} +21 -2
- package/dist/src/components/index.d.ts +2 -2
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +2 -2
- 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 +3 -2
- package/dist/src/modifiers.d.ts.map +1 -1
- package/dist/src/modifiers.js +7 -6
- package/dist/test/class-method.test.js +2 -2
- package/dist/test/class.test.js +62 -20
- package/dist/test/enum.test.js +6 -6
- package/dist/test/namespace.test.js +4 -4
- package/dist/test/projectdirectory.test.js +4 -4
- package/dist/test/sourcefile.test.js +2 -2
- package/dist/test/using.test.js +4 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/{Class.tsx → ClassDeclaration.tsx} +49 -7
- package/src/components/{Enum.tsx → EnumDeclaration.tsx} +22 -3
- package/src/components/index.ts +2 -2
- package/src/components/stc/index.ts +2 -2
- package/src/modifiers.ts +22 -21
- package/temp/api.json +428 -234
- package/test/class-method.test.tsx +3 -3
- package/test/class.test.tsx +70 -26
- package/test/enum.test.tsx +13 -11
- package/test/namespace.test.tsx +4 -4
- package/test/projectdirectory.test.tsx +4 -4
- package/test/sourcefile.test.tsx +2 -2
- package/test/using.test.tsx +14 -6
- package/dist/src/components/Class.d.ts +0 -23
- package/dist/src/components/Class.d.ts.map +0 -1
- package/dist/src/components/Enum.d.ts +0 -14
- package/dist/src/components/Enum.d.ts.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as core from "@alloy-js/core";
|
|
2
2
|
import * as base from "../index.js";
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const ClassDeclaration = core.stc(base.ClassDeclaration);
|
|
5
5
|
export const ClassConstructor = core.stc(base.ClassConstructor);
|
|
6
6
|
export const ClassMember = core.stc(base.ClassMember);
|
|
7
7
|
export const ClassMethod = core.stc(base.ClassMethod);
|
|
8
|
-
export const
|
|
8
|
+
export const EnumDeclaration = core.stc(base.EnumDeclaration);
|
|
9
9
|
export const EnumMember = core.stc(base.EnumMember);
|
|
10
10
|
export const Parameter = core.stc(base.Parameter);
|
|
11
11
|
export const Parameters = core.stc(base.Parameters);
|
package/src/modifiers.ts
CHANGED
|
@@ -10,17 +10,13 @@ export interface AccessModifiers {
|
|
|
10
10
|
readonly file?: boolean;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
]
|
|
21
|
-
.filter((x) => x)
|
|
22
|
-
.join(" ");
|
|
23
|
-
}
|
|
13
|
+
export const getAccessModifier = makeModifiers<AccessModifiers>([
|
|
14
|
+
"public",
|
|
15
|
+
"protected",
|
|
16
|
+
"private",
|
|
17
|
+
"internal",
|
|
18
|
+
"file",
|
|
19
|
+
]);
|
|
24
20
|
|
|
25
21
|
/** Method modifiers. Can only be one. */
|
|
26
22
|
export interface MethodModifiers {
|
|
@@ -30,16 +26,12 @@ export interface MethodModifiers {
|
|
|
30
26
|
readonly virtual?: boolean;
|
|
31
27
|
}
|
|
32
28
|
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
]
|
|
40
|
-
.filter((x) => x)
|
|
41
|
-
.join(" ");
|
|
42
|
-
}
|
|
29
|
+
export const getMethodModifier = makeModifiers<MethodModifiers>([
|
|
30
|
+
"abstract",
|
|
31
|
+
"sealed",
|
|
32
|
+
"static",
|
|
33
|
+
"virtual",
|
|
34
|
+
]);
|
|
43
35
|
|
|
44
36
|
export function getAsyncModifier(async?: boolean): string {
|
|
45
37
|
return async ? "async" : "";
|
|
@@ -52,3 +44,12 @@ export function computeModifiersPrefix(
|
|
|
52
44
|
const resolved = modifiers.filter((x) => x);
|
|
53
45
|
return resolved.length > 0 ? resolved.join(" ") + " " : "";
|
|
54
46
|
}
|
|
47
|
+
|
|
48
|
+
export function makeModifiers<T>(obj: Array<keyof T>) {
|
|
49
|
+
return (data: T) => {
|
|
50
|
+
return obj
|
|
51
|
+
.map((key) => (data[key] ? key : undefined))
|
|
52
|
+
.filter((x) => x)
|
|
53
|
+
.join(" ");
|
|
54
|
+
};
|
|
55
|
+
}
|