@alloy-js/java 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.
Files changed (232) hide show
  1. package/LICENSE.txt +7 -0
  2. package/api-extractor.json +4 -0
  3. package/babel.config.cjs +4 -0
  4. package/dist/src/arguments.d.ts +15 -0
  5. package/dist/src/arguments.d.ts.map +1 -0
  6. package/dist/src/arguments.js +27 -0
  7. package/dist/src/arguments.js.map +1 -0
  8. package/dist/src/builtins/index.d.ts +2 -0
  9. package/dist/src/builtins/index.d.ts.map +1 -0
  10. package/dist/src/builtins/index.js +1 -0
  11. package/dist/src/builtins/index.js.map +1 -0
  12. package/dist/src/builtins/util.d.ts +4 -0
  13. package/dist/src/builtins/util.d.ts.map +1 -0
  14. package/dist/src/builtins/util.js +10 -0
  15. package/dist/src/builtins/util.js.map +1 -0
  16. package/dist/src/components/Annotation.d.ts +11 -0
  17. package/dist/src/components/Annotation.d.ts.map +1 -0
  18. package/dist/src/components/Annotation.js +12 -0
  19. package/dist/src/components/Annotation.js.map +1 -0
  20. package/dist/src/components/Block.d.ts +6 -0
  21. package/dist/src/components/Block.d.ts.map +1 -0
  22. package/dist/src/components/Block.js +4 -0
  23. package/dist/src/components/Block.js.map +1 -0
  24. package/dist/src/components/Class.d.ts +10 -0
  25. package/dist/src/components/Class.d.ts.map +1 -0
  26. package/dist/src/components/Class.js +36 -0
  27. package/dist/src/components/Class.js.map +1 -0
  28. package/dist/src/components/Constructor.d.ts +13 -0
  29. package/dist/src/components/Constructor.d.ts.map +1 -0
  30. package/dist/src/components/Constructor.js +23 -0
  31. package/dist/src/components/Constructor.js.map +1 -0
  32. package/dist/src/components/Declaration.d.ts +12 -0
  33. package/dist/src/components/Declaration.d.ts.map +1 -0
  34. package/dist/src/components/Declaration.js +18 -0
  35. package/dist/src/components/Declaration.js.map +1 -0
  36. package/dist/src/components/Enum.d.ts +13 -0
  37. package/dist/src/components/Enum.d.ts.map +1 -0
  38. package/dist/src/components/Enum.js +38 -0
  39. package/dist/src/components/Enum.js.map +1 -0
  40. package/dist/src/components/Generics.d.ts +6 -0
  41. package/dist/src/components/Generics.d.ts.map +1 -0
  42. package/dist/src/components/Generics.js +8 -0
  43. package/dist/src/components/Generics.js.map +1 -0
  44. package/dist/src/components/ImportStatement.d.ts +11 -0
  45. package/dist/src/components/ImportStatement.d.ts.map +1 -0
  46. package/dist/src/components/ImportStatement.js +9 -0
  47. package/dist/src/components/ImportStatement.js.map +1 -0
  48. package/dist/src/components/Interface.d.ts +9 -0
  49. package/dist/src/components/Interface.d.ts.map +1 -0
  50. package/dist/src/components/Interface.js +35 -0
  51. package/dist/src/components/Interface.js.map +1 -0
  52. package/dist/src/components/MavenProject.d.ts +13 -0
  53. package/dist/src/components/MavenProject.d.ts.map +1 -0
  54. package/dist/src/components/MavenProject.js +159 -0
  55. package/dist/src/components/MavenProject.js.map +1 -0
  56. package/dist/src/components/Method.d.ts +11 -0
  57. package/dist/src/components/Method.d.ts.map +1 -0
  58. package/dist/src/components/Method.js +25 -0
  59. package/dist/src/components/Method.js.map +1 -0
  60. package/dist/src/components/Name.d.ts +2 -0
  61. package/dist/src/components/Name.d.ts.map +1 -0
  62. package/dist/src/components/Name.js +10 -0
  63. package/dist/src/components/Name.js.map +1 -0
  64. package/dist/src/components/ObjectDeclaration.d.ts +13 -0
  65. package/dist/src/components/ObjectDeclaration.d.ts.map +1 -0
  66. package/dist/src/components/ObjectDeclaration.js +17 -0
  67. package/dist/src/components/ObjectDeclaration.js.map +1 -0
  68. package/dist/src/components/PackageDirectory.d.ts +16 -0
  69. package/dist/src/components/PackageDirectory.d.ts.map +1 -0
  70. package/dist/src/components/PackageDirectory.js +58 -0
  71. package/dist/src/components/PackageDirectory.js.map +1 -0
  72. package/dist/src/components/Parameters.d.ts +11 -0
  73. package/dist/src/components/Parameters.d.ts.map +1 -0
  74. package/dist/src/components/Parameters.js +17 -0
  75. package/dist/src/components/Parameters.js.map +1 -0
  76. package/dist/src/components/ProjectDirectory.d.ts +23 -0
  77. package/dist/src/components/ProjectDirectory.d.ts.map +1 -0
  78. package/dist/src/components/ProjectDirectory.js +42 -0
  79. package/dist/src/components/ProjectDirectory.js.map +1 -0
  80. package/dist/src/components/Reference.d.ts +6 -0
  81. package/dist/src/components/Reference.d.ts.map +1 -0
  82. package/dist/src/components/Reference.js +6 -0
  83. package/dist/src/components/Reference.js.map +1 -0
  84. package/dist/src/components/SourceFile.d.ts +17 -0
  85. package/dist/src/components/SourceFile.d.ts.map +1 -0
  86. package/dist/src/components/SourceFile.js +70 -0
  87. package/dist/src/components/SourceFile.js.map +1 -0
  88. package/dist/src/components/Value.d.ts +5 -0
  89. package/dist/src/components/Value.d.ts.map +1 -0
  90. package/dist/src/components/Value.js +17 -0
  91. package/dist/src/components/Value.js.map +1 -0
  92. package/dist/src/components/Variable.d.ts +9 -0
  93. package/dist/src/components/Variable.d.ts.map +1 -0
  94. package/dist/src/components/Variable.js +9 -0
  95. package/dist/src/components/Variable.js.map +1 -0
  96. package/dist/src/components/index.d.ts +21 -0
  97. package/dist/src/components/index.d.ts.map +1 -0
  98. package/dist/src/components/index.js +21 -0
  99. package/dist/src/components/index.js.map +1 -0
  100. package/dist/src/components/stc/index.d.ts +86 -0
  101. package/dist/src/components/stc/index.d.ts.map +1 -0
  102. package/dist/src/components/stc/index.js +24 -0
  103. package/dist/src/components/stc/index.js.map +1 -0
  104. package/dist/src/create-library.d.ts +15 -0
  105. package/dist/src/create-library.d.ts.map +1 -0
  106. package/dist/src/create-library.js +34 -0
  107. package/dist/src/create-library.js.map +1 -0
  108. package/dist/src/generics.d.ts +28 -0
  109. package/dist/src/generics.d.ts.map +1 -0
  110. package/dist/src/generics.js +51 -0
  111. package/dist/src/generics.js.map +1 -0
  112. package/dist/src/index.d.ts +9 -0
  113. package/dist/src/index.d.ts.map +1 -0
  114. package/dist/src/index.js +9 -0
  115. package/dist/src/index.js.map +1 -0
  116. package/dist/src/name-policy.d.ts +5 -0
  117. package/dist/src/name-policy.d.ts.map +1 -0
  118. package/dist/src/name-policy.js +21 -0
  119. package/dist/src/name-policy.js.map +1 -0
  120. package/dist/src/object-modifiers.d.ts +24 -0
  121. package/dist/src/object-modifiers.d.ts.map +1 -0
  122. package/dist/src/object-modifiers.js +31 -0
  123. package/dist/src/object-modifiers.js.map +1 -0
  124. package/dist/src/symbols/index.d.ts +6 -0
  125. package/dist/src/symbols/index.d.ts.map +1 -0
  126. package/dist/src/symbols/index.js +6 -0
  127. package/dist/src/symbols/index.js.map +1 -0
  128. package/dist/src/symbols/java-output-symbol.d.ts +14 -0
  129. package/dist/src/symbols/java-output-symbol.d.ts.map +1 -0
  130. package/dist/src/symbols/java-output-symbol.js +21 -0
  131. package/dist/src/symbols/java-output-symbol.js.map +1 -0
  132. package/dist/src/symbols/java-package-scope.d.ts +6 -0
  133. package/dist/src/symbols/java-package-scope.d.ts.map +1 -0
  134. package/dist/src/symbols/java-package-scope.js +8 -0
  135. package/dist/src/symbols/java-package-scope.js.map +1 -0
  136. package/dist/src/symbols/java-project-scope.d.ts +67 -0
  137. package/dist/src/symbols/java-project-scope.d.ts.map +1 -0
  138. package/dist/src/symbols/java-project-scope.js +29 -0
  139. package/dist/src/symbols/java-project-scope.js.map +1 -0
  140. package/dist/src/symbols/reference.d.ts +8 -0
  141. package/dist/src/symbols/reference.d.ts.map +1 -0
  142. package/dist/src/symbols/reference.js +21 -0
  143. package/dist/src/symbols/reference.js.map +1 -0
  144. package/dist/src/symbols/scopes.d.ts +4 -0
  145. package/dist/src/symbols/scopes.d.ts.map +1 -0
  146. package/dist/src/symbols/scopes.js +1 -0
  147. package/dist/src/symbols/scopes.js.map +1 -0
  148. package/dist/test/annotation.test.d.ts +2 -0
  149. package/dist/test/annotation.test.d.ts.map +1 -0
  150. package/dist/test/class.test.d.ts +2 -0
  151. package/dist/test/class.test.d.ts.map +1 -0
  152. package/dist/test/constructor.test.d.ts +2 -0
  153. package/dist/test/constructor.test.d.ts.map +1 -0
  154. package/dist/test/enum.test.d.ts +2 -0
  155. package/dist/test/enum.test.d.ts.map +1 -0
  156. package/dist/test/externals.test.d.ts +2 -0
  157. package/dist/test/externals.test.d.ts.map +1 -0
  158. package/dist/test/generics.d.ts +2 -0
  159. package/dist/test/generics.d.ts.map +1 -0
  160. package/dist/test/interface.test.d.ts +2 -0
  161. package/dist/test/interface.test.d.ts.map +1 -0
  162. package/dist/test/maven.d.ts +2 -0
  163. package/dist/test/maven.d.ts.map +1 -0
  164. package/dist/test/method.test.d.ts +2 -0
  165. package/dist/test/method.test.d.ts.map +1 -0
  166. package/dist/test/package.test.d.ts +2 -0
  167. package/dist/test/package.test.d.ts.map +1 -0
  168. package/dist/test/reference.test.d.ts +2 -0
  169. package/dist/test/reference.test.d.ts.map +1 -0
  170. package/dist/test/utils.d.ts +6 -0
  171. package/dist/test/utils.d.ts.map +1 -0
  172. package/dist/test/values.test.d.ts +2 -0
  173. package/dist/test/values.test.d.ts.map +1 -0
  174. package/dist/test/variables.test.d.ts +2 -0
  175. package/dist/test/variables.test.d.ts.map +1 -0
  176. package/dist/tsconfig.tsbuildinfo +1 -0
  177. package/package.json +49 -0
  178. package/src/arguments.ts +30 -0
  179. package/src/builtins/index.ts +1 -0
  180. package/src/builtins/util.ts +117 -0
  181. package/src/components/Annotation.tsx +23 -0
  182. package/src/components/Block.tsx +8 -0
  183. package/src/components/Class.tsx +33 -0
  184. package/src/components/Constructor.tsx +25 -0
  185. package/src/components/Declaration.tsx +24 -0
  186. package/src/components/Enum.tsx +40 -0
  187. package/src/components/Generics.tsx +12 -0
  188. package/src/components/ImportStatement.tsx +21 -0
  189. package/src/components/Interface.tsx +31 -0
  190. package/src/components/MavenProject.tsx +151 -0
  191. package/src/components/Method.tsx +31 -0
  192. package/src/components/Name.tsx +10 -0
  193. package/src/components/ObjectDeclaration.tsx +22 -0
  194. package/src/components/PackageDirectory.tsx +84 -0
  195. package/src/components/Parameters.tsx +21 -0
  196. package/src/components/ProjectDirectory.tsx +76 -0
  197. package/src/components/Reference.tsx +12 -0
  198. package/src/components/SourceFile.tsx +84 -0
  199. package/src/components/Value.tsx +22 -0
  200. package/src/components/Variable.tsx +16 -0
  201. package/src/components/index.ts +20 -0
  202. package/src/components/stc/index.ts +24 -0
  203. package/src/create-library.ts +67 -0
  204. package/src/generics.ts +59 -0
  205. package/src/index.ts +8 -0
  206. package/src/name-policy.ts +33 -0
  207. package/src/object-modifiers.ts +48 -0
  208. package/src/symbols/index.ts +5 -0
  209. package/src/symbols/java-output-symbol.ts +30 -0
  210. package/src/symbols/java-package-scope.ts +17 -0
  211. package/src/symbols/java-project-scope.ts +104 -0
  212. package/src/symbols/reference.ts +24 -0
  213. package/src/symbols/scopes.ts +4 -0
  214. package/temp/api.json +5805 -0
  215. package/test/annotation.test.tsx +56 -0
  216. package/test/class.test.tsx +133 -0
  217. package/test/constructor.test.tsx +96 -0
  218. package/test/enum.test.tsx +105 -0
  219. package/test/externals.test.tsx +46 -0
  220. package/test/generics.tsx +58 -0
  221. package/test/interface.test.tsx +84 -0
  222. package/test/maven.tsx +261 -0
  223. package/test/method.test.tsx +162 -0
  224. package/test/package.test.tsx +18 -0
  225. package/test/reference.test.tsx +88 -0
  226. package/test/utils.tsx +72 -0
  227. package/test/values.test.tsx +29 -0
  228. package/test/variables.test.tsx +101 -0
  229. package/test/vitest.d.ts +10 -0
  230. package/tsconfig.json +11 -0
  231. package/tsdoc-metadata.json +11 -0
  232. package/vitest.config.ts +18 -0
@@ -0,0 +1,159 @@
1
+ import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
2
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
3
+ import { code, Indent, SourceFile } from "@alloy-js/core";
4
+ import { useProject } from "./ProjectDirectory.js";
5
+ /**
6
+ * Represents a maven project. Use if you want to generate a Java project
7
+ */
8
+ export function MavenProject(props) {
9
+ return _$createComponent(PomFile, {
10
+ get projectConfig() {
11
+ return props.projectConfig;
12
+ }
13
+ });
14
+ }
15
+ export function PomFile({
16
+ projectConfig
17
+ }) {
18
+ const scope = useProject().scope;
19
+
20
+ // The following spaghetti mess is so the final output is formatted correctly.
21
+ // Needs to be this way for when some options aren't provided, there's no random whitespace,
22
+ // and so that looped sections are indented correctly.
23
+ return _$createComponent(SourceFile, {
24
+ path: "pom.xml",
25
+ filetype: "xml",
26
+ get children() {
27
+ return code`
28
+ <?xml version="1.0" encoding="UTF-8"?>
29
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
30
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
31
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
32
+
33
+ ${_$createComponent(Indent, {
34
+ get children() {
35
+ return code`
36
+ <modelVersion>4.0.0</modelVersion>
37
+ <groupId>${projectConfig.groupId}</groupId>
38
+ <artifactId>${projectConfig.artifactId}</artifactId>
39
+ <version>${projectConfig.version}</version>
40
+
41
+ <properties>
42
+ <maven.compiler.source>${projectConfig?.javaVersion}</maven.compiler.source>
43
+ <maven.compiler.target>${projectConfig?.javaVersion}</maven.compiler.target>
44
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
45
+ </properties>
46
+ `;
47
+ }
48
+ })}${projectConfig?.repositories && code`
49
+
50
+
51
+ <repositories>${projectConfig?.repositories.map(repo => code`
52
+
53
+ <repository>
54
+ <id>${repo.id}</id>
55
+ <url>${repo.url}</url>
56
+ </repository>
57
+ `)}
58
+ </repositories>
59
+ `}${_$createComponent(Indent, {
60
+ get children() {
61
+ return _$memo(() => !!projectConfig?.pluginRepositories)() && code`
62
+
63
+
64
+ <pluginRepositories>${projectConfig?.pluginRepositories.map(repo => code`
65
+
66
+ <pluginRepository>
67
+ <id>${repo.id}</id>
68
+ <url>${repo.url}</url>
69
+ </pluginRepository>
70
+ `)}
71
+ </pluginRepositories>
72
+ `;
73
+ }
74
+ })}${scope.dependencies.size > 0 ? code`
75
+
76
+
77
+ <dependencies>${Array.from(scope.dependencies.values()).map(dep => code`
78
+
79
+ <dependency>
80
+ <groupId>${dep.groupId}</groupId>
81
+ <artifactId>${dep.artifactId}</artifactId>
82
+ ${dep.version !== undefined ? `<version>${dep.version}</version>` : undefined}
83
+ <scope>${dep.scope ?? "provided"}</scope>
84
+ </dependency>
85
+ `)}
86
+ </dependencies>
87
+ ` : undefined}${projectConfig?.build && code`
88
+
89
+
90
+ <build>
91
+ ${projectConfig?.build?.plugins && code`
92
+ <plugins>${projectConfig?.build?.plugins.map(plugin => code`
93
+
94
+ <plugin>
95
+ <groupId>${plugin.groupId}</groupId>
96
+ <artifactId>${plugin.artifactId}</artifactId>
97
+ ${plugin.version !== undefined ? `<version>${plugin.version}</version>` : undefined}
98
+ ${plugin.executions && code`
99
+ <executions>${plugin.executions.map(execution => code`
100
+
101
+ <execution>
102
+ ${execution.id ? `<id>${execution.id}</id>` : undefined}
103
+ ${execution.phase ? `<phase>${execution.phase}</phase>` : undefined}
104
+ ${execution.goals && code`
105
+ <goals>${execution.goals.map(goal => code`
106
+
107
+ <goal>${goal}</goal>
108
+ `)}
109
+ </goals>
110
+ `}
111
+ </execution>
112
+ `)}
113
+ </executions>
114
+ `}${plugin.configuration && code`
115
+
116
+ <configuration>${Object.entries(plugin.configuration).map(([key, value]) => code`
117
+
118
+ <${key}>${value}</${key}>
119
+ `)}
120
+ </configuration>
121
+ `}
122
+ </plugin>
123
+ `)}
124
+ </plugins>
125
+ `}${projectConfig?.build?.resources && code`
126
+
127
+ <resources>${projectConfig?.build?.resources.map(resource => code`
128
+
129
+ <resource>
130
+ <directory>${resource.directory}</directory>${resource.includes && code`
131
+
132
+ <includes>${resource.includes.map(include => code`
133
+
134
+ <include>${include}</include>
135
+ `)}
136
+ </includes>
137
+ `}${resource.excludes && code`
138
+
139
+ <excludes>${resource.excludes.map(exclude => code`
140
+
141
+ <exclude>${exclude}</exclude>
142
+ `)}
143
+ </excludes>
144
+ `}${resource.filtering !== undefined ? `
145
+ <filtering>${resource.filtering}</filtering>` : undefined}${resource.targetPath !== undefined ? `
146
+ <targetPath>${resource.targetPath}</targetPath>` : undefined}
147
+ </resource>
148
+ `)}
149
+ </resources>
150
+ `}
151
+ </build>
152
+ `}
153
+
154
+ </project>
155
+ `;
156
+ }
157
+ });
158
+ }
159
+ //# sourceMappingURL=MavenProject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MavenProject.js","names":["code","Indent","SourceFile","useProject","MavenProject","props","_$createComponent","PomFile","projectConfig","scope","path","filetype","children","groupId","artifactId","version","javaVersion","repositories","map","repo","id","url","_$memo","pluginRepositories","dependencies","size","Array","from","values","dep","undefined","build","plugins","plugin","executions","execution","phase","goals","goal","configuration","Object","entries","key","value","resources","resource","directory","includes","include","excludes","exclude","filtering","targetPath"],"sources":["../../../src/components/MavenProject.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAASA,IAAI,EAAEC,MAAM,EAAEC,UAAU,QAAQ,gBAAgB;AAEzD,SAASC,UAAU,QAAQ,uBAAuB;AAMlD;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,KAAwB,EAAE;EACrD,OAAAC,iBAAA,CAAQC,OAAO;IAAA,IAACC,aAAaA,CAAA;MAAA,OAAEH,KAAK,CAACG,aAAa;IAAA;EAAA;AACpD;AAMA,OAAO,SAASD,OAAOA,CAAC;EAAEC;AAA4B,CAAC,EAAE;EACvD,MAAMC,KAAK,GAAGN,UAAU,CAAC,CAAC,CAACM,KAAK;;EAEhC;EACA;EACA;EACA,OAAAH,iBAAA,CAAQJ,UAAU;IAACQ,IAAI;IAAWC,QAAQ;IAAA,IAAAC,SAAA;MAAA,OACrCZ,IAAI;AACX;AACA;AACA;AACA;AACA;AACA,aANWM,iBAAA,CAMGL,MAAM;QAAA,IAAAW,SAAA;UAAA,OACLZ,IAAI;AACnB;AACA,2BAA2BQ,aAAa,CAACK,OAAO;AAChD,8BAA8BL,aAAa,CAACM,UAAU;AACtD,2BAA2BN,aAAa,CAACO,OAAO;AAChD;AAC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,IAAI;AACzD;AACA,6BAA6BQ,aAAa,EAAEuB,KAAK,EAAEa,SAAS,CAAC1B,GAAG,CAAC2B,QAAQ,IAAI7C,IAAI;AACjF;AACA;AACA,mCAAmC6C,QAAQ,CAACC,SAAS,eAAeD,QAAQ,CAACE,QAAQ,IAAI/C,IAAI;AAC7F;AACA,oCAAoC6C,QAAQ,CAACE,QAAQ,CAAC7B,GAAG,CAAC8B,OAAO,IAAIhD,IAAI;AACzE;AACA,uCAAuCgD,OAAO;AAC9C,2BAA2B,CAAC;AAC5B;AACA,uBAAuB,GAAGH,QAAQ,CAACI,QAAQ,IAAIjD,IAAI;AACnD;AACA,oCAAoC6C,QAAQ,CAACI,QAAQ,CAAC/B,GAAG,CAACgC,OAAO,IAAIlD,IAAI;AACzE;AACA,uCAAuCkD,OAAO;AAC9C,2BAA2B,CAAC;AAC5B;AACA,uBAAuB,GAAGL,QAAQ,CAACM,SAAS,KAAKrB,SAAS,GAAG;AAC7D,aAAae,QAAQ,CAACM,SAAS,cAAc,GAAGrB,SAAS,GAAGe,QAAQ,CAACO,UAAU,KAAKtB,SAAS,GAAG;AAChG,cAAce,QAAQ,CAACO,UAAU,eAAe,GAAGtB,SAAS;AAC5D;AACA,mBAAmB,CAAC;AACpB;AACA,eAAe;AACf;AACA,WAAW;AACX;AACA;AACA,OAAO;IAAA;EAAA;AAEP","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { Children } from "@alloy-js/core";
2
+ import { GenericTypes } from "../generics.js";
3
+ import { ObjectModifiers } from "../object-modifiers.js";
4
+ export interface MethodProps extends ObjectModifiers, GenericTypes {
5
+ name: string;
6
+ return?: Children;
7
+ parameters?: Record<string, Children>;
8
+ children?: Children;
9
+ }
10
+ export declare function Method(props: MethodProps): import("@alloy-js/core").Child[];
11
+ //# sourceMappingURL=Method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Method.d.ts","sourceRoot":"","sources":["../../../src/components/Method.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAmB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAoB,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG3E,MAAM,WAAW,WAAY,SAAQ,eAAe,EAAE,YAAY;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,oCAiBxC"}
@@ -0,0 +1,25 @@
1
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { code } from "@alloy-js/core";
3
+ import { collectGenerics } from "../generics.js";
4
+ import { useJavaNamePolicy } from "../name-policy.js";
5
+ import { collectModifiers } from "../object-modifiers.js";
6
+ import { Parameters } from "./Parameters.js";
7
+ export function Method(props) {
8
+ const params = _$createComponent(Parameters, {
9
+ get parameters() {
10
+ return props.parameters;
11
+ }
12
+ });
13
+ const name = useJavaNamePolicy().getName(props.name, "method");
14
+ const modifiers = collectModifiers(props);
15
+ const generics = props.generics ? code`${collectGenerics(props.generics)}${" "}` : "";
16
+ const sBody = props.children !== undefined ? code`
17
+ ${" "}{
18
+ ${props.children}
19
+ }
20
+ ` : ";";
21
+ return code`
22
+ ${modifiers}${generics}${props.return ?? "void"} ${name}(${params})${sBody}
23
+ `;
24
+ }
25
+ //# sourceMappingURL=Method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Method.js","names":["code","collectGenerics","useJavaNamePolicy","collectModifiers","Parameters","Method","props","params","_$createComponent","parameters","name","getName","modifiers","generics","sBody","children","undefined","return"],"sources":["../../../src/components/Method.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAAmBA,IAAI,QAAQ,gBAAgB;AAC/C,SAASC,eAAe,QAAsB,gBAAgB;AAC9D,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,gBAAgB,QAAyB,wBAAwB;AAC1E,SAASC,UAAU,QAAQ,iBAAiB;AAS5C,OAAO,SAASC,MAAMA,CAACC,KAAkB,EAAE;EACzC,MAAMC,MAAM,GAAAC,iBAAA,CAAIJ,UAAU;IAAA,IAACK,UAAUA,CAAA;MAAA,OAAEH,KAAK,CAACG,UAAU;IAAA;EAAA,EAAe;EACtE,MAAMC,IAAI,GAAGR,iBAAiB,CAAC,CAAC,CAACS,OAAO,CAACL,KAAK,CAACI,IAAI,EAAE,QAAQ,CAAC;EAC9D,MAAME,SAAS,GAAGT,gBAAgB,CAACG,KAAK,CAAC;EACzC,MAAMO,QAAQ,GAAGP,KAAK,CAACO,QAAQ,GAC7Bb,IAAI,GAAGC,eAAe,CAACK,KAAK,CAACO,QAAQ,CAAC,GAAG,GAAG,EAAE,GAC9C,EAAE;EACJ,MAAMC,KAAK,GAAGR,KAAK,CAACS,QAAQ,KAAKC,SAAS,GACxChB,IAAI;AACR,MAAM,GAAG;AACT,QAAQM,KAAK,CAACS,QAAQ;AACtB;AACA,GAAG,GACC,GAAG;EACL,OAAOf,IAAI;AACb,UAAUY,SAAS,GAAGC,QAAQ,GAAGP,KAAK,CAACW,MAAM,IAAI,MAAM,IAAIP,IAAI,IAAIH,MAAM,IAAIO,KAAK;AAClF,KAAK;AACL","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export declare function Name(): any;
2
+ //# sourceMappingURL=Name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Name.d.ts","sourceRoot":"","sources":["../../../src/components/Name.tsx"],"names":[],"mappings":"AAEA,wBAAgB,IAAI,QAOnB"}
@@ -0,0 +1,10 @@
1
+ import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
2
+ import { DeclarationContext, useContext } from "@alloy-js/core";
3
+ export function Name() {
4
+ const declSymbol = useContext(DeclarationContext);
5
+ if (!declSymbol) {
6
+ return "";
7
+ }
8
+ return _$memo(() => declSymbol.name);
9
+ }
10
+ //# sourceMappingURL=Name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Name.js","names":["DeclarationContext","useContext","Name","declSymbol","_$memo","name"],"sources":["../../../src/components/Name.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,kBAAkB,EAAEC,UAAU,QAAQ,gBAAgB;AAE/D,OAAO,SAASC,IAAIA,CAAA,EAAG;EACrB,MAAMC,UAAU,GAAGF,UAAU,CAACD,kBAAkB,CAAC;EACjD,IAAI,CAACG,UAAU,EAAE;IACf,OAAO,EAAE;EACX;EAEA,OAAAC,MAAA,OAAUD,UAAU,CAACE,IAAI;AAC3B","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import { Children } from "@alloy-js/core";
2
+ import { ObjectModifiers } from "../object-modifiers.js";
3
+ import { DeclarationProps } from "./Declaration.js";
4
+ export interface ObjectDeclarationProps extends DeclarationProps, ObjectModifiers {
5
+ type: Children;
6
+ arguments?: Children;
7
+ }
8
+ /**
9
+ * Shorthand to instantiate a new object.
10
+ * Declares it with 'new' and passes arguments to the constructor of the object, if any
11
+ */
12
+ export declare function ObjectDeclaration(props: ObjectDeclarationProps): any;
13
+ //# sourceMappingURL=ObjectDeclaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/ObjectDeclaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,MAAM,WAAW,sBACf,SAAQ,gBAAgB,EACtB,eAAe;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,CAAC,EAAE,QAAQ,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,OAI9D"}
@@ -0,0 +1,17 @@
1
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
3
+ import { code } from "@alloy-js/core";
4
+ import { collectArguments } from "../arguments.js";
5
+ import { Variable } from "./Variable.js";
6
+ /**
7
+ * Shorthand to instantiate a new object.
8
+ * Declares it with 'new' and passes arguments to the constructor of the object, if any
9
+ */
10
+ export function ObjectDeclaration(props) {
11
+ const args = props.arguments ? collectArguments(props.arguments) : "";
12
+ const value = code`new ${props.type}(${args})`;
13
+ return _$createComponent(Variable, _$mergeProps(props, {
14
+ value: value
15
+ }));
16
+ }
17
+ //# sourceMappingURL=ObjectDeclaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectDeclaration.js","names":["code","collectArguments","Variable","ObjectDeclaration","props","args","arguments","value","type","_$createComponent","_$mergeProps"],"sources":["../../../src/components/ObjectDeclaration.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAAmBA,IAAI,QAAQ,gBAAgB;AAC/C,SAASC,gBAAgB,QAAQ,iBAAiB;AAGlD,SAASC,QAAQ,QAAQ,eAAe;AASxC;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,KAA6B,EAAE;EAC/D,MAAMC,IAAI,GAAGD,KAAK,CAACE,SAAS,GAAGL,gBAAgB,CAACG,KAAK,CAACE,SAAS,CAAC,GAAG,EAAE;EACrE,MAAMC,KAAK,GAAGP,IAAI,OAAOI,KAAK,CAACI,IAAI,IAAIH,IAAI,GAAG;EAC9C,OAAAI,iBAAA,CAAQP,QAAQ,EAAAQ,YAAA,CAAKN,KAAK;IAAEG,KAAK,EAAEA;EAAK;AAC1C","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ import { Children, ComponentContext } from "@alloy-js/core";
2
+ import { JavaPackageScope } from "../symbols/java-package-scope.js";
3
+ export interface PackageDirectoryContext {
4
+ scope: JavaPackageScope;
5
+ path: string;
6
+ name: string;
7
+ qualifiedName: string;
8
+ }
9
+ export declare const PackageDirectoryContext: ComponentContext<PackageDirectoryContext>;
10
+ export declare function usePackage(): PackageDirectoryContext | undefined;
11
+ export interface PackageDirectoryProps {
12
+ package: string;
13
+ children?: Children;
14
+ }
15
+ export declare function PackageDirectory(props: PackageDirectoryProps): any;
16
+ //# sourceMappingURL=PackageDirectory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackageDirectory.d.ts","sourceRoot":"","sources":["../../../src/components/PackageDirectory.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAQjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,gBAAgB,EACjB,MAAM,kCAAkC,CAAC;AAE1C,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,gBAAgB,CAAC;IAExB,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,MAAM,CAAC;IAEb,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,uBAAuB,EAAE,gBAAgB,CAAC,uBAAuB,CAC7D,CAAC;AAElB,wBAAgB,UAAU,wCAEzB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,OA6C5D"}
@@ -0,0 +1,58 @@
1
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
3
+ import { createContext, Scope, SourceDirectory, SourceDirectoryContext, useBinder, useContext, useScope } from "@alloy-js/core";
4
+ import { createJavaPackageScope } from "../symbols/java-package-scope.js";
5
+ export const PackageDirectoryContext = createContext();
6
+ export function usePackage() {
7
+ return useContext(PackageDirectoryContext);
8
+ }
9
+ export function PackageDirectory(props) {
10
+ const sourceDirectory = useContext(SourceDirectoryContext);
11
+ const parentPackage = usePackage();
12
+ const packageNames = props.package.split(".");
13
+ const packageName = packageNames[0];
14
+ const fullyQualifiedPackageName = parentPackage ? parentPackage.qualifiedName + "." + packageName : packageName;
15
+ const scope = createJavaPackageScope(useBinder(), useScope(), fullyQualifiedPackageName);
16
+ const packagePath = sourceDirectory?.path + "/" + packageName;
17
+ const packageContext = {
18
+ scope,
19
+ path: packagePath,
20
+ name: packageName,
21
+ qualifiedName: fullyQualifiedPackageName
22
+ };
23
+
24
+ /**
25
+ * Recursively defines package directories if we pass name like 'one.two.three'
26
+ */
27
+ function ChildPackageDirectory() {
28
+ if (packageNames.length > 1) {
29
+ return _$createComponent(PackageDirectory, {
30
+ get ["package"]() {
31
+ return packageNames.slice(1, packageNames.length).join(".");
32
+ },
33
+ get children() {
34
+ return props.children;
35
+ }
36
+ });
37
+ } else {
38
+ return props.children;
39
+ }
40
+ }
41
+ return _$createComponent(PackageDirectoryContext.Provider, {
42
+ value: packageContext,
43
+ get children() {
44
+ return _$createComponent(Scope, {
45
+ value: scope,
46
+ get children() {
47
+ return _$createComponent(SourceDirectory, {
48
+ path: packageName,
49
+ get children() {
50
+ return _$createComponent(ChildPackageDirectory, {});
51
+ }
52
+ });
53
+ }
54
+ });
55
+ }
56
+ });
57
+ }
58
+ //# sourceMappingURL=PackageDirectory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackageDirectory.js","names":["createContext","Scope","SourceDirectory","SourceDirectoryContext","useBinder","useContext","useScope","createJavaPackageScope","PackageDirectoryContext","usePackage","PackageDirectory","props","sourceDirectory","parentPackage","packageNames","package","split","packageName","fullyQualifiedPackageName","qualifiedName","scope","packagePath","path","packageContext","name","ChildPackageDirectory","length","_$createComponent","slice","join","children","Provider","value"],"sources":["../../../src/components/PackageDirectory.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAGEA,aAAa,EACbC,KAAK,EACLC,eAAe,EACfC,sBAAsB,EACtBC,SAAS,E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AC,MAAM;MACL,OAAOnB,KAAK,CAACmB,QAAQ;IACvB;EACF;EAEA,OAAAH,iBAAA,CAAQnB,uBAAuB,CAACuB,QAAQ;IAACC,KAAK,EAAET,cAAc;IAAA,IAAAO,SAAA;MAAA,OAAAH,iBAAA,CACzD1B,KAAK;QAAC+B,KAAK,EAAEZ,KAAK;QAAA,IAAAU,SAAA;UAAA,OAAAH,iBAAA,CAChBzB,eAAe;YAACoB,IAAI,EAAEL,WAAW;YAAA,IAAAa,SAAA;cAAA,OAAAH,iBAAA,CAC/BF,qBAAqB;YAAA;UAAA;QAAA;MAAA;IAAA;EAAA;AAIhC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { Child } from "@alloy-js/core";
2
+ export interface ParametersProps {
3
+ parameters?: Record<string, Child>;
4
+ }
5
+ /**
6
+ * Render a set of parameters for a method or constructor
7
+ *
8
+ * @param props - Takes record of parameter name to type
9
+ */
10
+ export declare function Parameters(props: ParametersProps): (string | Child[])[];
11
+ //# 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,EAAE,KAAK,EAAW,MAAM,gBAAgB,CAAC;AAEhD,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,wBAShD"}
@@ -0,0 +1,17 @@
1
+ import { mapJoin } from "@alloy-js/core";
2
+ /**
3
+ * Render a set of parameters for a method or constructor
4
+ *
5
+ * @param props - Takes record of parameter name to type
6
+ */
7
+ export function Parameters(props) {
8
+ const {
9
+ parameters = {}
10
+ } = props;
11
+ return mapJoin(new Map(Object.entries(parameters)), (name, type) => {
12
+ return [type, " ", name];
13
+ }, {
14
+ joiner: ", "
15
+ });
16
+ }
17
+ //# sourceMappingURL=Parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Parameters.js","names":["mapJoin","Parameters","props","parameters","Map","Object","entries","name","type","joiner"],"sources":["../../../src/components/Parameters.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAgBA,OAAO,QAAQ,gBAAgB;AAM/C;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAACC,KAAsB,EAAE;EACjD,MAAM;IAAEC,UAAU,GAAG,CAAC;EAAE,CAAC,GAAGD,KAAK;EACjC,OAAOF,OAAO,CACZ,IAAII,GAAG,CAACC,MAAM,CAACC,OAAO,CAACH,UAAU,CAAC,CAAC,EACnC,CAACI,IAAI,EAAEC,IAAI,KAAK;IACd,OAAO,CAACA,IAAI,EAAE,GAAG,EAAED,IAAI,CAAC;EAC1B,CAAC,EACD;IAAEE,MAAM,EAAE;EAAK,CACjB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ import { Children, ComponentContext } from "@alloy-js/core";
2
+ import { GradleProjectConfig, JavaProjectScope, MavenProjectConfig } from "../symbols/index.js";
3
+ export interface ProjectContext {
4
+ scope: JavaProjectScope;
5
+ }
6
+ export declare const ProjectContext: ComponentContext<ProjectContext>;
7
+ export declare function useProject(): ProjectContext;
8
+ export interface ProjectDirectoryProps {
9
+ name: string;
10
+ /**
11
+ * Specify project configuration for either maven or gradle.
12
+ * If not specified, will create generic Java project
13
+ */
14
+ mavenProjectConfig?: MavenProjectConfig;
15
+ gradleProjectConfig?: GradleProjectConfig;
16
+ children?: Children;
17
+ }
18
+ /**
19
+ * Represents a java project directory. Use if you want to generate a Java project
20
+ * with a build tool included (maven, gradle etc).
21
+ */
22
+ export declare function ProjectDirectory(props: ProjectDirectoryProps): any;
23
+ //# 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,EACL,QAAQ,EACR,gBAAgB,EAOjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAED,eAAO,MAAM,cAAc,EAAE,gBAAgB,CAAC,cAAc,CAAmB,CAAC;AAEhF,wBAAgB,UAAU,mBAEzB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAE1C,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,OA8B5D"}
@@ -0,0 +1,42 @@
1
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
3
+ import { createContext, Scope, SourceDirectory, useBinder, useContext, useScope } from "@alloy-js/core";
4
+ import { createJavaProjectScope } from "../symbols/index.js";
5
+ import { MavenProject } from "./MavenProject.js";
6
+ export const ProjectContext = createContext();
7
+ export function useProject() {
8
+ return useContext(ProjectContext);
9
+ }
10
+ /**
11
+ * Represents a java project directory. Use if you want to generate a Java project
12
+ * with a build tool included (maven, gradle etc).
13
+ */
14
+ export function ProjectDirectory(props) {
15
+ const scope = createJavaProjectScope(useBinder(), useScope(), props.name, props.mavenProjectConfig, props.gradleProjectConfig);
16
+ const projectContext = {
17
+ scope
18
+ };
19
+ const usingBuildSystem = props.mavenProjectConfig !== undefined || props.gradleProjectConfig !== undefined;
20
+ const defaultCodePath = usingBuildSystem ? "src/main/java" : "src";
21
+ return _$createComponent(Scope, {
22
+ value: scope,
23
+ get children() {
24
+ return _$createComponent(ProjectContext.Provider, {
25
+ value: projectContext,
26
+ get children() {
27
+ return [_$createComponent(SourceDirectory, {
28
+ path: defaultCodePath,
29
+ get children() {
30
+ return props.children;
31
+ }
32
+ }), "\n", _$memo(() => _$memo(() => !!scope.mavenProjectConfig)() ? _$createComponent(MavenProject, {
33
+ get projectConfig() {
34
+ return scope.mavenProjectConfig;
35
+ }
36
+ }) : undefined)];
37
+ }
38
+ });
39
+ }
40
+ });
41
+ }
42
+ //# sourceMappingURL=ProjectDirectory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProjectDirectory.js","names":["createContext","Scope","SourceDirectory","useBinder","useContext","useScope","createJavaProjectScope","MavenProject","ProjectContext","useProject","ProjectDirectory","props","scope","name","mavenProjectConfig","gradleProjectConfig","projectContext","usingBuildSystem","undefined","defaultCodePath","_$createComponent","value","children","Provider","path","_$memo","projectConfig"],"sources":["../../../src/components/ProjectDirectory.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAGEA,aAAa,EACbC,KAAK,EACLC,eAAe,EACfC,SAAS,EACTC,UAAU,EACVC,QAAQ,QACH,gBAAgB;AACvB,SACEC,sBAAsB,QAIjB,qBAAqB;AAC5B,SAASC,YAAY,QAAQ,mBAAmB;AAMhD,OAAO,MAAMC,cAAgD,GAAGR,aAAa,CAAC,CAAC;AAE/E,OAAO,SAASS,UAAUA,CAAA,EAAG;EAC3B,OAAOL,UAAU,CAACI,cAAc,CAAC;AACnC;AAeA;AACA;AACA;AACA;AACA,OAAO,SAASE,gBAAgBA,CAACC,KAA4B,EAAE;EAC7D,MAAMC,KAAK,GAAGN,sBAAsB,CAClCH,SAAS,CAAC,CAAC,EACXE,QAAQ,CAAC,CAAC,EACVM,KAAK,CAACE,IAAI,EACVF,KAAK,CAACG,kBAAkB,EACxBH,KAAK,CAACI,mBACR,CAAC;EAED,MAAMC,cAA8B,GAAG;IACrCJ;EACF,CAAC;EAED,MAAMK,gBAAgB,GACpBN,KAAK,CAACG,kBAAkB,KAAKI,SAAS,IACtCP,KAAK,CAACI,mBAAmB,KAAKG,SAAS;EACzC,MAAMC,eAAe,GAAGF,gBAAgB,GAAG,eAAe,GAAG,KAAK;EAElE,OAAAG,iBAAA,CACKnB,KAAK;IAACoB,KAAK,EAAET,KAAK;IAAA,IAAAU,SAAA;MAAA,OAAAF,iBAAA,CAChBZ,cAAc,CAACe,QAAQ;QAACF,KAAK,EAAEL,cAAc;QAAA,IAAAM,SAAA;UAAA,QAAAF,iBAAA,CAC3ClB,eAAe;YAACsB,IAAI,EAAEL,eAAe;YAAA,IAAAG,SAAA;cAAA,OAC/BX,KAAK,CAACW,QAAQ;YAAA;UAAA,UAAAG,MAAA,OAEpBA,MAAA,SAAAb,KAAK,CAACE,kBAAkB,MAAAM,iBAAA,CACtBb,YAAY;YAAA,IAACmB,aAAaA,CAAA;cAAA,OAAEd,KAAK,CAACE,kBAAkB;YAAA;UAAA,KACnDI,SAAS;QAAA;MAAA;IAAA;EAAA;AAIvB","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import { Refkey } from "@alloy-js/core";
2
+ export interface ReferenceProps {
3
+ refkey: Refkey;
4
+ }
5
+ export declare function Reference(props: ReferenceProps): any;
6
+ //# sourceMappingURL=Reference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Reference.d.ts","sourceRoot":"","sources":["../../../src/components/Reference.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,OAI9C"}
@@ -0,0 +1,6 @@
1
+ import { ref } from "../symbols/index.js";
2
+ export function Reference(props) {
3
+ const reference = ref(props.refkey);
4
+ return reference;
5
+ }
6
+ //# sourceMappingURL=Reference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Reference.js","names":["ref","Reference","props","reference","refkey"],"sources":["../../../src/components/Reference.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,GAAG,QAAQ,qBAAqB;AAMzC,OAAO,SAASC,SAASA,CAACC,KAAqB,EAAE;EAC/C,MAAMC,SAAS,GAAGH,GAAG,CAACE,KAAK,CAACE,MAAM,CAAC;EAEnC,OAAUD,SAAS;AACrB","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ import { ComponentContext, OutputSymbol } from "@alloy-js/core";
2
+ import { Children } from "@alloy-js/core/jsx-runtime";
3
+ export interface SourceFileContext {
4
+ addImport(symbol: OutputSymbol): string;
5
+ }
6
+ export declare const SourceFileContext: ComponentContext<SourceFileContext>;
7
+ export interface SourceFileProps {
8
+ path: string;
9
+ children?: Children;
10
+ }
11
+ /**
12
+ * Represents a Java source file.
13
+ *
14
+ * Handles top level package declaration, as well as importing other sources
15
+ */
16
+ export declare function SourceFile(props: SourceFileProps): any;
17
+ //# 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,EACL,gBAAgB,EAGhB,YAAY,EAGb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAMtD,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC;CACzC;AAED,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,CAAC,iBAAiB,CACjD,CAAC;AAElB,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,OAoDhD"}
@@ -0,0 +1,70 @@
1
+ import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
+ import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
3
+ import { SourceFile as CoreSourceFile, createContext, reactive, Scope } from "@alloy-js/core";
4
+ import { ImportStatements } from "./ImportStatement.js";
5
+ import { usePackage } from "./PackageDirectory.js";
6
+ import { Reference } from "./Reference.js";
7
+ export const SourceFileContext = createContext();
8
+ /**
9
+ * Represents a Java source file.
10
+ *
11
+ * Handles top level package declaration, as well as importing other sources
12
+ */
13
+ export function SourceFile(props) {
14
+ const packageCtx = usePackage();
15
+ if (!packageCtx) {
16
+ throw new Error("SourceFile must be declared inside a package");
17
+ }
18
+
19
+ // Collection of import symbols
20
+ const importRecords = reactive([]);
21
+ // Map a symbol to import name, keep track of already imported symbols
22
+ const importedSymbols = new Map();
23
+
24
+ // Add import to file if not already, returns name of imported symbol
25
+ function addImport(symbol) {
26
+ if (importedSymbols.has(symbol)) {
27
+ return importedSymbols.get(symbol);
28
+ }
29
+
30
+ // Only need to import if not in same package, or comes from java.lang
31
+ if (symbol.package !== packageCtx?.qualifiedName || symbol.package?.startsWith("java.lang")) {
32
+ importRecords.push({
33
+ package: symbol.package ?? "",
34
+ name: symbol.name,
35
+ wildcard: false // TODO
36
+ });
37
+ }
38
+ importedSymbols.set(symbol, symbol.name);
39
+ return symbol.name;
40
+ }
41
+ const sfContext = {
42
+ addImport
43
+ };
44
+ return _$createComponent(CoreSourceFile, {
45
+ get path() {
46
+ return props.path;
47
+ },
48
+ filetype: "java",
49
+ reference: Reference,
50
+ get children() {
51
+ return ["package ", _$memo(() => packageCtx.qualifiedName), ";\n\n", _$memo(() => _$memo(() => importRecords.length > 0)() ? [_$createComponent(ImportStatements, {
52
+ imports: importRecords
53
+ }), "\n", "\n"] : undefined), _$createComponent(SourceFileContext.Provider, {
54
+ value: sfContext,
55
+ get children() {
56
+ return _$createComponent(Scope, {
57
+ get name() {
58
+ return props.path;
59
+ },
60
+ kind: "source-file",
61
+ get children() {
62
+ return props.children;
63
+ }
64
+ });
65
+ }
66
+ })];
67
+ }
68
+ });
69
+ }
70
+ //# sourceMappingURL=SourceFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SourceFile.js","names":["SourceFile","CoreSourceFile","createContext","reactive","Scope","ImportStatements","usePackage","Reference","SourceFileContext","props","packageCtx","Error","importRecords","importedSymbols","Map","addImport","symbol","has","get","package","qualifiedName","startsWith","push","name","wildcard","set","sfContext","_$createComponent","path","filetype","reference","children","_$memo","length","imports","undefined","Provider","value","kind"],"sources":["../../../src/components/SourceFile.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAEEA,UAAU,IAAIC,cAAc,EAC5BC,aAAa,EAEbC,QAAQ,EACRC,KAAK,QACA,gBAAgB;AAGvB,SAASC,gBAAgB,QAAsB,sBAAsB;AACrE,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,SAAS,QAAQ,gBAAgB;AAM1C,OAAO,MAAMC,iBAAsD,GACjEN,aAAa,CAAC,CAAC;AAOjB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASF,UAAUA,CAACS,KAAsB,EAAE;EACjD,MAAMC,UAAU,GAAGJ,UAAU,CAAC,CAAC;EAE/B,IAAI,CAACI,UAAU,EAAE;IACf,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;EACjE;;EAEA;EACA,MAAMC,aAA6B,GAAGT,QAAQ,CAAC,EAAE,CAAC;EAClD;EACA,MAAMU,eAAe,GAAG,IAAIC,GAAG,CAAuB,CAAC;;EAEvD;EACA,SAASC,SAASA,CAACC,MAAwB,EAAU;IACnD,IAAIH,eAAe,CAACI,GAAG,CAACD,MAAM,CAAC,EAAE;MAC/B,OAAOH,eAAe,CAACK,GAAG,CAACF,MAAM,CAAC;IACpC;;IAEA;IACA,IACEA,MAAM,CAACG,OAAO,KAAKT,UAAU,EAAEU,aAAa,IAC5CJ,MAAM,CAACG,OAAO,EAAEE,UAAU,CAAC,WAAW,CAAC,EACvC;MACAT,aAAa,CAACU,IAAI,CAAC;QACjBH,OAAO,EAAEH,MAAM,CAACG,OAAO,IAAI,EAAE;QAC7BI,IAAI,EAAEP,MAAM,CAACO,IAAI;QACjBC,QAAQ,EAAE,KAAK,CAAE;MACnB,CAAC,CAAC;IACJ;IACAX,eAAe,CAACY,GAAG,CAACT,MAAM,EAAEA,MAAM,CAACO,IAAI,CAAC;IAExC,OAAOP,MAAM,CAACO,IAAI;EACpB;EAEA,MAAMG,SAA4B,GAAG;IACnCX;EACF,CAAC;EAED,OAAAY,iBAAA,CAAQ1B,cAAc;IAAA,IAAC2B,IAAIA,CAAA;MAAA,OAAEnB,KAAK,CAACmB,IAAI;IAAA;IAAEC,QAAQ;IAAQC,SAAS,EAAEvB,SAAS;IAAA,IAAAwB,SAAA;MAAA,oBAAAC,MAAA,OAChEtB,UAAU,CAACU,aAAa,YAAAY,MAAA,OAEhCA,MAAA,OAAApB,aAAa,CAACqB,MAAM,GAAG,CAAC,OAAAN,iBAAA,CAEpBtB,gBAAgB;QAAC6B,OAAO,EAAEtB;MAAa,UACvC,IAAI,IAELuB,SAAS,GAAAR,iBAAA,CAAEnB,iBAAiB,CAAC4B,QAAQ;QAACC,KAAK,EAAEX,SAAS;QAAA,IAAAK,SAAA;UAAA,OAAAJ,iBAAA,CACzDvB,KAAK;YAAA,IAACmB,IAAIA,CAAA;cAAA,OAAEd,KAAK,CAACmB,IAAI;YAAA;YAAEU,IAAI;YAAA,IAAAP,SAAA;cAAA,OAC1BtB,KAAK,CAACsB,QAAQ;YAAA;UAAA;QAAA;MAAA;IAAA;EAAA;AAIvB","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export interface ValueProps {
2
+ value?: unknown;
3
+ }
4
+ export declare function Value(props: ValueProps): any;
5
+ //# sourceMappingURL=Value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Value.d.ts","sourceRoot":"","sources":["../../../src/components/Value.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAe5C"}