@alloy-js/csharp 0.1.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/LICENSE.txt +7 -0
- package/api-extractor.json +4 -0
- package/babel.config.cjs +4 -0
- package/dist/src/components/Class.d.ts +33 -0
- package/dist/src/components/Class.d.ts.map +1 -0
- package/dist/src/components/Class.js +170 -0
- package/dist/src/components/Class.js.map +1 -0
- package/dist/src/components/Declaration.d.ts +8 -0
- package/dist/src/components/Declaration.d.ts.map +1 -0
- package/dist/src/components/Declaration.js +18 -0
- package/dist/src/components/Declaration.js.map +1 -0
- package/dist/src/components/Enum.d.ts +13 -0
- package/dist/src/components/Enum.d.ts.map +1 -0
- package/dist/src/components/Enum.js +65 -0
- package/dist/src/components/Enum.js.map +1 -0
- package/dist/src/components/Name.d.ts +2 -0
- package/dist/src/components/Name.d.ts.map +1 -0
- package/dist/src/components/Name.js +12 -0
- package/dist/src/components/Name.js.map +1 -0
- package/dist/src/components/Namespace.d.ts +11 -0
- package/dist/src/components/Namespace.d.ts.map +1 -0
- package/dist/src/components/Namespace.js +35 -0
- package/dist/src/components/Namespace.js.map +1 -0
- package/dist/src/components/Parameters.d.ts +13 -0
- package/dist/src/components/Parameters.d.ts.map +1 -0
- package/dist/src/components/Parameters.js +34 -0
- package/dist/src/components/Parameters.js.map +1 -0
- package/dist/src/components/ProjectDirectory.d.ts +12 -0
- package/dist/src/components/ProjectDirectory.d.ts.map +1 -0
- package/dist/src/components/ProjectDirectory.js +48 -0
- package/dist/src/components/ProjectDirectory.js.map +1 -0
- package/dist/src/components/Reference.d.ts +6 -0
- package/dist/src/components/Reference.d.ts.map +1 -0
- package/dist/src/components/Reference.js +9 -0
- package/dist/src/components/Reference.js.map +1 -0
- package/dist/src/components/SourceFile.d.ts +12 -0
- package/dist/src/components/SourceFile.d.ts.map +1 -0
- package/dist/src/components/SourceFile.js +72 -0
- package/dist/src/components/SourceFile.js.map +1 -0
- package/dist/src/components/UsingDirective.d.ts +5 -0
- package/dist/src/components/UsingDirective.d.ts.map +1 -0
- package/dist/src/components/UsingDirective.js +13 -0
- package/dist/src/components/UsingDirective.js.map +1 -0
- package/dist/src/components/index.d.ts +11 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/index.js +11 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/stc/index.d.ts +43 -0
- package/dist/src/components/stc/index.d.ts.map +1 -0
- package/dist/src/components/stc/index.js +13 -0
- package/dist/src/components/stc/index.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/modifiers.d.ts +5 -0
- package/dist/src/modifiers.d.ts.map +1 -0
- package/dist/src/modifiers.js +35 -0
- package/dist/src/modifiers.js.map +1 -0
- package/dist/src/name-policy.d.ts +5 -0
- package/dist/src/name-policy.d.ts.map +1 -0
- package/dist/src/name-policy.js +30 -0
- package/dist/src/name-policy.js.map +1 -0
- package/dist/src/symbols/csharp-output-symbol.d.ts +7 -0
- package/dist/src/symbols/csharp-output-symbol.d.ts.map +1 -0
- package/dist/src/symbols/csharp-output-symbol.js +20 -0
- package/dist/src/symbols/csharp-output-symbol.js.map +1 -0
- package/dist/src/symbols/index.d.ts +4 -0
- package/dist/src/symbols/index.d.ts.map +1 -0
- package/dist/src/symbols/index.js +4 -0
- package/dist/src/symbols/index.js.map +1 -0
- package/dist/src/symbols/reference.d.ts +3 -0
- package/dist/src/symbols/reference.d.ts.map +1 -0
- package/dist/src/symbols/reference.js +55 -0
- package/dist/src/symbols/reference.js.map +1 -0
- package/dist/src/symbols/scopes.d.ts +16 -0
- package/dist/src/symbols/scopes.d.ts.map +1 -0
- package/dist/src/symbols/scopes.js +37 -0
- package/dist/src/symbols/scopes.js.map +1 -0
- package/dist/test/class.test.d.ts +2 -0
- package/dist/test/class.test.d.ts.map +1 -0
- package/dist/test/enum.test.d.ts +2 -0
- package/dist/test/enum.test.d.ts.map +1 -0
- package/dist/test/namespace.test.d.ts +2 -0
- package/dist/test/namespace.test.d.ts.map +1 -0
- package/dist/test/projectdirectory.test.d.ts +2 -0
- package/dist/test/projectdirectory.test.d.ts.map +1 -0
- package/dist/test/sourcefile.test.d.ts +2 -0
- package/dist/test/sourcefile.test.d.ts.map +1 -0
- package/dist/test/using.test.d.ts +2 -0
- package/dist/test/using.test.d.ts.map +1 -0
- package/dist/test/utils.d.ts +6 -0
- package/dist/test/utils.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +51 -0
- package/src/components/Class.tsx +210 -0
- package/src/components/Declaration.tsx +17 -0
- package/src/components/Enum.tsx +74 -0
- package/src/components/Name.tsx +11 -0
- package/src/components/Namespace.tsx +39 -0
- package/src/components/Parameters.tsx +52 -0
- package/src/components/ProjectDirectory.tsx +54 -0
- package/src/components/Reference.tsx +13 -0
- package/src/components/SourceFile.tsx +69 -0
- package/src/components/UsingDirective.tsx +19 -0
- package/src/components/index.ts +10 -0
- package/src/components/stc/index.ts +13 -0
- package/src/index.ts +4 -0
- package/src/modifiers.ts +45 -0
- package/src/name-policy.ts +41 -0
- package/src/symbols/csharp-output-symbol.ts +26 -0
- package/src/symbols/index.ts +3 -0
- package/src/symbols/reference.ts +65 -0
- package/src/symbols/scopes.ts +60 -0
- package/temp/api.json +3474 -0
- package/test/class.test.tsx +249 -0
- package/test/enum.test.tsx +147 -0
- package/test/namespace.test.tsx +59 -0
- package/test/projectdirectory.test.tsx +106 -0
- package/test/sourcefile.test.tsx +46 -0
- package/test/using.test.tsx +97 -0
- package/test/utils.tsx +69 -0
- package/tsconfig.json +11 -0
- package/tsdoc-metadata.json +11 -0
- package/vitest.config.ts +18 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2024 Microsoft
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/babel.config.cjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
accessModifier?: AccessModifier;
|
|
7
|
+
typeParameters?: Record<string, core.Refkey>;
|
|
8
|
+
}
|
|
9
|
+
export declare function Class(props: ClassProps): any;
|
|
10
|
+
export interface ClassConstructorProps {
|
|
11
|
+
accessModifier?: AccessModifier;
|
|
12
|
+
parameters?: Array<ParameterProps>;
|
|
13
|
+
refkey?: core.Refkey;
|
|
14
|
+
symbol?: core.OutputSymbol;
|
|
15
|
+
children?: core.Children;
|
|
16
|
+
}
|
|
17
|
+
export declare function ClassConstructor(props: ClassConstructorProps): any;
|
|
18
|
+
export interface ClassMemberProps {
|
|
19
|
+
name: string;
|
|
20
|
+
type: core.Children;
|
|
21
|
+
accessModifier?: AccessModifier;
|
|
22
|
+
refkey?: core.Refkey;
|
|
23
|
+
}
|
|
24
|
+
export declare function ClassMember(props: ClassMemberProps): any;
|
|
25
|
+
export interface ClassMethodProps extends Omit<core.DeclarationProps, "nameKind"> {
|
|
26
|
+
name: string;
|
|
27
|
+
accessModifier?: AccessModifier;
|
|
28
|
+
methodModifier?: MethodModifier;
|
|
29
|
+
parameters?: Array<ParameterProps>;
|
|
30
|
+
returns?: core.Children;
|
|
31
|
+
}
|
|
32
|
+
export declare function ClassMethod(props: ClassMethodProps): any;
|
|
33
|
+
//# sourceMappingURL=Class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,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,OAkDtC;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,OAyC5D;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,OAsBlD;AAGD,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,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,OAwClD"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { Indent as _$Indent } from "@alloy-js/core";
|
|
2
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import * as core from "@alloy-js/core";
|
|
5
|
+
import { getAccessModifier, getMethodModifier } from "../modifiers.js";
|
|
6
|
+
import { useCSharpNamePolicy } from "../name-policy.js";
|
|
7
|
+
import { createCSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
|
|
8
|
+
import { Name } from "./Name.js";
|
|
9
|
+
import { Parameters } from "./Parameters.js";
|
|
10
|
+
|
|
11
|
+
// properties for creating a class
|
|
12
|
+
|
|
13
|
+
// a C# class declaration
|
|
14
|
+
export function Class(props) {
|
|
15
|
+
const name = useCSharpNamePolicy().getName(props.name, "class");
|
|
16
|
+
const scope = useCSharpScope();
|
|
17
|
+
const thisClassSymbol = scope.binder.createSymbol({
|
|
18
|
+
name: name,
|
|
19
|
+
scope,
|
|
20
|
+
refkey: props.refkey ?? core.refkey(props.name)
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// this creates a new scope for the class definition.
|
|
24
|
+
// members will automatically "inherit" this scope so
|
|
25
|
+
// that refkeys to them will produce the fully-qualified
|
|
26
|
+
// name e.g. Foo.Bar.
|
|
27
|
+
const thisClassScope = createCSharpMemberScope(scope.binder, scope, thisClassSymbol, "class-decl");
|
|
28
|
+
let typeParams;
|
|
29
|
+
if (props.typeParameters) {
|
|
30
|
+
const typeParamNames = new Array();
|
|
31
|
+
for (const entry of Object.entries(props.typeParameters)) {
|
|
32
|
+
typeParamNames.push(useCSharpNamePolicy().getName(entry[0], "type-parameter"));
|
|
33
|
+
// create a symbol for each type param so its
|
|
34
|
+
// refkey resolves to the type param's name
|
|
35
|
+
scope.binder.createSymbol({
|
|
36
|
+
name: entry[0],
|
|
37
|
+
scope: thisClassScope,
|
|
38
|
+
refkey: entry[1]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
typeParams = `<${typeParamNames.join(", ")}>`;
|
|
42
|
+
}
|
|
43
|
+
return _$createComponent(core.Declaration, {
|
|
44
|
+
symbol: thisClassSymbol,
|
|
45
|
+
get children() {
|
|
46
|
+
return [_$memo(() => getAccessModifier(props.accessModifier)), "class ", _$createComponent(Name, {}), typeParams, _$memo(() => !props.children && ";"), _$memo(() => _$memo(() => !!props.children)() && ["\n{", _$createComponent(_$Indent, {
|
|
47
|
+
get children() {
|
|
48
|
+
return ["\n", _$createComponent(core.Scope, {
|
|
49
|
+
value: thisClassScope,
|
|
50
|
+
get children() {
|
|
51
|
+
return props.children;
|
|
52
|
+
}
|
|
53
|
+
})];
|
|
54
|
+
}
|
|
55
|
+
}), "\n", "}"])];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
// a C# class constructor
|
|
60
|
+
export function ClassConstructor(props) {
|
|
61
|
+
const scope = useCSharpScope();
|
|
62
|
+
if (scope.kind !== "member" || scope.name !== "class-decl") {
|
|
63
|
+
throw new Error("can't define a class constructor outside of a class-decl scope");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// fetch the class name from the scope
|
|
67
|
+
const name = useCSharpNamePolicy().getName(scope.owner.name, "class-method");
|
|
68
|
+
const ctorSymbol = scope.binder.createSymbol({
|
|
69
|
+
name: name,
|
|
70
|
+
scope,
|
|
71
|
+
refkey: props.refkey ?? core.refkey(name)
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// scope for ctor declaration
|
|
75
|
+
const ctorDeclScope = createCSharpMemberScope(scope.binder, scope, ctorSymbol, "constructor-decl");
|
|
76
|
+
const accessModifier = getAccessModifier(props.accessModifier);
|
|
77
|
+
const params = props.parameters ? _$createComponent(Parameters, {
|
|
78
|
+
get parameters() {
|
|
79
|
+
return props.parameters;
|
|
80
|
+
}
|
|
81
|
+
}) : "";
|
|
82
|
+
|
|
83
|
+
// note that scope wraps the ctor decl so that the params get the correct scope
|
|
84
|
+
return _$createComponent(core.Declaration, {
|
|
85
|
+
symbol: ctorSymbol,
|
|
86
|
+
get children() {
|
|
87
|
+
return _$createComponent(core.Scope, {
|
|
88
|
+
value: ctorDeclScope,
|
|
89
|
+
get children() {
|
|
90
|
+
return [accessModifier, _$createComponent(Name, {}), "(", params, ")", _$memo(() => !props.children && " {}"), _$memo(() => _$memo(() => !!props.children)() && ["\n{", _$createComponent(_$Indent, {
|
|
91
|
+
get children() {
|
|
92
|
+
return ["\n", _$memo(() => props.children)];
|
|
93
|
+
}
|
|
94
|
+
}), "\n", "}"])];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// properties for creating a class member
|
|
102
|
+
|
|
103
|
+
// a C# class member (i.e. a field within a class like "private int count")
|
|
104
|
+
export function ClassMember(props) {
|
|
105
|
+
let nameElement = "class-member-private";
|
|
106
|
+
if (props.accessModifier === "public") {
|
|
107
|
+
nameElement = "class-member-public";
|
|
108
|
+
}
|
|
109
|
+
const name = useCSharpNamePolicy().getName(props.name, nameElement);
|
|
110
|
+
const scope = useCSharpScope();
|
|
111
|
+
if (scope.kind !== "member" || scope.name !== "class-decl") {
|
|
112
|
+
throw new Error("can't define a class member outside of a class-decl scope");
|
|
113
|
+
}
|
|
114
|
+
const memberSymbol = scope.binder.createSymbol({
|
|
115
|
+
name: name,
|
|
116
|
+
scope,
|
|
117
|
+
refkey: props.refkey ?? core.refkey(props.name)
|
|
118
|
+
});
|
|
119
|
+
return _$createComponent(core.Declaration, {
|
|
120
|
+
symbol: memberSymbol,
|
|
121
|
+
get children() {
|
|
122
|
+
return [_$memo(() => getAccessModifier(props.accessModifier)), _$memo(() => props.type), " ", _$createComponent(Name, {}), ";"];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// properties for creating a method
|
|
128
|
+
|
|
129
|
+
// a C# class method
|
|
130
|
+
export function ClassMethod(props) {
|
|
131
|
+
const name = useCSharpNamePolicy().getName(props.name, "class-method");
|
|
132
|
+
const scope = useCSharpScope();
|
|
133
|
+
if (scope.kind !== "member" || scope.name !== "class-decl") {
|
|
134
|
+
throw new Error("can't define a class method outside of a class scope");
|
|
135
|
+
}
|
|
136
|
+
const methodSymbol = scope.binder.createSymbol({
|
|
137
|
+
name: name,
|
|
138
|
+
scope,
|
|
139
|
+
refkey: props.refkey ?? core.refkey(props.name)
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// scope for method declaration
|
|
143
|
+
const methodScope = createCSharpMemberScope(scope.binder, scope, methodSymbol, "method-decl");
|
|
144
|
+
const accessModifier = getAccessModifier(props.accessModifier);
|
|
145
|
+
const methodModifier = getMethodModifier(props.methodModifier);
|
|
146
|
+
const params = props.parameters ? _$createComponent(Parameters, {
|
|
147
|
+
get parameters() {
|
|
148
|
+
return props.parameters;
|
|
149
|
+
}
|
|
150
|
+
}) : "";
|
|
151
|
+
const returns = props.returns ?? "void";
|
|
152
|
+
|
|
153
|
+
// note that scope wraps the method decl so that the params get the correct scope
|
|
154
|
+
return _$createComponent(core.Declaration, {
|
|
155
|
+
symbol: methodSymbol,
|
|
156
|
+
get children() {
|
|
157
|
+
return _$createComponent(core.Scope, {
|
|
158
|
+
value: methodScope,
|
|
159
|
+
get children() {
|
|
160
|
+
return [accessModifier, methodModifier, returns, " ", _$createComponent(Name, {}), "(", params, ")", _$memo(() => !props.children && " {}"), _$memo(() => _$memo(() => !!props.children)() && ["\n{", _$createComponent(_$Indent, {
|
|
161
|
+
get children() {
|
|
162
|
+
return ["\n", _$memo(() => props.children)];
|
|
163
|
+
}
|
|
164
|
+
}), "\n", "}"])];
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=Class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Class.js","names":["core","getAccessModifier","getMethodModifier","useCSharpNamePolicy","createCSharpMemberScope","useCSharpScope","Name","Parameters","Class","props","name","getName","scope","thisClassSymbol","binder","createSymbol","refkey","thisClassScope","typeParams","typeParameters","typeParamNames","Array","entry","Object","entries","push","join","_$createComponent","Declaration","symbol","children","_$memo","accessModifier","_$Indent","Scope","value","ClassConstructor","kind","Error","owner","ctorSymbol","ctorDeclScope","params","parameters","ClassMember","nameElement","memberSymbol","type","ClassMethod","methodSymbol","methodScope","methodModifier","returns"],"sources":["../../../src/components/Class.tsx"],"sourcesContent":[null],"mappings":";;;AAAA,OAAO,KAAKA,IAAI,MAAM,gBAAgB;AACtC,SAEEC,iBAAiB,EACjBC,iBAAiB,QAEZ,iBAAiB;AACxB,SAAyBC,mBAAmB,QAAQ,mBAAmB;AAEvE,SAASC,uBAAuB,EAAEC,cAAc,QAAQ,sBAAsB;AAC9E,SAASC,IAAI,QAAQ,WAAW;AAChC,SAAyBC,UAAU,Q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AAM,GAAGjC,KAAK,CAACkC,UAAU,GAAAhB,iBAAA,CAC5BpB,UAAU;IAAA,IAACoC,UAAUA,CAAA;MAAA,OAAElC,KAAK,CAACkC,UAAU;IAAA;EAAA,KACxC,EAAE;EACJ,MAAMS,OAAO,GAAG3C,KAAK,CAAC2C,OAAO,IAAI,MAAM;;EAEvC;EACA,OAAAzB,iBAAA,CAAQ3B,IAAI,CAAC4B,WAAW;IAACC,MAAM,EAAEoB,YAAY;IAAA,IAAAnB,SAAA;MAAA,OAAAH,iBAAA,CAC1C3B,IAAI,CAACkC,KAAK;QAACC,KAAK,EAAEe,WAAW;QAAA,IAAApB,SAAA;UAAA,QAC3BE,cAAc,EAAEmB,cAAc,EAAEC,OAAO,OAAAzB,iBAAA,CAAGrB,IAAI,YAAKoC,MAAM,OAAAX,MAAA,OAAG,CAACtB,KAAK,CAACqB,QAAQ,IAAI,KAAK,GAAAC,MAAA,OAAEA,MAAA,SAAAtB,KAAK,CAACqB,QAAQ,QAEhG,KAAK,EAAAH,iBAAA,CAAAM,QAAA;YAAA,IAAAH,SAAA;cAAA,cAAAC,MAAA,OACHtB,KAAK,CAACqB,QAAQ;YAAA;UAAA,UAChB,GAAG,CACH;QAAA;MAAA;IAAA;EAAA;AAIX","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Declaration.d.ts","sourceRoot":"","sources":["../../../src/components/Declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,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;CAC1B;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,OAKlD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import * as core from "@alloy-js/core";
|
|
4
|
+
import { createCSharpSymbol } from "../symbols/csharp-output-symbol.js";
|
|
5
|
+
|
|
6
|
+
// properties for creating a declaration
|
|
7
|
+
|
|
8
|
+
// declares a symbol in the program (class, enum, interface etc)
|
|
9
|
+
export function Declaration(props) {
|
|
10
|
+
const sym = createCSharpSymbol(props);
|
|
11
|
+
return _$createComponent(core.Declaration, {
|
|
12
|
+
symbol: sym,
|
|
13
|
+
get children() {
|
|
14
|
+
return props.children;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=Declaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Declaration.js","names":["core","createCSharpSymbol","Declaration","props","sym","_$createComponent","symbol","children"],"sources":["../../../src/components/Declaration.tsx"],"sourcesContent":[null],"mappings":";;AAAA,OAAO,KAAKA,IAAI,MAAM,gBAAgB;AACtC,SAASC,kBAAkB,QAAQ,oCAAoC;;AAEvE;;AAOA;AACA,OAAO,SAASC,WAAWA,CAACC,KAAuB,EAAE;EACnD,MAAMC,GAAG,GAAGH,kBAAkB,CAACE,KAAK,CAAC;EACrC,OAAAE,iBAAA,CAAQL,IAAI,CAACE,WAAW;IAACI,MAAM,EAAEF,GAAG;IAAA,IAAAG,SAAA;MAAA,OACjCJ,KAAK,CAACI,QAAQ;IAAA;EAAA;AAEnB","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as core from "@alloy-js/core";
|
|
2
|
+
import { AccessModifier } from "../modifiers.js";
|
|
3
|
+
export interface EnumProps extends Omit<core.DeclarationProps, "nameKind"> {
|
|
4
|
+
name: string;
|
|
5
|
+
accessModifier?: AccessModifier;
|
|
6
|
+
}
|
|
7
|
+
export declare function Enum(props: EnumProps): any;
|
|
8
|
+
export interface EnumMemberProps {
|
|
9
|
+
name: string;
|
|
10
|
+
refkey?: core.Refkey;
|
|
11
|
+
}
|
|
12
|
+
export declare function EnumMember(props: EnumMemberProps): any;
|
|
13
|
+
//# sourceMappingURL=Enum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,SAAU,SAAQ,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAGD,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,OAgCpC;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,OAkBhD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Indent as _$Indent } from "@alloy-js/core";
|
|
2
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import * as core from "@alloy-js/core";
|
|
5
|
+
import { getAccessModifier } from "../modifiers.js";
|
|
6
|
+
import { useCSharpNamePolicy } from "../name-policy.js";
|
|
7
|
+
import { createCSharpMemberScope, useCSharpScope } from "../symbols/scopes.js";
|
|
8
|
+
import { Name } from "./Name.js";
|
|
9
|
+
|
|
10
|
+
// properties for creating an enum
|
|
11
|
+
|
|
12
|
+
// a C# enum declaration
|
|
13
|
+
export function Enum(props) {
|
|
14
|
+
const name = useCSharpNamePolicy().getName(props.name, "enum");
|
|
15
|
+
const scope = useCSharpScope();
|
|
16
|
+
const thisEnumSymbol = scope.binder.createSymbol({
|
|
17
|
+
name: name,
|
|
18
|
+
scope,
|
|
19
|
+
refkey: props.refkey ?? core.refkey(props.name)
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// this creates a new scope for the enum definition.
|
|
23
|
+
// members will automatically "inherit" this scope so
|
|
24
|
+
// that refkeys to them will produce the fully-qualified
|
|
25
|
+
// name e.g. Foo.Bar.
|
|
26
|
+
const thisEnumScope = createCSharpMemberScope(scope.binder, scope, thisEnumSymbol, "enum-decl");
|
|
27
|
+
return _$createComponent(core.Declaration, {
|
|
28
|
+
symbol: thisEnumSymbol,
|
|
29
|
+
get children() {
|
|
30
|
+
return [_$memo(() => getAccessModifier(props.accessModifier)), "enum ", _$createComponent(Name, {}), _$memo(() => !props.children && ";"), _$memo(() => _$memo(() => !!props.children)() && ["\n{", _$createComponent(_$Indent, {
|
|
31
|
+
get children() {
|
|
32
|
+
return ["\n", _$createComponent(core.Scope, {
|
|
33
|
+
value: thisEnumScope,
|
|
34
|
+
get children() {
|
|
35
|
+
return props.children;
|
|
36
|
+
}
|
|
37
|
+
})];
|
|
38
|
+
}
|
|
39
|
+
}), "\n", "}"])];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// properties for creating a C# enum member
|
|
45
|
+
|
|
46
|
+
// a member within a C# enum
|
|
47
|
+
export function EnumMember(props) {
|
|
48
|
+
const scope = useCSharpScope();
|
|
49
|
+
if (scope.kind === "member" && scope.name !== "enum-decl") {
|
|
50
|
+
throw new Error("can't define an enum member outside of an enum-decl scope");
|
|
51
|
+
}
|
|
52
|
+
const name = useCSharpNamePolicy().getName(props.name, "enum-member");
|
|
53
|
+
const thisEnumValueSymbol = scope.binder.createSymbol({
|
|
54
|
+
name: name,
|
|
55
|
+
scope,
|
|
56
|
+
refkey: props.refkey ?? core.refkey(props.name)
|
|
57
|
+
});
|
|
58
|
+
return _$createComponent(core.Declaration, {
|
|
59
|
+
symbol: thisEnumValueSymbol,
|
|
60
|
+
get children() {
|
|
61
|
+
return _$createComponent(Name, {});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=Enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Enum.js","names":["core","getAccessModifier","useCSharpNamePolicy","createCSharpMemberScope","useCSharpScope","Name","Enum","props","name","getName","scope","thisEnumSymbol","binder","createSymbol","refkey","thisEnumScope","_$createComponent","Declaration","symbol","children","_$memo","accessModifier","_$Indent","Scope","value","EnumMember","kind","Error","thisEnumValueSymbol"],"sources":["../../../src/components/Enum.tsx"],"sourcesContent":[null],"mappings":";;;AAAA,OAAO,KAAKA,IAAI,MAAM,gBAAgB;AACtC,SAAyBC,iBAAiB,QAAQ,iBAAiB;AACnE,SAASC,mBAAmB,QAAQ,mBAAmB;AAEvD,SAASC,uBAAuB,EAAEC,cAAc,QAAQ,sBAAsB;AAC9E,SAASC,IAAI;;AAEb;;AAMA;AACA,OAAO,SAASC,IAAIA,CAACC,KAAgB,EAAE;EACrC,MAAMC,IAAI,GAAGN,mBAAmB,CAAC,CAAC,CAACO,OAAO,CAACF,KAAK,CAACC,IAAI,EAAG,MAAM,CAAC;EAC/D,MAAME,KAAK,GAAGN,cAAc,CAAC,CAAC;EAE9B,MAAMO,cAAc,GAAGD,KAAK,CAACE,MAAM,CAACC,YAAY,CAAqB;IACnEL,IAAI,EAAEA,IAAI;IACVE,KAAK;IACLI,MAAM,EAAEP,KAAK,CAACO,MAAM,IAAId,IAAI,CAACc,MAAM,CAACP,KAAK,CAACC,IAAI;EAChD,CAAC,CAAC;;EAEF;EACA;EACA;EACA;EACA,MAAMO,aAAa,GAAGZ,uBAAuB,CAC3CO,KAAK,CAACE,MAAM,EACZF,KAAK,EACLC,cAAc,EACd,WACF,CAAC;EAED,OAAAK,iBAAA,CAAQhB,IAAI,CAACiB,WAAW;IAACC,MAAM,E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{"version":3,"file":"Name.d.ts","sourceRoot":"","sources":["../../../src/components/Name.tsx"],"names":[],"mappings":"AAGA,wBAAgB,IAAI,QAOnB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import * as core from "@alloy-js/core";
|
|
3
|
+
|
|
4
|
+
// the name within the current declaration
|
|
5
|
+
export function Name() {
|
|
6
|
+
const declSymbol = core.useContext(core.DeclarationContext);
|
|
7
|
+
if (!declSymbol) {
|
|
8
|
+
throw new Error("missing declaration context");
|
|
9
|
+
}
|
|
10
|
+
return _$memo(() => declSymbol.name);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Name.js","names":["core","Name","declSymbol","useContext","DeclarationContext","Error","_$memo","name"],"sources":["../../../src/components/Name.tsx"],"sourcesContent":[null],"mappings":";AAAA,OAAO,KAAKA,IAAI,MAAM,gBAAgB;;AAEtC;AACA,OAAO,SAASC,IAAIA,CAAA,EAAG;EACrB,MAAMC,UAAU,GAAGF,IAAI,CAACG,UAAU,CAACH,IAAI,CAACI,kBAAkB,CAAC;EAC3D,IAAI,CAACF,UAAU,EAAE;IACf,MAAM,IAAIG,KAAK,CAAC,6BAA6B,CAAC;EAChD;EAEA,OAAAC,MAAA,OAAUJ,UAAU,CAACK,IAAI;AAC3B","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as core from "@alloy-js/core";
|
|
2
|
+
export interface NamespaceContext {
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function useNamespace(): NamespaceContext | undefined;
|
|
6
|
+
export interface NamespaceProps {
|
|
7
|
+
name: string;
|
|
8
|
+
children?: core.Children;
|
|
9
|
+
}
|
|
10
|
+
export declare function Namespace(props: NamespaceProps): any;
|
|
11
|
+
//# sourceMappingURL=Namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Namespace.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAKD,wBAAgB,YAAY,IAAI,gBAAgB,GAAG,SAAS,CAE3D;AAGD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,OAgB9C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import * as core from "@alloy-js/core";
|
|
4
|
+
import { createCSharpNamespaceScope } from "../symbols/scopes.js";
|
|
5
|
+
|
|
6
|
+
// contains the info for the current namespace
|
|
7
|
+
|
|
8
|
+
const NamespaceContext = core.createContext();
|
|
9
|
+
|
|
10
|
+
// returns the current namespace
|
|
11
|
+
export function useNamespace() {
|
|
12
|
+
return core.useContext(NamespaceContext);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// properties for creating a C# namespace
|
|
16
|
+
|
|
17
|
+
// a C# namespace. contains one or more source files
|
|
18
|
+
export function Namespace(props) {
|
|
19
|
+
const scope = createCSharpNamespaceScope(core.useBinder(), core.useScope(), props.name);
|
|
20
|
+
const namespaceCtx = {
|
|
21
|
+
name: props.name
|
|
22
|
+
};
|
|
23
|
+
return _$createComponent(NamespaceContext.Provider, {
|
|
24
|
+
value: namespaceCtx,
|
|
25
|
+
get children() {
|
|
26
|
+
return _$createComponent(core.Scope, {
|
|
27
|
+
value: scope,
|
|
28
|
+
get children() {
|
|
29
|
+
return props.children;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=Namespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Namespace.js","names":["core","createCSharpNamespaceScope","NamespaceContext","createContext","useNamespace","useContext","Namespace","props","scope","useBinder","useScope","name","namespaceCtx","_$createComponent","Provider","value","children","Scope"],"sources":["../../../src/components/Namespace.tsx"],"sourcesContent":[null],"mappings":";;AAAA,OAAO,KAAKA,IAAI,MAAM,gBAAgB;AACtC,SAASC,0BAA0B,QAAQ,sBAAsB;;AAEjE;;AAKA,MAAMC,gBAAgB,GAAGF,IAAI,CAACG,aAAa,CAAmB,CAAC;;AAE/D;AACA,OAAO,SAASC,YAAYA,CAAA,EAAiC;EAC3D,OAAOJ,IAAI,CAACK,UAAU,CAACH,gBAAgB,CAAC;AAC1C;;AAEA;;AAMA;AACA,OAAO,SAASI,SAASA,CAACC,KAAqB,EAAE;EAC/C,MAAMC,KAAK,GAAGP,0BAA0B,CACtCD,IAAI,CAACS,SAAS,CAAC,CAAC,EAChBT,IAAI,CAACU,QAAQ,CAAC,CAAC,EACfH,KAAK,CAACI,IACR,CAAC;EAED,MAAMC,YAA8B,GAAG;IACrCD,IAAI,EAAEJ,KAAK,CAACI;EACd,CAAC;EAED,OAAAE,iBAAA,CAAQX,gBAAgB,CAACY,QAAQ;IAACC,KAAK,EAAEH,YAAY;IAAA,IAAAI,SAAA;MAAA,OAAAH,iBAAA,CAChDb,IAAI,CAACiB,KAAK;QAACF,KAAK,EAAEP,KAAK;QAAA,IAAAQ,SAAA;UAAA,OACrBT,KAAK,CAACS,QAAQ;QAAA;MAAA;IAAA;EAAA;AAGvB","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as core from "@alloy-js/core";
|
|
2
|
+
export interface ParameterProps {
|
|
3
|
+
name: string;
|
|
4
|
+
type: core.Children;
|
|
5
|
+
refkey?: core.Refkey;
|
|
6
|
+
symbol?: core.OutputSymbol;
|
|
7
|
+
}
|
|
8
|
+
export declare function Parameter(props: ParameterProps): any;
|
|
9
|
+
export interface ParametersProps {
|
|
10
|
+
parameters: Array<ParameterProps>;
|
|
11
|
+
}
|
|
12
|
+
export declare function Parameters(props: ParametersProps): Array<core.Child | string>;
|
|
13
|
+
//# sourceMappingURL=Parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Parameters.d.ts","sourceRoot":"","sources":["../../../src/components/Parameters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAMvC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC;CAC5B;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,OAqB9C;AAED,MAAM,WAAW,eAAe;IAE9B,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CACnC;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,CAQ7E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import * as core from "@alloy-js/core";
|
|
4
|
+
import { useCSharpNamePolicy } from "../name-policy.js";
|
|
5
|
+
import { useCSharpScope } from "../symbols/scopes.js";
|
|
6
|
+
import { Name } from "./Name.js";
|
|
7
|
+
// a constructor/method parameter
|
|
8
|
+
export function Parameter(props) {
|
|
9
|
+
const name = useCSharpNamePolicy().getName(props.name, "parameter");
|
|
10
|
+
const scope = useCSharpScope();
|
|
11
|
+
if (scope.kind !== "member" || scope.name !== "constructor-decl" && scope.name !== "method-decl") {
|
|
12
|
+
throw new Error("can't define a parameter outside of a constructor-decl or method-decl scope");
|
|
13
|
+
}
|
|
14
|
+
const memberSymbol = scope.binder.createSymbol({
|
|
15
|
+
name: name,
|
|
16
|
+
scope,
|
|
17
|
+
refkey: props.refkey ?? core.refkey(props.name)
|
|
18
|
+
});
|
|
19
|
+
return _$createComponent(core.Declaration, {
|
|
20
|
+
symbol: memberSymbol,
|
|
21
|
+
get children() {
|
|
22
|
+
return [_$memo(() => props.type), " ", _$createComponent(Name, {})];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
// a collection of parameters
|
|
27
|
+
export function Parameters(props) {
|
|
28
|
+
return core.mapJoin(props.parameters, param => {
|
|
29
|
+
return _$createComponent(Parameter, param);
|
|
30
|
+
}, {
|
|
31
|
+
joiner: ", "
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=Parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Parameters.js","names":["core","useCSharpNamePolicy","useCSharpScope","Name","Parameter","props","name","getName","scope","kind","Error","memberSymbol","binder","createSymbol","refkey","_$createComponent","Declaration","symbol","children","_$memo","type","Parameters","mapJoin","parameters","param","joiner"],"sources":["../../../src/components/Parameters.tsx"],"sourcesContent":[null],"mappings":";;AAAA,OAAO,KAAKA,IAAI,MAAM,gBAAgB;AACtC,SAASC,mBAAmB,QAAQ,mBAAmB;AAEvD,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,IAAI,QAAQ,WAAW;AAShC;AACA,OAAO,SAASC,SAASA,CAACC,KAAqB,EAAE;EAC/C,MAAMC,IAAI,GAAGL,mBAAmB,CAAC,CAAC,CAACM,OAAO,CAACF,KAAK,CAACC,IAAI,EAAE,WAAW,CAAC;EACnE,MAAME,KAAK,GAAGN,cAAc,CAAC,CAAC;EAC9B,IACEM,KAAK,CAACC,IAAI,KAAK,QAAQ,IACtBD,KAAK,CAACF,IAAI,KAAK,kBAAkB,IAAIE,KAAK,CAACF,IAAI,KAAK,aAAc,EACnE;IACA,MAAM,IAAII,KAAK,CACb,6EACF,CAAC;EACH;EAEA,MAAMC,YAAY,GAAGH,KAAK,CAACI,MAAM,CAACC,YAAY,CAAqB;IACjEP,IAAI,EAAEA,IAAI;IACVE,KAAK;IACLM,MAAM,EAAET,KAAK,CAACS,MAAM,IAAId,IAAI,CAACc,MAAM,CAACT,KAAK,CAACC,IAAI;EAChD,CAAC,CAAC;EAEF,OAAAS,iBAAA,CAAQf,IAAI,CAACgB,WAAW;IAACC,MAAM,EAAEN,YAAY;IAAA,IAAAO,SAAA;MAAA,QAAAC,MAAA,OACxCd,KAAK,CAACe,IAAI,QAAAL,iBAAA,CAAGZ,IAAI;IAAA;EAAA;AAExB;AAOA;AACA,OAAO,SAASkB,UAAUA,CAAChB,KAAsB,EAA8B;EAC7E,OAAOL,IAAI,CAACsB,OAAO,CACjBjB,KAAK,CAACkB,UAAU,EACfC,KAAK,IAAK;IACT,OAAAT,iBAAA,CAAQX,SAAS,EAAKoB,KAAK;EAC7B,CAAC,EACD;IAAEC,MAAM,EAAE;EAAK,CACjB,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as core from "@alloy-js/core";
|
|
2
|
+
export interface ProjectDirectoryProps {
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
description: string;
|
|
6
|
+
path: string;
|
|
7
|
+
srcDir?: string;
|
|
8
|
+
targetFrameworkMoniker?: string;
|
|
9
|
+
children?: core.Children;
|
|
10
|
+
}
|
|
11
|
+
export declare function ProjectDirectory(props: ProjectDirectoryProps): any;
|
|
12
|
+
//# sourceMappingURL=ProjectDirectory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectDirectory.d.ts","sourceRoot":"","sources":["../../../src/components/ProjectDirectory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAIvC,MAAM,WAAW,qBAAqB;IAEpC,IAAI,EAAE,MAAM,CAAC;IAGb,OAAO,EAAE,MAAM,CAAC;IAGhB,WAAW,EAAE,MAAM,CAAC;IAGpB,IAAI,EAAE,MAAM,CAAC;IAGb,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAGhC,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAGD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,OAyB5D"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import * as core from "@alloy-js/core";
|
|
4
|
+
import { join } from "pathe";
|
|
5
|
+
|
|
6
|
+
// properties for creating the project directory
|
|
7
|
+
|
|
8
|
+
// the top-level C# project directory. includes a csproj file
|
|
9
|
+
export function ProjectDirectory(props) {
|
|
10
|
+
if (!props.srcDir) {
|
|
11
|
+
props.srcDir = "src";
|
|
12
|
+
}
|
|
13
|
+
if (!props.targetFrameworkMoniker) {
|
|
14
|
+
props.targetFrameworkMoniker = "net8.0";
|
|
15
|
+
}
|
|
16
|
+
return _$createComponent(core.SourceDirectory, {
|
|
17
|
+
get path() {
|
|
18
|
+
return join(props.path, props.name);
|
|
19
|
+
},
|
|
20
|
+
get children() {
|
|
21
|
+
return [_$createComponent(core.SourceFile, {
|
|
22
|
+
get path() {
|
|
23
|
+
return props.name + ".csproj";
|
|
24
|
+
},
|
|
25
|
+
filetype: "xml",
|
|
26
|
+
get children() {
|
|
27
|
+
return core.code`
|
|
28
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
29
|
+
<PropertyGroup>
|
|
30
|
+
<Version>${props.version}</Version>
|
|
31
|
+
<Description>${props.description}</Description>
|
|
32
|
+
<TargetFramework>${props.targetFrameworkMoniker}</TargetFramework>
|
|
33
|
+
</PropertyGroup>
|
|
34
|
+
</Project>
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
}), "\n", _$createComponent(core.SourceDirectory, {
|
|
38
|
+
get path() {
|
|
39
|
+
return props.srcDir;
|
|
40
|
+
},
|
|
41
|
+
get children() {
|
|
42
|
+
return props.children;
|
|
43
|
+
}
|
|
44
|
+
})];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=ProjectDirectory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectDirectory.js","names":["core","join","ProjectDirectory","props","srcDir","targetFrameworkMoniker","_$createComponent","SourceDirectory","path","name","children","SourceFile","filetype","code","version","description"],"sources":["../../../src/components/ProjectDirectory.tsx"],"sourcesContent":[null],"mappings":";;AAAA,OAAO,KAAKA,IAAI,MAAM,gBAAgB;AACtC,SAASC,IAAI,QAAQ,OAAO;;AAE5B;;AAwBA;AACA,OAAO,SAASC,gBAAgBA,CAACC,KAA4B,EAAE;EAC7D,IAAI,CAACA,KAAK,CAACC,MAAM,EAAE;IACjBD,KAAK,CAACC,MAAM,GAAG,KAAK;EACtB;EAEA,IAAI,CAACD,KAAK,CAACE,sBAAsB,EAAE;IACjCF,KAAK,CAACE,sBAAsB,GAAG,QAAQ;EACzC;EAEA,OAAAC,iBAAA,CAAQN,IAAI,CAACO,eAAe;IAAA,IAACC,IAAIA,CAAA;MAAA,OAAEP,IAAI,CAACE,KAAK,CAACK,IAAI,EAAEL,KAAK,CAACM,IAAI,CAAC;IAAA;IAAA,IAAAC,SAAA;MAAA,QAAAJ,iBAAA,CAC5DN,IAAI,CAACW,UAAU;QAAA,IAACH,IAAIA,CAAA;UAAA,OAAEL,KAAK,CAACM,IAAI,GAAC,SAAS;QAAA;QAAEG,QAAQ;QAAA,IAAAF,SAAA;UAAA,OAClDV,IAAI,CAACa,IAAI;AAChB;AACA;AACA,uBAAuBV,KAAK,CAACW,OAAO;AACpC,2BAA2BX,KAAK,CAACY,WAAW;AAC5C,+BAA+BZ,KAAK,CAACE,sBAAsB;AAC3D;AACA;AACA,OAAO;QAAA;MAAA,UAAAC,iBAAA,CAEFN,IAAI,CAACO,eAAe;QAAA,IAACC,IAAIA,CAAA;UAAA,OAAEL,KAAK,CAACC,MAAM;QAAA;QAAA,IAAAM,SAAA;UAAA,OACrCP,KAAK,CAACO,QAAQ;QAAA;MAAA;IAAA;EAAA;AAGrB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reference.d.ts","sourceRoot":"","sources":["../../../src/components/Reference.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAGvC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;CACrB;AAGD,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,cAAc,OAInD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reference.js","names":["ref","Reference","refkey","reference"],"sources":["../../../src/components/Reference.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,GAAG,QAAQ,yBAAyB;AAM7C;AACA,OAAO,SAASC,SAASA,CAAC;EAAEC;AAAuB,CAAC,EAAE;EACpD,MAAMC,SAAS,GAAGH,GAAG,CAACE,MAAM,CAAC;EAE7B,OAAUC,SAAS;AACrB","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as core from "@alloy-js/core";
|
|
2
|
+
export interface SourceFileContext {
|
|
3
|
+
addUsing(namespace: string): void;
|
|
4
|
+
}
|
|
5
|
+
export declare function useSourceFile(): SourceFileContext | undefined;
|
|
6
|
+
export interface SourceFileProps {
|
|
7
|
+
path: string;
|
|
8
|
+
using?: Array<string>;
|
|
9
|
+
children?: core.Children;
|
|
10
|
+
}
|
|
11
|
+
export declare function SourceFile(props: SourceFileProps): any;
|
|
12
|
+
//# sourceMappingURL=SourceFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAMvC,MAAM,WAAW,iBAAiB;IAEhC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAKD,wBAAgB,aAAa,IAAI,iBAAiB,GAAG,SAAS,CAE7D;AAGD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;CAC1B;AAID,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,OAyChD"}
|