@alloy-js/csharp 0.6.0 → 0.8.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alloy-js/csharp",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -16,17 +16,17 @@
16
16
  "dependencies": {
17
17
  "change-case": "^5.4.4",
18
18
  "pathe": "^1.1.2",
19
- "@alloy-js/core": "~0.6.0"
19
+ "@alloy-js/core": "~0.8.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@babel/cli": "^7.24.7",
23
23
  "@babel/preset-typescript": "^7.24.7",
24
24
  "@microsoft/api-extractor": "^7.47.7",
25
- "@rollup/plugin-babel": "^6.0.4",
26
25
  "@rollup/plugin-typescript": "^11.1.6",
27
26
  "concurrently": "^8.2.2",
28
27
  "typescript": "^5.7.3",
29
28
  "vitest": "^3.0.4",
29
+ "@alloy-js/rollup-plugin": "~0.1.0",
30
30
  "@alloy-js/babel-preset": "~0.2.0"
31
31
  },
32
32
  "type": "module",
@@ -14,6 +14,7 @@ import { ParameterProps, Parameters } from "./Parameters.js";
14
14
  // properties for creating a class
15
15
  export interface ClassProps extends Omit<core.DeclarationProps, "nameKind"> {
16
16
  name: string;
17
+ refkey?: core.Refkey;
17
18
  accessModifier?: AccessModifier;
18
19
  typeParameters?: Record<string, core.Refkey>;
19
20
  }
@@ -24,9 +25,9 @@ export function Class(props: ClassProps) {
24
25
  const scope = useCSharpScope();
25
26
 
26
27
  const thisClassSymbol = scope.binder.createSymbol<CSharpOutputSymbol>({
27
- name: name,
28
+ name,
28
29
  scope,
29
- refkey: props.refkey ?? core.refkey(props.name),
30
+ refkey: props.refkey,
30
31
  });
31
32
 
32
33
  // this creates a new scope for the class definition.
@@ -165,9 +166,10 @@ export function ClassMember(props: ClassMemberProps) {
165
166
  }
166
167
 
167
168
  // properties for creating a method
168
- export interface ClassMethodProps
169
- extends Omit<core.DeclarationProps, "nameKind"> {
169
+ export interface ClassMethodProps {
170
170
  name: string;
171
+ refkey?: core.Refkey;
172
+ children?: core.Children;
171
173
  accessModifier?: AccessModifier;
172
174
  methodModifier?: MethodModifier;
173
175
  parameters?: Array<ParameterProps>;
@@ -6,8 +6,10 @@ import { createCSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
6
6
  import { Name } from "./Name.jsx";
7
7
 
8
8
  // properties for creating an enum
9
- export interface EnumProps extends Omit<core.DeclarationProps, "nameKind"> {
9
+ export interface EnumProps {
10
10
  name: string;
11
+ refkey?: core.Refkey;
12
+ children?: core.Children;
11
13
  accessModifier?: AccessModifier;
12
14
  }
13
15
 
@@ -1,4 +1,5 @@
1
1
  import * as core from "@alloy-js/core";
2
+ import { DeclarationProps } from "../components/Declaration.jsx";
2
3
  import { useNamespace } from "../components/Namespace.jsx";
3
4
  import { CSharpOutputScope } from "./scopes.js";
4
5
 
@@ -8,7 +9,7 @@ export interface CSharpOutputSymbol extends core.OutputSymbol {
8
9
  }
9
10
 
10
11
  // creates a new C# symbol
11
- export function createCSharpSymbol(props: core.DeclarationProps) {
12
+ export function createCSharpSymbol(props: DeclarationProps) {
12
13
  const scope = core.useScope() as CSharpOutputScope;
13
14
 
14
15
  const namespaceCtx = useNamespace();
package/temp/api.json CHANGED
@@ -693,29 +693,7 @@
693
693
  "excerptTokens": [
694
694
  {
695
695
  "kind": "Content",
696
- "text": "export interface ClassMethodProps extends "
697
- },
698
- {
699
- "kind": "Reference",
700
- "text": "Omit",
701
- "canonicalReference": "!Omit:type"
702
- },
703
- {
704
- "kind": "Content",
705
- "text": "<"
706
- },
707
- {
708
- "kind": "Reference",
709
- "text": "core.DeclarationProps",
710
- "canonicalReference": "@alloy-js/core!DeclarationProps:interface"
711
- },
712
- {
713
- "kind": "Content",
714
- "text": ", \"nameKind\">"
715
- },
716
- {
717
- "kind": "Content",
718
- "text": " "
696
+ "text": "export interface ClassMethodProps "
719
697
  }
720
698
  ],
721
699
  "fileUrlPath": "src/components/Class.tsx",
@@ -751,6 +729,34 @@
751
729
  "endIndex": 2
752
730
  }
753
731
  },
732
+ {
733
+ "kind": "PropertySignature",
734
+ "canonicalReference": "@alloy-js/csharp!ClassMethodProps#children:member",
735
+ "docComment": "",
736
+ "excerptTokens": [
737
+ {
738
+ "kind": "Content",
739
+ "text": "children?: "
740
+ },
741
+ {
742
+ "kind": "Reference",
743
+ "text": "core.Children",
744
+ "canonicalReference": "@alloy-js/core!Children:type"
745
+ },
746
+ {
747
+ "kind": "Content",
748
+ "text": ";"
749
+ }
750
+ ],
751
+ "isReadonly": false,
752
+ "isOptional": true,
753
+ "releaseTag": "Public",
754
+ "name": "children",
755
+ "propertyTypeTokenRange": {
756
+ "startIndex": 1,
757
+ "endIndex": 2
758
+ }
759
+ },
754
760
  {
755
761
  "kind": "PropertySignature",
756
762
  "canonicalReference": "@alloy-js/csharp!ClassMethodProps#methodModifier:member",
@@ -847,6 +853,34 @@
847
853
  "endIndex": 5
848
854
  }
849
855
  },
856
+ {
857
+ "kind": "PropertySignature",
858
+ "canonicalReference": "@alloy-js/csharp!ClassMethodProps#refkey:member",
859
+ "docComment": "",
860
+ "excerptTokens": [
861
+ {
862
+ "kind": "Content",
863
+ "text": "refkey?: "
864
+ },
865
+ {
866
+ "kind": "Reference",
867
+ "text": "core.Refkey",
868
+ "canonicalReference": "@alloy-js/core!Refkey:type"
869
+ },
870
+ {
871
+ "kind": "Content",
872
+ "text": ";"
873
+ }
874
+ ],
875
+ "isReadonly": false,
876
+ "isOptional": true,
877
+ "releaseTag": "Public",
878
+ "name": "refkey",
879
+ "propertyTypeTokenRange": {
880
+ "startIndex": 1,
881
+ "endIndex": 2
882
+ }
883
+ },
850
884
  {
851
885
  "kind": "PropertySignature",
852
886
  "canonicalReference": "@alloy-js/csharp!ClassMethodProps#returns:member",
@@ -876,12 +910,7 @@
876
910
  }
877
911
  }
878
912
  ],
879
- "extendsTokenRanges": [
880
- {
881
- "startIndex": 1,
882
- "endIndex": 5
883
- }
884
- ]
913
+ "extendsTokenRanges": []
885
914
  },
886
915
  {
887
916
  "kind": "Interface",
@@ -904,7 +933,7 @@
904
933
  {
905
934
  "kind": "Reference",
906
935
  "text": "core.DeclarationProps",
907
- "canonicalReference": "@alloy-js/core!DeclarationProps:interface"
936
+ "canonicalReference": "@alloy-js/core!DeclarationProps:type"
908
937
  },
909
938
  {
910
939
  "kind": "Content",
@@ -975,6 +1004,34 @@
975
1004
  "endIndex": 2
976
1005
  }
977
1006
  },
1007
+ {
1008
+ "kind": "PropertySignature",
1009
+ "canonicalReference": "@alloy-js/csharp!ClassProps#refkey:member",
1010
+ "docComment": "",
1011
+ "excerptTokens": [
1012
+ {
1013
+ "kind": "Content",
1014
+ "text": "refkey?: "
1015
+ },
1016
+ {
1017
+ "kind": "Reference",
1018
+ "text": "core.Refkey",
1019
+ "canonicalReference": "@alloy-js/core!Refkey:type"
1020
+ },
1021
+ {
1022
+ "kind": "Content",
1023
+ "text": ";"
1024
+ }
1025
+ ],
1026
+ "isReadonly": false,
1027
+ "isOptional": true,
1028
+ "releaseTag": "Public",
1029
+ "name": "refkey",
1030
+ "propertyTypeTokenRange": {
1031
+ "startIndex": 1,
1032
+ "endIndex": 2
1033
+ }
1034
+ },
978
1035
  {
979
1036
  "kind": "PropertySignature",
980
1037
  "canonicalReference": "@alloy-js/csharp!ClassProps#typeParameters:member",
@@ -1259,8 +1316,8 @@
1259
1316
  },
1260
1317
  {
1261
1318
  "kind": "Reference",
1262
- "text": "core.DeclarationProps",
1263
- "canonicalReference": "@alloy-js/core!DeclarationProps:interface"
1319
+ "text": "DeclarationProps",
1320
+ "canonicalReference": "@alloy-js/csharp!DeclarationProps:interface"
1264
1321
  },
1265
1322
  {
1266
1323
  "kind": "Content",
@@ -1939,29 +1996,7 @@
1939
1996
  "excerptTokens": [
1940
1997
  {
1941
1998
  "kind": "Content",
1942
- "text": "export interface EnumProps extends "
1943
- },
1944
- {
1945
- "kind": "Reference",
1946
- "text": "Omit",
1947
- "canonicalReference": "!Omit:type"
1948
- },
1949
- {
1950
- "kind": "Content",
1951
- "text": "<"
1952
- },
1953
- {
1954
- "kind": "Reference",
1955
- "text": "core.DeclarationProps",
1956
- "canonicalReference": "@alloy-js/core!DeclarationProps:interface"
1957
- },
1958
- {
1959
- "kind": "Content",
1960
- "text": ", \"nameKind\">"
1961
- },
1962
- {
1963
- "kind": "Content",
1964
- "text": " "
1999
+ "text": "export interface EnumProps "
1965
2000
  }
1966
2001
  ],
1967
2002
  "fileUrlPath": "src/components/Enum.tsx",
@@ -1997,6 +2032,34 @@
1997
2032
  "endIndex": 2
1998
2033
  }
1999
2034
  },
2035
+ {
2036
+ "kind": "PropertySignature",
2037
+ "canonicalReference": "@alloy-js/csharp!EnumProps#children:member",
2038
+ "docComment": "",
2039
+ "excerptTokens": [
2040
+ {
2041
+ "kind": "Content",
2042
+ "text": "children?: "
2043
+ },
2044
+ {
2045
+ "kind": "Reference",
2046
+ "text": "core.Children",
2047
+ "canonicalReference": "@alloy-js/core!Children:type"
2048
+ },
2049
+ {
2050
+ "kind": "Content",
2051
+ "text": ";"
2052
+ }
2053
+ ],
2054
+ "isReadonly": false,
2055
+ "isOptional": true,
2056
+ "releaseTag": "Public",
2057
+ "name": "children",
2058
+ "propertyTypeTokenRange": {
2059
+ "startIndex": 1,
2060
+ "endIndex": 2
2061
+ }
2062
+ },
2000
2063
  {
2001
2064
  "kind": "PropertySignature",
2002
2065
  "canonicalReference": "@alloy-js/csharp!EnumProps#name:member",
@@ -2023,14 +2086,37 @@
2023
2086
  "startIndex": 1,
2024
2087
  "endIndex": 2
2025
2088
  }
2026
- }
2027
- ],
2028
- "extendsTokenRanges": [
2089
+ },
2029
2090
  {
2030
- "startIndex": 1,
2031
- "endIndex": 5
2091
+ "kind": "PropertySignature",
2092
+ "canonicalReference": "@alloy-js/csharp!EnumProps#refkey:member",
2093
+ "docComment": "",
2094
+ "excerptTokens": [
2095
+ {
2096
+ "kind": "Content",
2097
+ "text": "refkey?: "
2098
+ },
2099
+ {
2100
+ "kind": "Reference",
2101
+ "text": "core.Refkey",
2102
+ "canonicalReference": "@alloy-js/core!Refkey:type"
2103
+ },
2104
+ {
2105
+ "kind": "Content",
2106
+ "text": ";"
2107
+ }
2108
+ ],
2109
+ "isReadonly": false,
2110
+ "isOptional": true,
2111
+ "releaseTag": "Public",
2112
+ "name": "refkey",
2113
+ "propertyTypeTokenRange": {
2114
+ "startIndex": 1,
2115
+ "endIndex": 2
2116
+ }
2032
2117
  }
2033
- ]
2118
+ ],
2119
+ "extendsTokenRanges": []
2034
2120
  },
2035
2121
  {
2036
2122
  "kind": "Function",
package/vitest.config.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { babel } from "@rollup/plugin-babel";
1
+ import alloyPlugin from "@alloy-js/rollup-plugin";
2
2
  import { defineConfig } from "vitest/config";
3
3
 
4
4
  export default defineConfig({
@@ -6,13 +6,5 @@ export default defineConfig({
6
6
  jsx: "preserve",
7
7
  sourcemap: "both",
8
8
  },
9
- plugins: [
10
- babel({
11
- inputSourceMap: true as any,
12
- sourceMaps: "both",
13
- babelHelpers: "bundled",
14
- extensions: [".ts", ".tsx"],
15
- presets: ["@babel/preset-typescript", "@alloy-js/babel-preset"],
16
- }),
17
- ],
9
+ plugins: [alloyPlugin()],
18
10
  });