@alloy-js/java 0.5.0 → 0.7.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/CHANGELOG.md +27 -0
- package/dist/src/components/Annotation.d.ts +4 -4
- package/dist/src/components/Annotation.d.ts.map +1 -1
- package/dist/src/components/Annotation.js +27 -5
- package/dist/src/components/Annotation.js.map +1 -1
- package/dist/src/components/ArgumentList.d.ts +12 -0
- package/dist/src/components/ArgumentList.d.ts.map +1 -0
- package/dist/src/components/ArgumentList.js +33 -0
- package/dist/src/components/ArgumentList.js.map +1 -0
- package/dist/src/components/Class.d.ts +4 -4
- package/dist/src/components/Class.d.ts.map +1 -1
- package/dist/src/components/Class.js +33 -14
- package/dist/src/components/Class.js.map +1 -1
- package/dist/src/components/Constructor.d.ts +3 -3
- package/dist/src/components/Constructor.d.ts.map +1 -1
- package/dist/src/components/Constructor.js +9 -10
- package/dist/src/components/Constructor.js.map +1 -1
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +0 -1
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/Enum.d.ts +14 -6
- package/dist/src/components/Enum.d.ts.map +1 -1
- package/dist/src/components/Enum.js +38 -16
- package/dist/src/components/Enum.js.map +1 -1
- package/dist/src/components/ExtendsClause.d.ts +9 -0
- package/dist/src/components/ExtendsClause.d.ts.map +1 -0
- package/dist/src/components/ExtendsClause.js +28 -0
- package/dist/src/components/ExtendsClause.js.map +1 -0
- package/dist/src/components/ImplementsClause.d.ts +9 -0
- package/dist/src/components/ImplementsClause.d.ts.map +1 -0
- package/dist/src/components/ImplementsClause.js +28 -0
- package/dist/src/components/ImplementsClause.js.map +1 -0
- package/dist/src/components/ImportStatement.d.ts +1 -1
- package/dist/src/components/ImportStatement.d.ts.map +1 -1
- package/dist/src/components/ImportStatement.js +1 -1
- package/dist/src/components/ImportStatement.js.map +1 -1
- package/dist/src/components/Interface.d.ts +4 -4
- package/dist/src/components/Interface.d.ts.map +1 -1
- package/dist/src/components/Interface.js +23 -16
- package/dist/src/components/Interface.js.map +1 -1
- package/dist/src/components/MavenProject.d.ts +4 -2
- package/dist/src/components/MavenProject.d.ts.map +1 -1
- package/dist/src/components/MavenProject.js +183 -122
- package/dist/src/components/MavenProject.js.map +1 -1
- package/dist/src/components/Method.d.ts +3 -3
- package/dist/src/components/Method.d.ts.map +1 -1
- package/dist/src/components/Method.js +8 -4
- package/dist/src/components/Method.js.map +1 -1
- package/dist/src/{object-modifiers.d.ts → components/Modifiers.d.ts} +6 -3
- package/dist/src/components/Modifiers.d.ts.map +1 -0
- package/dist/src/components/Modifiers.js +27 -0
- package/dist/src/components/Modifiers.js.map +1 -0
- package/dist/src/components/Name.js +1 -1
- package/dist/src/components/Name.js.map +1 -1
- package/dist/src/components/NamedArgumentList.d.ts +11 -0
- package/dist/src/components/NamedArgumentList.d.ts.map +1 -0
- package/dist/src/components/NamedArgumentList.js +30 -0
- package/dist/src/components/NamedArgumentList.js.map +1 -0
- package/dist/src/components/ObjectDeclaration.d.ts +3 -3
- package/dist/src/components/ObjectDeclaration.d.ts.map +1 -1
- package/dist/src/components/ObjectDeclaration.js +8 -4
- package/dist/src/components/ObjectDeclaration.js.map +1 -1
- package/dist/src/components/PackageDirectory.d.ts.map +1 -1
- package/dist/src/components/PackageDirectory.js.map +1 -1
- package/dist/src/components/Parameters.d.ts +3 -3
- package/dist/src/components/Parameters.d.ts.map +1 -1
- package/dist/src/components/Parameters.js +1 -1
- package/dist/src/components/Parameters.js.map +1 -1
- package/dist/src/components/ProjectDirectory.d.ts.map +1 -1
- package/dist/src/components/ProjectDirectory.js +3 -3
- package/dist/src/components/ProjectDirectory.js.map +1 -1
- package/dist/src/components/Reference.js +1 -1
- package/dist/src/components/Reference.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +3 -2
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/TypeArguments.d.ts +24 -0
- package/dist/src/components/TypeArguments.d.ts.map +1 -0
- package/dist/src/components/TypeArguments.js +82 -0
- package/dist/src/components/TypeArguments.js.map +1 -0
- package/dist/src/components/TypeParameters.d.ts +9 -0
- package/dist/src/components/TypeParameters.d.ts.map +1 -0
- package/dist/src/components/TypeParameters.js +40 -0
- package/dist/src/components/TypeParameters.js.map +1 -0
- package/dist/src/components/Variable.d.ts +5 -5
- package/dist/src/components/Variable.d.ts.map +1 -1
- package/dist/src/components/Variable.js +4 -3
- package/dist/src/components/Variable.js.map +1 -1
- package/dist/src/components/index.d.ts +8 -2
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +8 -2
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/stc/index.d.ts +37 -17
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +7 -2
- package/dist/src/components/stc/index.js.map +1 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +1 -1
- package/dist/test/maven.test.d.ts +2 -0
- package/dist/test/maven.test.d.ts.map +1 -0
- package/dist/test/type-arguments.test.d.ts +2 -0
- package/dist/test/type-arguments.test.d.ts.map +1 -0
- package/dist/test/utils.d.ts +3 -3
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -5
- package/src/components/Annotation.tsx +24 -13
- package/src/components/ArgumentList.tsx +29 -0
- package/src/components/Class.tsx +24 -20
- package/src/components/Constructor.tsx +11 -10
- package/src/components/Declaration.tsx +1 -3
- package/src/components/Enum.tsx +39 -23
- package/src/components/ExtendsClause.tsx +19 -0
- package/src/components/ImplementsClause.tsx +19 -0
- package/src/components/ImportStatement.tsx +5 -2
- package/src/components/Interface.tsx +20 -20
- package/src/components/MavenProject.tsx +256 -121
- package/src/components/Method.tsx +12 -10
- package/src/components/Modifiers.tsx +54 -0
- package/src/components/NamedArgumentList.tsx +31 -0
- package/src/components/ObjectDeclaration.tsx +6 -6
- package/src/components/PackageDirectory.tsx +14 -7
- package/src/components/Parameters.tsx +4 -4
- package/src/components/ProjectDirectory.tsx +7 -5
- package/src/components/SourceFile.tsx +15 -11
- package/src/components/TypeArguments.tsx +88 -0
- package/src/components/TypeParameters.tsx +34 -0
- package/src/components/Variable.tsx +6 -6
- package/src/components/index.ts +8 -2
- package/src/components/stc/index.ts +7 -2
- package/src/index.ts +0 -3
- package/temp/api.json +1455 -963
- package/test/annotation.test.tsx +38 -25
- package/test/class.test.tsx +32 -27
- package/test/constructor.test.tsx +24 -25
- package/test/enum.test.tsx +28 -25
- package/test/externals.test.tsx +13 -5
- package/test/interface.test.tsx +20 -15
- package/test/{maven.tsx → maven.test.tsx} +15 -13
- package/test/method.test.tsx +39 -23
- package/test/package.test.tsx +2 -3
- package/test/reference.test.tsx +14 -12
- package/test/{generics.tsx → type-arguments.test.tsx} +6 -6
- package/test/utils.tsx +10 -6
- package/test/values.test.tsx +1 -3
- package/test/variables.test.tsx +7 -7
- package/dist/src/arguments.d.ts +0 -15
- package/dist/src/arguments.d.ts.map +0 -1
- package/dist/src/arguments.js +0 -27
- package/dist/src/arguments.js.map +0 -1
- package/dist/src/components/Block.d.ts +0 -6
- package/dist/src/components/Block.d.ts.map +0 -1
- package/dist/src/components/Block.js +0 -4
- package/dist/src/components/Block.js.map +0 -1
- package/dist/src/components/Generics.d.ts +0 -6
- package/dist/src/components/Generics.d.ts.map +0 -1
- package/dist/src/components/Generics.js +0 -8
- package/dist/src/components/Generics.js.map +0 -1
- package/dist/src/generics.d.ts +0 -28
- package/dist/src/generics.d.ts.map +0 -1
- package/dist/src/generics.js +0 -51
- package/dist/src/generics.js.map +0 -1
- package/dist/src/object-modifiers.d.ts.map +0 -1
- package/dist/src/object-modifiers.js +0 -31
- package/dist/src/object-modifiers.js.map +0 -1
- package/dist/test/generics.d.ts +0 -2
- package/dist/test/generics.d.ts.map +0 -1
- package/dist/test/maven.d.ts +0 -2
- package/dist/test/maven.d.ts.map +0 -1
- package/src/arguments.ts +0 -30
- package/src/components/Block.tsx +0 -8
- package/src/components/Generics.tsx +0 -12
- package/src/generics.ts +0 -59
- package/src/object-modifiers.ts +0 -48
package/test/method.test.tsx
CHANGED
|
@@ -9,9 +9,11 @@ it("declares basic empty function", () => {
|
|
|
9
9
|
<jv.Declaration name="Test">
|
|
10
10
|
{code`
|
|
11
11
|
class Test {
|
|
12
|
-
${
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
${(
|
|
13
|
+
<jv.Method public name="testMethod">
|
|
14
|
+
System.out.println("Test");
|
|
15
|
+
</jv.Method>
|
|
16
|
+
)}
|
|
15
17
|
}
|
|
16
18
|
`}
|
|
17
19
|
</jv.Declaration>,
|
|
@@ -33,7 +35,7 @@ it("declares bodyless function", () => {
|
|
|
33
35
|
<jv.Declaration name="Test">
|
|
34
36
|
{code`
|
|
35
37
|
class Test {
|
|
36
|
-
${<jv.Method public name="testMethod" />}
|
|
38
|
+
${(<jv.Method public name="testMethod" />)}
|
|
37
39
|
}
|
|
38
40
|
`}
|
|
39
41
|
</jv.Declaration>,
|
|
@@ -54,7 +56,7 @@ describe("can throw errors", () => {
|
|
|
54
56
|
<jv.Declaration name="Test">
|
|
55
57
|
{code`
|
|
56
58
|
class Test {
|
|
57
|
-
${<jv.Method public name="testMethod" throws={
|
|
59
|
+
${(<jv.Method public name="testMethod" throws={"Exception"} />)}
|
|
58
60
|
}
|
|
59
61
|
`}
|
|
60
62
|
</jv.Declaration>,
|
|
@@ -76,7 +78,7 @@ describe("can throw errors", () => {
|
|
|
76
78
|
<jv.Declaration name="Test">
|
|
77
79
|
{code`
|
|
78
80
|
class Test {
|
|
79
|
-
${<jv.Method public name="testMethod" throws={refkey(
|
|
81
|
+
${(<jv.Method public name="testMethod" throws={refkey("CustomError")} />)}
|
|
80
82
|
}
|
|
81
83
|
`}
|
|
82
84
|
</jv.Declaration>
|
|
@@ -90,7 +92,6 @@ describe("can throw errors", () => {
|
|
|
90
92
|
`}
|
|
91
93
|
</jv.Declaration>
|
|
92
94
|
</jv.SourceFile>
|
|
93
|
-
|
|
94
95
|
</jv.PackageDirectory>
|
|
95
96
|
</>,
|
|
96
97
|
);
|
|
@@ -114,10 +115,13 @@ it("declares return type", () => {
|
|
|
114
115
|
<jv.Declaration name="Test">
|
|
115
116
|
{code`
|
|
116
117
|
class Test {
|
|
117
|
-
${
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
${(
|
|
119
|
+
<jv.Method public name="testMethod" return="String">
|
|
120
|
+
System.out.println("Test");
|
|
121
|
+
<hbr />
|
|
122
|
+
return "Test";
|
|
123
|
+
</jv.Method>
|
|
124
|
+
)}
|
|
121
125
|
}
|
|
122
126
|
`}
|
|
123
127
|
</jv.Declaration>,
|
|
@@ -139,24 +143,30 @@ it("declares parameters", () => {
|
|
|
139
143
|
const res = testRender(
|
|
140
144
|
<>
|
|
141
145
|
<jv.SourceFile path="Model.java">
|
|
142
|
-
<jv.Declaration name=
|
|
146
|
+
<jv.Declaration name="Model">
|
|
143
147
|
{code`
|
|
144
148
|
public class Model {
|
|
145
149
|
}
|
|
146
150
|
`}
|
|
147
151
|
</jv.Declaration>
|
|
148
152
|
</jv.SourceFile>
|
|
149
|
-
<jv.PackageDirectory package=
|
|
153
|
+
<jv.PackageDirectory package="imports">
|
|
150
154
|
<jv.SourceFile path="Test.java">
|
|
151
155
|
<Declaration name="Test">
|
|
152
156
|
{code`
|
|
153
157
|
public class Test {
|
|
154
|
-
${
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
${(
|
|
159
|
+
<jv.Method
|
|
160
|
+
public
|
|
161
|
+
name="testMethod"
|
|
162
|
+
parameters={{
|
|
163
|
+
myModel: refkey("Model"),
|
|
164
|
+
name: "String",
|
|
165
|
+
}}
|
|
166
|
+
>
|
|
158
167
|
System.out.println("Test");
|
|
159
|
-
</jv.Method>
|
|
168
|
+
</jv.Method>
|
|
169
|
+
)}
|
|
160
170
|
}
|
|
161
171
|
`}
|
|
162
172
|
</Declaration>
|
|
@@ -184,21 +194,27 @@ it("defines generics", () => {
|
|
|
184
194
|
const res = testRender(
|
|
185
195
|
<>
|
|
186
196
|
<jv.SourceFile path="Model.java">
|
|
187
|
-
<jv.Declaration name=
|
|
197
|
+
<jv.Declaration name="Model">
|
|
188
198
|
{code`
|
|
189
199
|
public class Model {
|
|
190
200
|
}
|
|
191
201
|
`}
|
|
192
202
|
</jv.Declaration>
|
|
193
203
|
</jv.SourceFile>
|
|
194
|
-
<jv.PackageDirectory package=
|
|
204
|
+
<jv.PackageDirectory package="imports">
|
|
195
205
|
<jv.SourceFile path="Test.java">
|
|
196
206
|
<Declaration name="Test">
|
|
197
207
|
{code`
|
|
198
208
|
public class Test {
|
|
199
|
-
${
|
|
200
|
-
|
|
201
|
-
|
|
209
|
+
${(
|
|
210
|
+
<jv.Method
|
|
211
|
+
public
|
|
212
|
+
generics={{ T: refkey("Model"), N: "String", K: "" }}
|
|
213
|
+
name="testMethod"
|
|
214
|
+
>
|
|
215
|
+
System.out.println("Test");
|
|
216
|
+
</jv.Method>
|
|
217
|
+
)}
|
|
202
218
|
}
|
|
203
219
|
`}
|
|
204
220
|
</Declaration>
|
package/test/package.test.tsx
CHANGED
|
@@ -5,9 +5,8 @@ import { findFile, testRender } from "./utils.js";
|
|
|
5
5
|
it("emits correct package directory", () => {
|
|
6
6
|
const res = testRender(
|
|
7
7
|
<>
|
|
8
|
-
<jv.PackageDirectory package=
|
|
9
|
-
<jv.SourceFile path="Test.java">
|
|
10
|
-
</jv.SourceFile>
|
|
8
|
+
<jv.PackageDirectory package="my.emit.package">
|
|
9
|
+
<jv.SourceFile path="Test.java"></jv.SourceFile>
|
|
11
10
|
</jv.PackageDirectory>
|
|
12
11
|
</>,
|
|
13
12
|
);
|
package/test/reference.test.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { refkey } from "@alloy-js/core";
|
|
1
|
+
import { Block, refkey } from "@alloy-js/core";
|
|
2
2
|
import { it } from "vitest";
|
|
3
3
|
import * as jv from "../src/components/index.js";
|
|
4
4
|
import { assertFileContents, testRender } from "./utils.js";
|
|
@@ -8,18 +8,19 @@ it("imports reference to source file", () => {
|
|
|
8
8
|
<>
|
|
9
9
|
<jv.SourceFile path="TestReference.java">
|
|
10
10
|
<jv.Declaration name="TestReference">
|
|
11
|
-
public class TestReference
|
|
12
|
-
|
|
13
|
-
{"}"}
|
|
11
|
+
public class TestReference{" "}
|
|
12
|
+
<Block>public TestReference() {"{}"}</Block>
|
|
14
13
|
</jv.Declaration>
|
|
15
14
|
</jv.SourceFile>
|
|
16
|
-
<jv.PackageDirectory package=
|
|
15
|
+
<jv.PackageDirectory package="import">
|
|
17
16
|
<jv.SourceFile path="TestImport.java">
|
|
18
17
|
<jv.Declaration name="TestImport">
|
|
19
|
-
public class TestImport
|
|
18
|
+
public class TestImport{" "}
|
|
19
|
+
<Block>
|
|
20
20
|
{refkey("TestReference")} myImportedVariable;
|
|
21
|
+
<hbr />
|
|
21
22
|
public TestImport() {"{}"}
|
|
22
|
-
|
|
23
|
+
</Block>
|
|
23
24
|
</jv.Declaration>
|
|
24
25
|
</jv.SourceFile>
|
|
25
26
|
</jv.PackageDirectory>
|
|
@@ -52,17 +53,18 @@ it("doesn't import if in same package", () => {
|
|
|
52
53
|
<>
|
|
53
54
|
<jv.SourceFile path="TestReference.java">
|
|
54
55
|
<jv.Declaration name="TestReference">
|
|
55
|
-
public class TestReference
|
|
56
|
-
|
|
57
|
-
{"}"}
|
|
56
|
+
public class TestReference{" "}
|
|
57
|
+
<Block>public TestReference() {"{}"}</Block>
|
|
58
58
|
</jv.Declaration>
|
|
59
59
|
</jv.SourceFile>
|
|
60
60
|
<jv.SourceFile path="TestImport.java">
|
|
61
61
|
<jv.Declaration name="TestImport">
|
|
62
|
-
public class TestImport
|
|
62
|
+
public class TestImport{" "}
|
|
63
|
+
<Block>
|
|
63
64
|
{refkey("TestReference")} myImportedVariable;
|
|
65
|
+
<hbr />
|
|
64
66
|
public TestImport() {"{}"}
|
|
65
|
-
|
|
67
|
+
</Block>
|
|
66
68
|
</jv.Declaration>
|
|
67
69
|
</jv.SourceFile>
|
|
68
70
|
</>,
|
|
@@ -2,13 +2,13 @@ import { code, refkey } from "@alloy-js/core";
|
|
|
2
2
|
import { d } from "@alloy-js/core/testing";
|
|
3
3
|
import { it } from "vitest";
|
|
4
4
|
import * as jv from "../src/components/index.js";
|
|
5
|
-
import { assertFileContents, testRender } from "./utils.
|
|
5
|
+
import { assertFileContents, testRender } from "./utils.jsx";
|
|
6
6
|
|
|
7
7
|
it("passes types", () => {
|
|
8
8
|
const res = testRender(
|
|
9
9
|
<>
|
|
10
10
|
<jv.SourceFile path="TypeOne.java">
|
|
11
|
-
<jv.Declaration name=
|
|
11
|
+
<jv.Declaration name="TypeOne">
|
|
12
12
|
{code`
|
|
13
13
|
public interface TypeOne {
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ it("passes types", () => {
|
|
|
16
16
|
</jv.Declaration>
|
|
17
17
|
</jv.SourceFile>
|
|
18
18
|
<jv.SourceFile path="TypeTwo.java">
|
|
19
|
-
<jv.Declaration name=
|
|
19
|
+
<jv.Declaration name="TypeTwo">
|
|
20
20
|
{code`
|
|
21
21
|
public interface TypeTwo {
|
|
22
22
|
}
|
|
@@ -28,9 +28,9 @@ it("passes types", () => {
|
|
|
28
28
|
<jv.Class public name="TestGenerics">
|
|
29
29
|
{code`
|
|
30
30
|
public TestGenerics() {
|
|
31
|
-
List${<jv.
|
|
32
|
-
List${<jv.
|
|
33
|
-
List${<jv.
|
|
31
|
+
List${(<jv.TypeArguments args={[refkey("TypeOne")]} />)} list = new ArrayList${(<jv.TypeArguments />)}();
|
|
32
|
+
List${(<jv.TypeArguments args={[{ extends: refkey("TypeTwo") }]} />)} list2 = new ArrayList${(<jv.TypeArguments />)}();
|
|
33
|
+
List${(<jv.TypeArguments args={[{ wildcard: true }]} />)} list3 = new ArrayList${(<jv.TypeArguments />)}();
|
|
34
34
|
}
|
|
35
35
|
`}
|
|
36
36
|
</jv.Class>
|
package/test/utils.tsx
CHANGED
|
@@ -3,32 +3,36 @@ import {
|
|
|
3
3
|
Output,
|
|
4
4
|
OutputDirectory,
|
|
5
5
|
OutputFile,
|
|
6
|
+
PrintTreeOptions,
|
|
6
7
|
render,
|
|
7
8
|
} from "@alloy-js/core";
|
|
8
9
|
import { dedent } from "@alloy-js/core/testing";
|
|
9
10
|
import { expect } from "vitest";
|
|
10
11
|
import * as jv from "../src/index.js";
|
|
11
12
|
|
|
12
|
-
export function toSourceText(c: Children): string {
|
|
13
|
+
export function toSourceText(c: Children, options?: PrintTreeOptions): string {
|
|
13
14
|
const res = render(
|
|
14
15
|
<Output>
|
|
15
|
-
<jv.PackageDirectory package=
|
|
16
|
+
<jv.PackageDirectory package="me.test.code">
|
|
16
17
|
<jv.SourceFile path="Test.java">{c}</jv.SourceFile>
|
|
17
18
|
</jv.PackageDirectory>
|
|
18
19
|
</Output>,
|
|
20
|
+
options,
|
|
19
21
|
);
|
|
20
22
|
|
|
21
23
|
const file = findFile(res, "Test.java");
|
|
22
24
|
return file.contents;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
export function testRender(
|
|
27
|
+
export function testRender(
|
|
28
|
+
c: Children,
|
|
29
|
+
options?: PrintTreeOptions,
|
|
30
|
+
): OutputDirectory {
|
|
26
31
|
return render(
|
|
27
32
|
<Output>
|
|
28
|
-
<jv.PackageDirectory package=
|
|
29
|
-
{c}
|
|
30
|
-
</jv.PackageDirectory>
|
|
33
|
+
<jv.PackageDirectory package="me.test.code">{c}</jv.PackageDirectory>
|
|
31
34
|
</Output>,
|
|
35
|
+
options,
|
|
32
36
|
);
|
|
33
37
|
}
|
|
34
38
|
|
package/test/values.test.tsx
CHANGED
package/test/variables.test.tsx
CHANGED
|
@@ -9,7 +9,7 @@ it("works", () => {
|
|
|
9
9
|
<jv.Declaration name="Test">
|
|
10
10
|
{code`
|
|
11
11
|
class Test {
|
|
12
|
-
${<jv.Variable public static final type="String" name=
|
|
12
|
+
${(<jv.Variable public static final type="String" name="myVar" value={<jv.Value value="Test" />} />)};
|
|
13
13
|
}
|
|
14
14
|
`}
|
|
15
15
|
</jv.Declaration>,
|
|
@@ -28,19 +28,19 @@ it("works with external type", () => {
|
|
|
28
28
|
const res = testRender(
|
|
29
29
|
<>
|
|
30
30
|
<jv.SourceFile path="Model.java">
|
|
31
|
-
<jv.Declaration name=
|
|
31
|
+
<jv.Declaration name="Model">
|
|
32
32
|
{code`
|
|
33
33
|
public class Model {
|
|
34
34
|
}
|
|
35
35
|
`}
|
|
36
36
|
</jv.Declaration>
|
|
37
37
|
</jv.SourceFile>
|
|
38
|
-
<jv.PackageDirectory package=
|
|
38
|
+
<jv.PackageDirectory package="imports">
|
|
39
39
|
<jv.SourceFile path="Test.java">
|
|
40
40
|
<Declaration name="Test">
|
|
41
41
|
{code`
|
|
42
42
|
public class Test {
|
|
43
|
-
${<jv.Variable public static type={refkey("Model")} name=
|
|
43
|
+
${(<jv.Variable public static type={refkey("Model")} name="myModel" />)};
|
|
44
44
|
}
|
|
45
45
|
`}
|
|
46
46
|
</Declaration>
|
|
@@ -66,19 +66,19 @@ it("declares new object", () => {
|
|
|
66
66
|
const res = testRender(
|
|
67
67
|
<>
|
|
68
68
|
<jv.SourceFile path="Model.java">
|
|
69
|
-
<jv.Declaration name=
|
|
69
|
+
<jv.Declaration name="Model">
|
|
70
70
|
{code`
|
|
71
71
|
public class Model {
|
|
72
72
|
}
|
|
73
73
|
`}
|
|
74
74
|
</jv.Declaration>
|
|
75
75
|
</jv.SourceFile>
|
|
76
|
-
<jv.PackageDirectory package=
|
|
76
|
+
<jv.PackageDirectory package="imports">
|
|
77
77
|
<jv.SourceFile path="Test.java">
|
|
78
78
|
<Declaration name="Test">
|
|
79
79
|
{code`
|
|
80
80
|
public class Test {
|
|
81
|
-
${<jv.ObjectDeclaration public static type={refkey("Model")} name=
|
|
81
|
+
${(<jv.ObjectDeclaration public static type={refkey("Model")} name="myModel" args={[<jv.Value value="initValue" />]} />)};
|
|
82
82
|
}
|
|
83
83
|
`}
|
|
84
84
|
</Declaration>
|
package/dist/src/arguments.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Children } from "@alloy-js/core";
|
|
2
|
-
/**
|
|
3
|
-
* Collect a set of arguments to be passed to a method, class init.
|
|
4
|
-
* Can take single child, or array of children
|
|
5
|
-
*
|
|
6
|
-
* @param args - Children to collect
|
|
7
|
-
*/
|
|
8
|
-
export declare function collectArguments(args: Children): Children;
|
|
9
|
-
/**
|
|
10
|
-
* Collect a set of named arguments. Will pass to object as named arguments.
|
|
11
|
-
*
|
|
12
|
-
* @param args - of name to argument value
|
|
13
|
-
*/
|
|
14
|
-
export declare function collectNamedArguments(args: Record<string, Children>): Children;
|
|
15
|
-
//# sourceMappingURL=arguments.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arguments.d.ts","sourceRoot":"","sources":["../../src/arguments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAW,MAAM,gBAAgB,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAIzD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAC7B,QAAQ,CAQV"}
|
package/dist/src/arguments.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { mapJoin } from "@alloy-js/core";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Collect a set of arguments to be passed to a method, class init.
|
|
5
|
-
* Can take single child, or array of children
|
|
6
|
-
*
|
|
7
|
-
* @param args - Children to collect
|
|
8
|
-
*/
|
|
9
|
-
export function collectArguments(args) {
|
|
10
|
-
return Array.isArray(args) ? mapJoin(args, val => val, {
|
|
11
|
-
joiner: ", "
|
|
12
|
-
}) : args;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Collect a set of named arguments. Will pass to object as named arguments.
|
|
17
|
-
*
|
|
18
|
-
* @param args - of name to argument value
|
|
19
|
-
*/
|
|
20
|
-
export function collectNamedArguments(args) {
|
|
21
|
-
return mapJoin(new Map(Object.entries(args)), (key, value) => {
|
|
22
|
-
return [key, " = ", value];
|
|
23
|
-
}, {
|
|
24
|
-
joiner: ", "
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=arguments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arguments.js","names":["mapJoin","collectArguments","args","Array","isArray","val","joiner","collectNamedArguments","Map","Object","entries","key","value"],"sources":["../../src/arguments.ts"],"sourcesContent":[null],"mappings":"AAAA,SAAmBA,OAAO,QAAQ,gBAAgB;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,IAAc,EAAY;EACzD,OAAOC,KAAK,CAACC,OAAO,CAACF,IAAI,CAAC,GACtBF,OAAO,CAACE,IAAI,EAAGG,GAAG,IAAKA,GAAG,EAAE;IAAEC,MAAM,EAAE;EAAK,CAAC,CAAC,GAC7CJ,IAAI;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,qBAAqBA,CACnCL,IAA8B,EACpB;EACV,OAAOF,OAAO,CACZ,IAAIQ,GAAG,CAACC,MAAM,CAACC,OAAO,CAACR,IAAI,CAAC,CAAC,EAC7B,CAACS,GAAG,EAAEC,KAAK,KAAK;IACd,OAAO,CAACD,GAAG,EAAE,KAAK,EAAEC,KAAK,CAAC;EAC5B,CAAC,EACD;IAAEN,MAAM,EAAE;EAAK,CACjB,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../src/components/Block.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AACD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,cAEtC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Block.js","names":["Block","props","children"],"sources":["../../../src/components/Block.tsx"],"sourcesContent":[null],"mappings":"AAKA,OAAO,SAASA,KAAKA,CAACC,KAAiB,EAAE;EACvC,OAAO,CAAC,GAAG,EAAEA,KAAK,CAACC,QAAQ,EAAE,GAAG,CAAC;AACnC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Generics.d.ts","sourceRoot":"","sources":["../../../src/components/Generics.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAQ,MAAM,gBAAgB,CAAC;AAGvD,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;CAC3C;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,kBAI5C"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { code } from "@alloy-js/core";
|
|
2
|
-
import { passGenerics } from "../generics.js";
|
|
3
|
-
export function Generics(props) {
|
|
4
|
-
if (!props.types) return "<>";
|
|
5
|
-
const generics = passGenerics(props.types);
|
|
6
|
-
return code`<${generics}>`;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=Generics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Generics.js","names":["code","passGenerics","Generics","props","types","generics"],"sources":["../../../src/components/Generics.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAA0BA,IAAI,QAAQ,gBAAgB;AACtD,SAASC,YAAY,QAAQ,gBAAgB;AAM7C,OAAO,SAASC,QAAQA,CAACC,KAAoB,EAAE;EAC7C,IAAI,CAACA,KAAK,CAACC,KAAK,EAAE,OAAO,IAAI;EAC7B,MAAMC,QAAQ,GAAGJ,YAAY,CAACE,KAAK,CAACC,KAAK,CAAC;EAC1C,OAAOJ,IAAI,IAAIK,QAAQ,GAAG;AAC5B","ignoreList":[]}
|
package/dist/src/generics.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Child, Children } from "@alloy-js/core";
|
|
2
|
-
/**
|
|
3
|
-
* Allow component to specify generic typing
|
|
4
|
-
*/
|
|
5
|
-
export interface GenericTypes {
|
|
6
|
-
generics?: Record<string, Children>;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Collect generics types to pass definitions to components
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
*
|
|
13
|
-
* Input of `{ T: 'String' }` will produce `<T extends String>`.
|
|
14
|
-
*
|
|
15
|
-
* Can then be passed to class definition, method definition, using a generic class etc.
|
|
16
|
-
*
|
|
17
|
-
* @param generics - Record of type variable, (T, Z, etc), mapped to its bounds (if any).
|
|
18
|
-
*/
|
|
19
|
-
export declare function collectGenerics(generics: Record<string, Children>): Child[];
|
|
20
|
-
/**
|
|
21
|
-
* Pass generics types to an actual object. For instance if we are using the `List` class, we define it like `List<String>`
|
|
22
|
-
* or whatever type we like. These are where we define the types. Can also pass wildcard types like `List<? extends String>`, which
|
|
23
|
-
* allows you to pass unknown types.
|
|
24
|
-
*
|
|
25
|
-
* @param generics - Takes an array of either direct child (refkey or defining type), or a record which passes a wildcard type with optional bounds
|
|
26
|
-
*/
|
|
27
|
-
export declare function passGenerics(generics: (Child | Record<"?", Children>)[]): Child[];
|
|
28
|
-
//# sourceMappingURL=generics.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generics.d.ts","sourceRoot":"","sources":["../../src/generics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAiB,MAAM,gBAAgB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACrC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,WAYjE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,WAiBvE"}
|
package/dist/src/generics.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { code, mapJoin } from "@alloy-js/core";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Allow component to specify generic typing
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Collect generics types to pass definitions to components
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
*
|
|
12
|
-
* Input of `{ T: 'String' }` will produce `<T extends String>`.
|
|
13
|
-
*
|
|
14
|
-
* Can then be passed to class definition, method definition, using a generic class etc.
|
|
15
|
-
*
|
|
16
|
-
* @param generics - Record of type variable, (T, Z, etc), mapped to its bounds (if any).
|
|
17
|
-
*/
|
|
18
|
-
export function collectGenerics(generics) {
|
|
19
|
-
const genericTypes = mapJoin(new Map(Object.entries(generics)), (key, value) => {
|
|
20
|
-
const extendsExpression = value ? code` extends ${value}` : "";
|
|
21
|
-
return [key, extendsExpression];
|
|
22
|
-
}, {
|
|
23
|
-
joiner: ", "
|
|
24
|
-
});
|
|
25
|
-
return code`<${genericTypes}>`;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Pass generics types to an actual object. For instance if we are using the `List` class, we define it like `List<String>`
|
|
30
|
-
* or whatever type we like. These are where we define the types. Can also pass wildcard types like `List<? extends String>`, which
|
|
31
|
-
* allows you to pass unknown types.
|
|
32
|
-
*
|
|
33
|
-
* @param generics - Takes an array of either direct child (refkey or defining type), or a record which passes a wildcard type with optional bounds
|
|
34
|
-
*/
|
|
35
|
-
export function passGenerics(generics) {
|
|
36
|
-
return mapJoin(generics, val => {
|
|
37
|
-
if (typeof val === "object" && val) {
|
|
38
|
-
const key = Object.keys(val)[0];
|
|
39
|
-
if (key === "?") {
|
|
40
|
-
// @ts-expect-error Key is ? in this case
|
|
41
|
-
const value = val[key];
|
|
42
|
-
const extendsExpression = value ? code` extends ${value}` : "";
|
|
43
|
-
return [key, extendsExpression];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return val;
|
|
47
|
-
}, {
|
|
48
|
-
joiner: ", "
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=generics.js.map
|
package/dist/src/generics.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generics.js","names":["code","mapJoin","collectGenerics","generics","genericTypes","Map","Object","entries","key","value","extendsExpression","joiner","passGenerics","val","keys"],"sources":["../../src/generics.ts"],"sourcesContent":[null],"mappings":"AAAA,SAA0BA,IAAI,EAAEC,OAAO,QAAQ,gBAAgB;;AAE/D;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAACC,QAAkC,EAAE;EAClE,MAAMC,YAAY,GAAGH,OAAO,CAC1B,IAAII,GAAG,CAACC,MAAM,CAACC,OAAO,CAACJ,QAAQ,CAAC,CAAC,EACjC,CAACK,GAAG,EAAEC,KAAK,KAAK;IACd,MAAMC,iBAAiB,GAAGD,KAAK,GAAGT,IAAI,YAAYS,KAAK,EAAE,GAAG,EAAE;IAC9D,OAAO,CAACD,GAAG,EAAEE,iBAAiB,CAAC;EACjC,CAAC,EACD;IACEC,MAAM,EAAE;EACV,CACF,CAAC;EACD,OAAOX,IAAI,IAAII,YAAY,GAAG;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,YAAYA,CAACT,QAA2C,EAAE;EACxE,OAAOF,OAAO,CACZE,QAAQ,EACPU,GAAG,IAAK;IACP,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAIA,GAAG,EAAE;MAClC,MAAML,GAAG,GAAGF,MAAM,CAACQ,IAAI,CAACD,GAAG,CAAC,CAAC,CAAC,CAAC;MAC/B,IAAIL,GAAG,KAAK,GAAG,EAAE;QACf;QACA,MAAMC,KAAK,GAAGI,GAAG,CAACL,GAAG,CAAC;QACtB,MAAME,iBAAiB,GAAGD,KAAK,GAAGT,IAAI,YAAYS,KAAK,EAAE,GAAG,EAAE;QAC9D,OAAO,CAACD,GAAG,EAAEE,iBAAiB,CAAC;MACjC;IACF;IACA,OAAOG,GAAG;EACZ,CAAC,EACD;IAAEF,MAAM,EAAE;EAAK,CACjB,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object-modifiers.d.ts","sourceRoot":"","sources":["../../src/object-modifiers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,eAAe,EAAE,KAAK,EAAE,CAAC,UAuBnE"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Objects extend this interface to allow to take modifiers as boolean props.
|
|
3
|
-
* Then can declare components like so
|
|
4
|
-
*
|
|
5
|
-
* `<Class public final abstract />`
|
|
6
|
-
*
|
|
7
|
-
* Error will be thrown if try to specify multiple access modifiers
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export function collectModifiers(props) {
|
|
11
|
-
const modifiers = [];
|
|
12
|
-
|
|
13
|
-
// If more than one access modifier is specified, throw an error
|
|
14
|
-
if ([props.public, props.protected, props.private].filter(Boolean).length > 1) {
|
|
15
|
-
throw new Error("Cannot specify multiple access modifiers");
|
|
16
|
-
}
|
|
17
|
-
if (props.public) modifiers.push("public");
|
|
18
|
-
if (props.protected) modifiers.push("protected");
|
|
19
|
-
if (props.private) modifiers.push("private");
|
|
20
|
-
if (props.abstract) modifiers.push("abstract");
|
|
21
|
-
if (props.static) modifiers.push("static");
|
|
22
|
-
if (props.synchronized) modifiers.push("synchronized");
|
|
23
|
-
if (props.transient) modifiers.push("transient");
|
|
24
|
-
if (props.volatile) modifiers.push("volatile");
|
|
25
|
-
if (props.final) modifiers.push("final");
|
|
26
|
-
if (props.default) modifiers.push("default");
|
|
27
|
-
if (props.native) modifiers.push("native");
|
|
28
|
-
if (props.strictfp) modifiers.push("strictfp");
|
|
29
|
-
return modifiers.join(" ") + (modifiers.length > 0 ? " " : "");
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=object-modifiers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object-modifiers.js","names":["collectModifiers","props","modifiers","public","protected","private","filter","Boolean","length","Error","push","abstract","static","synchronized","transient","volatile","final","default","native","strictfp","join"],"sources":["../../src/object-modifiers.ts"],"sourcesContent":[null],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA,OAAO,SAASA,gBAAgBA,CAA4BC,KAAQ,EAAE;EACpE,MAAMC,SAAS,GAAG,EAAE;;EAEpB;EACA,IACE,CAACD,KAAK,CAACE,MAAM,EAAEF,KAAK,CAACG,SAAS,EAAEH,KAAK,CAACI,OAAO,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,MAAM,GAAG,CAAC,EACzE;IACA,MAAM,IAAIC,KAAK,CAAC,0CAA0C,CAAC;EAC7D;EAEA,IAAIR,KAAK,CAACE,MAAM,EAAED,SAAS,CAACQ,IAAI,CAAC,QAAQ,CAAC;EAC1C,IAAIT,KAAK,CAACG,SAAS,EAAEF,SAAS,CAACQ,IAAI,CAAC,WAAW,CAAC;EAChD,IAAIT,KAAK,CAACI,OAAO,EAAEH,SAAS,CAACQ,IAAI,CAAC,SAAS,CAAC;EAC5C,IAAIT,KAAK,CAACU,QAAQ,EAAET,SAAS,CAACQ,IAAI,CAAC,UAAU,CAAC;EAC9C,IAAIT,KAAK,CAACW,MAAM,EAAEV,SAAS,CAACQ,IAAI,CAAC,QAAQ,CAAC;EAC1C,IAAIT,KAAK,CAACY,YAAY,EAAEX,SAAS,CAACQ,IAAI,CAAC,cAAc,CAAC;EACtD,IAAIT,KAAK,CAACa,SAAS,EAAEZ,SAAS,CAACQ,IAAI,CAAC,WAAW,CAAC;EAChD,IAAIT,KAAK,CAACc,QAAQ,EAAEb,SAAS,CAACQ,IAAI,CAAC,UAAU,CAAC;EAC9C,IAAIT,KAAK,CAACe,KAAK,EAAEd,SAAS,CAACQ,IAAI,CAAC,OAAO,CAAC;EACxC,IAAIT,KAAK,CAACgB,OAAO,EAAEf,SAAS,CAACQ,IAAI,CAAC,SAAS,CAAC;EAC5C,IAAIT,KAAK,CAACiB,MAAM,EAAEhB,SAAS,CAACQ,IAAI,CAAC,QAAQ,CAAC;EAC1C,IAAIT,KAAK,CAACkB,QAAQ,EAAEjB,SAAS,CAACQ,IAAI,CAAC,UAAU,CAAC;EAC9C,OAAOR,SAAS,CAACkB,IAAI,CAAC,GAAG,CAAC,IAAIlB,SAAS,CAACM,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AAChE","ignoreList":[]}
|
package/dist/test/generics.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generics.d.ts","sourceRoot":"","sources":["../../test/generics.tsx"],"names":[],"mappings":""}
|
package/dist/test/maven.d.ts
DELETED
package/dist/test/maven.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"maven.d.ts","sourceRoot":"","sources":["../../test/maven.tsx"],"names":[],"mappings":""}
|
package/src/arguments.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Children, mapJoin } from "@alloy-js/core";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Collect a set of arguments to be passed to a method, class init.
|
|
5
|
-
* Can take single child, or array of children
|
|
6
|
-
*
|
|
7
|
-
* @param args - Children to collect
|
|
8
|
-
*/
|
|
9
|
-
export function collectArguments(args: Children): Children {
|
|
10
|
-
return Array.isArray(args) ?
|
|
11
|
-
mapJoin(args, (val) => val, { joiner: ", " })
|
|
12
|
-
: args;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Collect a set of named arguments. Will pass to object as named arguments.
|
|
17
|
-
*
|
|
18
|
-
* @param args - of name to argument value
|
|
19
|
-
*/
|
|
20
|
-
export function collectNamedArguments(
|
|
21
|
-
args: Record<string, Children>,
|
|
22
|
-
): Children {
|
|
23
|
-
return mapJoin(
|
|
24
|
-
new Map(Object.entries(args)),
|
|
25
|
-
(key, value) => {
|
|
26
|
-
return [key, " = ", value];
|
|
27
|
-
},
|
|
28
|
-
{ joiner: ", " },
|
|
29
|
-
);
|
|
30
|
-
}
|