@alloy-js/java 0.25.0-dev.1 → 0.26.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 +8 -0
- package/dist/dev/src/builtins/index.js.map +1 -1
- package/dist/dev/src/builtins/util.js.map +1 -1
- package/dist/dev/src/components/Annotation.js +4 -4
- package/dist/dev/src/components/Annotation.js.map +1 -1
- package/dist/dev/src/components/ArgumentList.js +3 -3
- package/dist/dev/src/components/ArgumentList.js.map +1 -1
- package/dist/dev/src/components/Class.js +10 -10
- package/dist/dev/src/components/Class.js.map +1 -1
- package/dist/dev/src/components/Constructor.js +5 -5
- package/dist/dev/src/components/Constructor.js.map +1 -1
- package/dist/dev/src/components/Declaration.js +1 -1
- package/dist/dev/src/components/Declaration.js.map +1 -1
- package/dist/dev/src/components/Enum.js +9 -9
- package/dist/dev/src/components/Enum.js.map +1 -1
- package/dist/dev/src/components/ExtendsClause.js +4 -4
- package/dist/dev/src/components/ExtendsClause.js.map +1 -1
- package/dist/dev/src/components/ImplementsClause.js +4 -4
- package/dist/dev/src/components/ImplementsClause.js.map +1 -1
- package/dist/dev/src/components/ImportStatement.js.map +1 -1
- package/dist/dev/src/components/Interface.js +8 -8
- package/dist/dev/src/components/Interface.js.map +1 -1
- package/dist/dev/src/components/LexicalScope.js +1 -1
- package/dist/dev/src/components/LexicalScope.js.map +1 -1
- package/dist/dev/src/components/MavenProject.js +24 -24
- package/dist/dev/src/components/MavenProject.js.map +1 -1
- package/dist/dev/src/components/Method.js +4 -4
- package/dist/dev/src/components/Method.js.map +1 -1
- package/dist/dev/src/components/Modifiers.js.map +1 -1
- package/dist/dev/src/components/Name.js.map +1 -1
- package/dist/dev/src/components/NamedArgumentList.js.map +1 -1
- package/dist/dev/src/components/ObjectDeclaration.js +2 -2
- package/dist/dev/src/components/ObjectDeclaration.js.map +1 -1
- package/dist/dev/src/components/PackageDirectory.js +5 -5
- package/dist/dev/src/components/PackageDirectory.js.map +1 -1
- package/dist/dev/src/components/Parameters.js.map +1 -1
- package/dist/dev/src/components/ProjectDirectory.js +1 -1
- package/dist/dev/src/components/ProjectDirectory.js.map +1 -1
- package/dist/dev/src/components/Reference.js.map +1 -1
- package/dist/dev/src/components/SourceFile.js +9 -9
- package/dist/dev/src/components/SourceFile.js.map +1 -1
- package/dist/dev/src/components/TypeArguments.js +11 -11
- package/dist/dev/src/components/TypeArguments.js.map +1 -1
- package/dist/dev/src/components/TypeParameters.js +5 -5
- package/dist/dev/src/components/TypeParameters.js.map +1 -1
- package/dist/dev/src/components/Value.js.map +1 -1
- package/dist/dev/src/components/Variable.js +1 -1
- package/dist/dev/src/components/Variable.js.map +1 -1
- package/dist/dev/src/components/index.js.map +1 -1
- package/dist/dev/src/components/stc/index.js.map +1 -1
- package/dist/dev/src/create-library.js.map +1 -1
- package/dist/dev/src/index.js.map +1 -1
- package/dist/dev/src/name-policy.js.map +1 -1
- package/dist/dev/src/symbols/index.js +0 -1
- package/dist/dev/src/symbols/index.js.map +1 -1
- package/dist/dev/src/symbols/java-lexical-scope.js.map +1 -1
- package/dist/dev/src/symbols/java-output-symbol.js.map +1 -1
- package/dist/dev/src/symbols/java-package-scope.js.map +1 -1
- package/dist/dev/src/symbols/java-project-scope.js.map +1 -1
- package/dist/dev/src/symbols/reference.js.map +1 -1
- package/dist/dev/src/symbols/scopes.js.map +1 -1
- package/dist/dev/src/utils.js.map +1 -1
- package/dist/dev/test/annotation.test.js +13 -13
- package/dist/dev/test/annotation.test.js.map +1 -1
- package/dist/dev/test/class.test.js +29 -29
- package/dist/dev/test/class.test.js.map +1 -1
- package/dist/dev/test/constructor.test.js +16 -16
- package/dist/dev/test/constructor.test.js.map +1 -1
- package/dist/dev/test/enum.test.js +28 -28
- package/dist/dev/test/enum.test.js.map +1 -1
- package/dist/dev/test/externals.test.js +6 -6
- package/dist/dev/test/externals.test.js.map +1 -1
- package/dist/dev/test/interface.test.js +22 -22
- package/dist/dev/test/interface.test.js.map +1 -1
- package/dist/dev/test/maven.test.js +4 -4
- package/dist/dev/test/maven.test.js.map +1 -1
- package/dist/dev/test/method.test.js +40 -40
- package/dist/dev/test/method.test.js.map +1 -1
- package/dist/dev/test/package.test.js +4 -4
- package/dist/dev/test/package.test.js.map +1 -1
- package/dist/dev/test/reference.test.js +21 -21
- package/dist/dev/test/reference.test.js.map +1 -1
- package/dist/dev/test/type-arguments.test.js +21 -21
- package/dist/dev/test/type-arguments.test.js.map +1 -1
- package/dist/dev/test/utils.js +3 -3
- package/dist/dev/test/utils.js.map +1 -1
- package/dist/dev/test/values.test.js +5 -5
- package/dist/dev/test/values.test.js.map +1 -1
- package/dist/dev/test/variables.test.js +32 -32
- package/dist/dev/test/variables.test.js.map +1 -1
- package/dist/dev/test/vitest.setup.js.map +1 -1
- package/dist/src/builtins/index.js.map +1 -1
- package/dist/src/builtins/util.d.ts.map +1 -1
- package/dist/src/builtins/util.js.map +1 -1
- package/dist/src/components/Annotation.d.ts +1 -1
- package/dist/src/components/Annotation.d.ts.map +1 -1
- package/dist/src/components/Annotation.js.map +1 -1
- package/dist/src/components/ArgumentList.d.ts +1 -1
- package/dist/src/components/ArgumentList.d.ts.map +1 -1
- package/dist/src/components/ArgumentList.js.map +1 -1
- 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.map +1 -1
- package/dist/src/components/Constructor.d.ts +2 -2
- package/dist/src/components/Constructor.d.ts.map +1 -1
- package/dist/src/components/Constructor.js.map +1 -1
- package/dist/src/components/Declaration.d.ts +2 -2
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/Enum.d.ts +3 -3
- package/dist/src/components/Enum.d.ts.map +1 -1
- package/dist/src/components/Enum.js.map +1 -1
- package/dist/src/components/ExtendsClause.d.ts +1 -1
- package/dist/src/components/ExtendsClause.d.ts.map +1 -1
- package/dist/src/components/ExtendsClause.js.map +1 -1
- package/dist/src/components/ImplementsClause.d.ts +1 -1
- package/dist/src/components/ImplementsClause.d.ts.map +1 -1
- package/dist/src/components/ImplementsClause.js.map +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.map +1 -1
- package/dist/src/components/LexicalScope.d.ts +1 -1
- package/dist/src/components/LexicalScope.d.ts.map +1 -1
- package/dist/src/components/LexicalScope.js.map +1 -1
- package/dist/src/components/MavenProject.d.ts +2 -2
- package/dist/src/components/MavenProject.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/src/components/Modifiers.js.map +1 -1
- package/dist/src/components/Name.js.map +1 -1
- package/dist/src/components/NamedArgumentList.d.ts +1 -1
- package/dist/src/components/NamedArgumentList.d.ts.map +1 -1
- package/dist/src/components/NamedArgumentList.js.map +1 -1
- 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.map +1 -1
- package/dist/src/components/PackageDirectory.d.ts +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 +2 -2
- package/dist/src/components/Parameters.d.ts.map +1 -1
- package/dist/src/components/Parameters.js.map +1 -1
- package/dist/src/components/ProjectDirectory.d.ts +3 -2
- package/dist/src/components/ProjectDirectory.d.ts.map +1 -1
- package/dist/src/components/ProjectDirectory.js.map +1 -1
- package/dist/src/components/Reference.d.ts +1 -1
- package/dist/src/components/Reference.d.ts.map +1 -1
- package/dist/src/components/Reference.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts +2 -2
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/TypeArguments.d.ts +1 -1
- package/dist/src/components/TypeArguments.d.ts.map +1 -1
- package/dist/src/components/TypeArguments.js.map +1 -1
- package/dist/src/components/TypeParameters.d.ts +1 -1
- package/dist/src/components/TypeParameters.d.ts.map +1 -1
- package/dist/src/components/TypeParameters.js.map +1 -1
- package/dist/src/components/Value.js.map +1 -1
- package/dist/src/components/Variable.d.ts +2 -2
- package/dist/src/components/Variable.d.ts.map +1 -1
- package/dist/src/components/Variable.js.map +1 -1
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js.map +1 -1
- package/dist/src/create-library.d.ts +1 -1
- package/dist/src/create-library.d.ts.map +1 -1
- package/dist/src/create-library.js.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/name-policy.d.ts +1 -1
- package/dist/src/name-policy.d.ts.map +1 -1
- package/dist/src/name-policy.js.map +1 -1
- package/dist/src/symbols/index.d.ts +1 -1
- package/dist/src/symbols/index.d.ts.map +1 -1
- package/dist/src/symbols/index.js +0 -1
- package/dist/src/symbols/index.js.map +1 -1
- package/dist/src/symbols/java-lexical-scope.js.map +1 -1
- package/dist/src/symbols/java-output-symbol.d.ts +2 -1
- package/dist/src/symbols/java-output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/java-output-symbol.js.map +1 -1
- package/dist/src/symbols/java-package-scope.d.ts.map +1 -1
- package/dist/src/symbols/java-package-scope.js.map +1 -1
- package/dist/src/symbols/java-project-scope.d.ts +2 -1
- package/dist/src/symbols/java-project-scope.d.ts.map +1 -1
- package/dist/src/symbols/java-project-scope.js.map +1 -1
- package/dist/src/symbols/reference.d.ts +1 -1
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js.map +1 -1
- package/dist/src/symbols/scopes.d.ts +2 -2
- package/dist/src/symbols/scopes.d.ts.map +1 -1
- package/dist/src/symbols/scopes.js.map +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js.map +1 -1
- package/dist/test/annotation.test.js.map +1 -1
- package/dist/test/class.test.js.map +1 -1
- package/dist/test/constructor.test.js.map +1 -1
- package/dist/test/enum.test.js.map +1 -1
- package/dist/test/externals.test.js.map +1 -1
- package/dist/test/interface.test.js.map +1 -1
- package/dist/test/maven.test.js.map +1 -1
- package/dist/test/method.test.js.map +1 -1
- package/dist/test/package.test.js.map +1 -1
- package/dist/test/reference.test.js.map +1 -1
- package/dist/test/type-arguments.test.js.map +1 -1
- package/dist/test/utils.d.ts +1 -1
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js.map +1 -1
- package/dist/test/values.test.js.map +1 -1
- package/dist/test/variables.test.js.map +1 -1
- package/dist/test/vitest.setup.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/api/components/ArgumentList.md +4 -4
- package/docs/api/components/Class.md +4 -4
- package/docs/api/components/Constructor.md +1 -1
- package/docs/api/components/Declaration.md +6 -6
- package/docs/api/components/Enum.md +18 -18
- package/docs/api/components/EnumMember.md +16 -16
- package/docs/api/components/Interface.md +3 -3
- package/docs/api/components/Method.md +3 -3
- package/docs/api/components/ObjectDeclaration.md +19 -19
- package/docs/api/components/PackageDirectory.md +4 -4
- package/docs/api/components/ProjectDirectory.md +6 -6
- package/docs/api/components/SourceFile.md +4 -4
- package/docs/api/components/TypeArguments.md +3 -3
- package/docs/api/components/Variable.md +17 -17
- package/docs/api/types/CommonDeclarationProps.md +5 -5
- package/docs/api/types/JavaProjectScopeOptions.md +4 -4
- package/package.json +8 -8
- package/src/builtins/util.ts +1 -0
- package/src/components/Annotation.tsx +2 -1
- package/src/components/ArgumentList.tsx +2 -1
- package/src/components/Class.tsx +9 -4
- package/src/components/Constructor.tsx +4 -2
- package/src/components/Declaration.tsx +5 -8
- package/src/components/Enum.tsx +7 -3
- package/src/components/ExtendsClause.tsx +2 -1
- package/src/components/ImplementsClause.tsx +2 -1
- package/src/components/Interface.tsx +9 -4
- package/src/components/LexicalScope.tsx +3 -7
- package/src/components/MavenProject.tsx +12 -17
- package/src/components/Method.tsx +12 -9
- package/src/components/NamedArgumentList.tsx +1 -1
- package/src/components/ObjectDeclaration.tsx +5 -3
- package/src/components/PackageDirectory.tsx +4 -5
- package/src/components/Parameters.tsx +2 -1
- package/src/components/ProjectDirectory.tsx +6 -6
- package/src/components/Reference.tsx +2 -1
- package/src/components/SourceFile.tsx +8 -7
- package/src/components/TypeArguments.tsx +2 -1
- package/src/components/TypeParameters.tsx +2 -1
- package/src/components/Variable.tsx +5 -2
- package/src/components/stc/index.ts +1 -0
- package/src/create-library.ts +5 -5
- package/src/name-policy.ts +2 -1
- package/src/symbols/index.ts +1 -1
- package/src/symbols/java-output-symbol.ts +6 -11
- package/src/symbols/java-project-scope.ts +1 -1
- package/src/symbols/reference.ts +5 -3
- package/src/symbols/scopes.ts +2 -2
- package/src/utils.ts +1 -0
- package/temp/api.json +8 -8
- package/test/annotation.test.tsx +1 -0
- package/test/class.test.tsx +1 -0
- package/test/constructor.test.tsx +3 -2
- package/test/enum.test.tsx +1 -0
- package/test/externals.test.tsx +1 -0
- package/test/interface.test.tsx +1 -0
- package/test/maven.test.tsx +2 -1
- package/test/method.test.tsx +4 -3
- package/test/package.test.tsx +1 -0
- package/test/reference.test.tsx +1 -0
- package/test/type-arguments.test.tsx +4 -3
- package/test/utils.tsx +3 -1
- package/test/values.test.tsx +1 -0
- package/test/variables.test.tsx +5 -4
- package/tsdoc-metadata.json +1 -1
- package/vitest.config.ts +0 -12
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { Children
|
|
1
|
+
import type { Children } from "@alloy-js/core";
|
|
2
|
+
import { code } from "@alloy-js/core";
|
|
3
|
+
|
|
2
4
|
import { useJavaNamePolicy } from "../name-policy.js";
|
|
3
|
-
import { ModifierProps
|
|
5
|
+
import type { ModifierProps } from "./Modifiers.jsx";
|
|
6
|
+
import { Modifiers } from "./Modifiers.jsx";
|
|
4
7
|
import { Parameters } from "./Parameters.js";
|
|
5
|
-
import {
|
|
8
|
+
import type { TypeParametersProps } from "./TypeParameters.jsx";
|
|
9
|
+
import { TypeParameters } from "./TypeParameters.jsx";
|
|
6
10
|
|
|
7
11
|
export interface MethodProps extends ModifierProps, TypeParametersProps {
|
|
8
12
|
name: string;
|
|
@@ -17,18 +21,17 @@ export function Method(props: MethodProps) {
|
|
|
17
21
|
const name = useJavaNamePolicy().getName(props.name, "method");
|
|
18
22
|
const modifiers = <Modifiers {...props} />;
|
|
19
23
|
const throwsClause = props.throws ? code` throws ${props.throws}` : "";
|
|
20
|
-
const generics =
|
|
21
|
-
props.generics
|
|
22
|
-
code`${(<TypeParameters generics={props.generics} />)}${" "}`
|
|
24
|
+
const generics = props.generics
|
|
25
|
+
? code`${<TypeParameters generics={props.generics} />}${" "}`
|
|
23
26
|
: "";
|
|
24
27
|
const sBody =
|
|
25
|
-
props.children !== undefined
|
|
26
|
-
code`
|
|
28
|
+
props.children !== undefined
|
|
29
|
+
? code`
|
|
27
30
|
${" "}{
|
|
28
31
|
${props.children}
|
|
29
32
|
}
|
|
30
33
|
`
|
|
31
|
-
|
|
34
|
+
: ";";
|
|
32
35
|
return code`
|
|
33
36
|
${modifiers}${generics}${props.return ?? "void"} ${name}(${params})${throwsClause}${sBody}
|
|
34
37
|
`;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Children
|
|
1
|
+
import type { Children } from "@alloy-js/core";
|
|
2
|
+
import { code } from "@alloy-js/core";
|
|
3
|
+
|
|
2
4
|
import { ArgumentList } from "./ArgumentList.jsx";
|
|
3
|
-
import { CommonDeclarationProps } from "./Declaration.js";
|
|
4
|
-
import { ModifierProps } from "./Modifiers.jsx";
|
|
5
|
+
import type { CommonDeclarationProps } from "./Declaration.js";
|
|
6
|
+
import type { ModifierProps } from "./Modifiers.jsx";
|
|
5
7
|
import { Variable } from "./Variable.js";
|
|
6
8
|
|
|
7
9
|
export interface ObjectDeclarationProps
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import type { Children, ComponentContext } from "@alloy-js/core";
|
|
1
2
|
import {
|
|
2
|
-
Children,
|
|
3
|
-
ComponentContext,
|
|
4
3
|
createContext,
|
|
5
4
|
createScope,
|
|
6
5
|
Scope,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
useContext,
|
|
10
9
|
useScope,
|
|
11
10
|
} from "@alloy-js/core";
|
|
11
|
+
|
|
12
12
|
import { JavaPackageScope } from "../symbols/java-package-scope.js";
|
|
13
13
|
|
|
14
14
|
export interface PackageDirectoryContext {
|
|
@@ -40,9 +40,8 @@ export function PackageDirectory(props: PackageDirectoryProps) {
|
|
|
40
40
|
const packageNames = props.package.split(".");
|
|
41
41
|
const packageName = packageNames[0];
|
|
42
42
|
|
|
43
|
-
const fullyQualifiedPackageName =
|
|
44
|
-
parentPackage
|
|
45
|
-
parentPackage.qualifiedName + "." + packageName
|
|
43
|
+
const fullyQualifiedPackageName = parentPackage
|
|
44
|
+
? parentPackage.qualifiedName + "." + packageName
|
|
46
45
|
: packageName;
|
|
47
46
|
|
|
48
47
|
const parentScope = useScope();
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import type { Children, ComponentContext } from "@alloy-js/core";
|
|
1
2
|
import {
|
|
2
|
-
Children,
|
|
3
|
-
ComponentContext,
|
|
4
3
|
createContext,
|
|
5
4
|
createScope,
|
|
6
5
|
Scope,
|
|
7
6
|
SourceDirectory,
|
|
8
7
|
useContext,
|
|
9
8
|
} from "@alloy-js/core";
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
11
|
GradleProjectConfig,
|
|
12
|
-
JavaProjectScope,
|
|
13
12
|
MavenProjectConfig,
|
|
14
13
|
} from "../symbols/index.js";
|
|
14
|
+
import { JavaProjectScope } from "../symbols/index.js";
|
|
15
15
|
import { MavenProject } from "./MavenProject.js";
|
|
16
16
|
|
|
17
17
|
export interface ProjectContext {
|
|
@@ -63,9 +63,9 @@ export function ProjectDirectory(props: ProjectDirectoryProps) {
|
|
|
63
63
|
<SourceDirectory path={defaultCodePath}>
|
|
64
64
|
{props.children}
|
|
65
65
|
</SourceDirectory>
|
|
66
|
-
{scope.mavenProjectConfig ?
|
|
66
|
+
{scope.mavenProjectConfig ? (
|
|
67
67
|
<MavenProject projectConfig={scope.mavenProjectConfig} />
|
|
68
|
-
: undefined}
|
|
68
|
+
) : undefined}
|
|
69
69
|
</ProjectContext.Provider>
|
|
70
70
|
</Scope>
|
|
71
71
|
</>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import type { ComponentContext, OutputSymbol } from "@alloy-js/core";
|
|
1
2
|
import {
|
|
2
|
-
ComponentContext,
|
|
3
3
|
SourceFile as CoreSourceFile,
|
|
4
4
|
createContext,
|
|
5
|
-
OutputSymbol,
|
|
6
5
|
reactive,
|
|
7
6
|
} from "@alloy-js/core";
|
|
8
|
-
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
9
|
-
|
|
10
|
-
import {
|
|
7
|
+
import type { Children } from "@alloy-js/core/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
import type { JavaOutputSymbol } from "../symbols/index.js";
|
|
10
|
+
import type { ImportSymbol } from "./ImportStatement.js";
|
|
11
|
+
import { ImportStatements } from "./ImportStatement.js";
|
|
11
12
|
import { LexicalScope } from "./LexicalScope.jsx";
|
|
12
13
|
import { usePackage } from "./PackageDirectory.js";
|
|
13
14
|
import { Reference } from "./Reference.js";
|
|
@@ -71,13 +72,13 @@ export function SourceFile(props: SourceFileProps) {
|
|
|
71
72
|
<CoreSourceFile path={props.path} filetype="java" reference={Reference}>
|
|
72
73
|
package {packageCtx.qualifiedName};<hbr />
|
|
73
74
|
<hbr />
|
|
74
|
-
{importRecords.length > 0 ?
|
|
75
|
+
{importRecords.length > 0 ? (
|
|
75
76
|
<>
|
|
76
77
|
<ImportStatements imports={importRecords} />
|
|
77
78
|
<hbr />
|
|
78
79
|
<hbr />
|
|
79
80
|
</>
|
|
80
|
-
: undefined}
|
|
81
|
+
) : undefined}
|
|
81
82
|
<SourceFileContext.Provider value={sfContext}>
|
|
82
83
|
<LexicalScope name={props.path}>{props.children}</LexicalScope>
|
|
83
84
|
</SourceFileContext.Provider>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Children
|
|
1
|
+
import type { Children } from "@alloy-js/core";
|
|
2
|
+
import { For, Indent, Match, Switch } from "@alloy-js/core";
|
|
2
3
|
|
|
3
4
|
export interface TypeArgumentsProps {
|
|
4
5
|
args?: Children[] | TypeArgumentDescriptor[];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { Children,
|
|
1
|
+
import type { Children, Namekey } from "@alloy-js/core";
|
|
2
|
+
import { code } from "@alloy-js/core";
|
|
3
|
+
|
|
2
4
|
import { useJavaNamePolicy } from "../name-policy.js";
|
|
3
|
-
import { ModifierProps
|
|
5
|
+
import type { ModifierProps } from "./Modifiers.jsx";
|
|
6
|
+
import { Modifiers } from "./Modifiers.jsx";
|
|
4
7
|
|
|
5
8
|
export interface VariableProps extends ModifierProps {
|
|
6
9
|
type: Children;
|
package/src/create-library.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// Declare libraries (dependencies) that you are adding to the project.
|
|
2
2
|
// Allows discovery of symbols from these libraries for use in the program
|
|
3
3
|
|
|
4
|
+
import type { Binder, Refkey, SymbolCreator } from "@alloy-js/core";
|
|
4
5
|
import {
|
|
5
|
-
Binder,
|
|
6
6
|
createScope,
|
|
7
7
|
createSymbol,
|
|
8
8
|
getSymbolCreatorSymbol,
|
|
9
|
-
Refkey,
|
|
10
9
|
refkey,
|
|
11
|
-
SymbolCreator,
|
|
12
10
|
} from "@alloy-js/core";
|
|
11
|
+
|
|
13
12
|
import {
|
|
14
13
|
JavaOutputSymbol,
|
|
15
14
|
JavaPackageScope,
|
|
@@ -43,8 +42,9 @@ function createSymbols(
|
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
export type LibraryRefkeys<T extends LibraryDescriptor> = {
|
|
46
|
-
[S in T[keyof T] extends readonly string[]
|
|
47
|
-
|
|
45
|
+
[S in T[keyof T] extends readonly string[]
|
|
46
|
+
? T[keyof T][number]
|
|
47
|
+
: never]: Refkey;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
export interface CreateLibraryProps<T extends LibraryDescriptor> {
|
package/src/name-policy.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { NamePolicy } from "@alloy-js/core";
|
|
2
|
+
import { createNamePolicy, useNamePolicy } from "@alloy-js/core";
|
|
2
3
|
import { camelCase, constantCase, pascalCase } from "change-case";
|
|
3
4
|
|
|
4
5
|
export type JavaElements =
|
package/src/symbols/index.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
OutputSpace,
|
|
5
|
-
OutputSymbol,
|
|
6
|
-
OutputSymbolOptions,
|
|
7
|
-
refkey,
|
|
8
|
-
} from "@alloy-js/core";
|
|
1
|
+
import type { Namekey, OutputSpace, OutputSymbolOptions } from "@alloy-js/core";
|
|
2
|
+
import { createSymbol, OutputSymbol, refkey } from "@alloy-js/core";
|
|
3
|
+
|
|
9
4
|
import { usePackage } from "../components/PackageDirectory.jsx";
|
|
10
5
|
|
|
11
6
|
export interface JavaOutputSymbolOptions extends OutputSymbolOptions {
|
|
@@ -41,9 +36,9 @@ export class JavaOutputSymbol extends OutputSymbol {
|
|
|
41
36
|
} else {
|
|
42
37
|
const parentPackage = usePackage();
|
|
43
38
|
this.#package =
|
|
44
|
-
(options.package ?? parentPackage !== null)
|
|
45
|
-
parentPackage?.qualifiedName
|
|
46
|
-
|
|
39
|
+
(options.package ?? parentPackage !== null)
|
|
40
|
+
? parentPackage?.qualifiedName
|
|
41
|
+
: "";
|
|
47
42
|
}
|
|
48
43
|
}
|
|
49
44
|
|
package/src/symbols/reference.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Refkey } from "@alloy-js/core";
|
|
2
|
+
import { memo, resolve, untrack, useContext } from "@alloy-js/core";
|
|
3
|
+
|
|
2
4
|
import { SourceFileContext } from "../components/index.js";
|
|
3
|
-
import { JavaOutputSymbol } from "./java-output-symbol.js";
|
|
4
|
-
import { JavaOutputScope } from "./scopes.js";
|
|
5
|
+
import type { JavaOutputSymbol } from "./java-output-symbol.js";
|
|
6
|
+
import type { JavaOutputScope } from "./scopes.js";
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Resolve reference to symbol reference, and handle dependency management
|
package/src/symbols/scopes.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JavaPackageScope } from "./java-package-scope.js";
|
|
2
|
-
import { JavaProjectScope } from "./java-project-scope.js";
|
|
1
|
+
import type { JavaPackageScope } from "./java-package-scope.js";
|
|
2
|
+
import type { JavaProjectScope } from "./java-project-scope.js";
|
|
3
3
|
|
|
4
4
|
export type JavaOutputScope = JavaProjectScope | JavaPackageScope;
|
package/src/utils.ts
CHANGED
package/temp/api.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"metadata": {
|
|
3
3
|
"toolPackage": "@microsoft/api-extractor",
|
|
4
|
-
"toolVersion": "7.58.
|
|
4
|
+
"toolVersion": "7.58.11",
|
|
5
5
|
"schemaVersion": 1011,
|
|
6
6
|
"oldestForwardsCompatibleVersion": 1001,
|
|
7
7
|
"tsdocConfig": {
|
|
@@ -5214,25 +5214,25 @@
|
|
|
5214
5214
|
},
|
|
5215
5215
|
{
|
|
5216
5216
|
"kind": "Content",
|
|
5217
|
-
"text": "() => (string |
|
|
5217
|
+
"text": "() => (string | "
|
|
5218
5218
|
},
|
|
5219
5219
|
{
|
|
5220
5220
|
"kind": "Reference",
|
|
5221
|
-
"text": "
|
|
5222
|
-
"canonicalReference": "@alloy-js/core!
|
|
5221
|
+
"text": "Children",
|
|
5222
|
+
"canonicalReference": "@alloy-js/core!Children:type"
|
|
5223
5223
|
},
|
|
5224
5224
|
{
|
|
5225
5225
|
"kind": "Content",
|
|
5226
|
-
"text": " | "
|
|
5226
|
+
"text": "[] | import(\"@alloy-js/core\")."
|
|
5227
5227
|
},
|
|
5228
5228
|
{
|
|
5229
5229
|
"kind": "Reference",
|
|
5230
|
-
"text": "
|
|
5231
|
-
"canonicalReference": "@alloy-js/core!
|
|
5230
|
+
"text": "CustomContext",
|
|
5231
|
+
"canonicalReference": "@alloy-js/core!CustomContext:interface"
|
|
5232
5232
|
},
|
|
5233
5233
|
{
|
|
5234
5234
|
"kind": "Content",
|
|
5235
|
-
"text": "
|
|
5235
|
+
"text": " | undefined)[]"
|
|
5236
5236
|
},
|
|
5237
5237
|
{
|
|
5238
5238
|
"kind": "Content",
|
package/test/annotation.test.tsx
CHANGED
package/test/class.test.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { code, Output, refkey } from "@alloy-js/core";
|
|
2
2
|
import { expect, it } from "vitest";
|
|
3
|
+
|
|
3
4
|
import * as jv from "../src/components/index.js";
|
|
4
5
|
import { TestPackage } from "./utils.js";
|
|
5
6
|
|
|
@@ -9,7 +10,7 @@ it("works", () => {
|
|
|
9
10
|
<jv.Declaration name="TestClass">
|
|
10
11
|
{code`
|
|
11
12
|
public class TestClass {
|
|
12
|
-
${
|
|
13
|
+
${<jv.Constructor public name="TestClass" />}
|
|
13
14
|
}
|
|
14
15
|
`}
|
|
15
16
|
</jv.Declaration>
|
|
@@ -29,7 +30,7 @@ it("takes name from class", () => {
|
|
|
29
30
|
<jv.Declaration name="TestClass">
|
|
30
31
|
{code`
|
|
31
32
|
public class TestClass {
|
|
32
|
-
${
|
|
33
|
+
${<jv.Constructor public />}
|
|
33
34
|
}
|
|
34
35
|
`}
|
|
35
36
|
</jv.Declaration>
|
package/test/enum.test.tsx
CHANGED
package/test/externals.test.tsx
CHANGED
package/test/interface.test.tsx
CHANGED
package/test/maven.test.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Output } from "@alloy-js/core";
|
|
2
2
|
import { expect, it } from "vitest";
|
|
3
|
+
|
|
3
4
|
import { ProjectDirectory } from "../src/components/index.js";
|
|
4
|
-
import { MavenProjectConfig } from "../src/index.js";
|
|
5
|
+
import type { MavenProjectConfig } from "../src/index.js";
|
|
5
6
|
|
|
6
7
|
it("generates barebones pom.xml file", () => {
|
|
7
8
|
const projectConfig: MavenProjectConfig = {
|
package/test/method.test.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { code, Output, refkey } from "@alloy-js/core";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
3
4
|
import * as jv from "../src/components/index.js";
|
|
4
5
|
import { TestPackage } from "./utils.js";
|
|
5
6
|
|
|
@@ -35,7 +36,7 @@ it("declares bodyless function", () => {
|
|
|
35
36
|
<jv.Declaration name="Test">
|
|
36
37
|
{code`
|
|
37
38
|
class Test {
|
|
38
|
-
${
|
|
39
|
+
${<jv.Method public name="testMethod" />}
|
|
39
40
|
}
|
|
40
41
|
`}
|
|
41
42
|
</jv.Declaration>
|
|
@@ -56,7 +57,7 @@ describe("can throw errors", () => {
|
|
|
56
57
|
<jv.Declaration name="Test">
|
|
57
58
|
{code`
|
|
58
59
|
class Test {
|
|
59
|
-
${
|
|
60
|
+
${<jv.Method public name="testMethod" throws={"Exception"} />}
|
|
60
61
|
}
|
|
61
62
|
`}
|
|
62
63
|
</jv.Declaration>
|
|
@@ -78,7 +79,7 @@ describe("can throw errors", () => {
|
|
|
78
79
|
<jv.Declaration name="Test">
|
|
79
80
|
{code`
|
|
80
81
|
class Test {
|
|
81
|
-
${
|
|
82
|
+
${<jv.Method public name="testMethod" throws={refkey("CustomError")} />}
|
|
82
83
|
}
|
|
83
84
|
`}
|
|
84
85
|
</jv.Declaration>
|
package/test/package.test.tsx
CHANGED
package/test/reference.test.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Output, code, refkey } from "@alloy-js/core";
|
|
2
2
|
import { expect, it } from "vitest";
|
|
3
|
+
|
|
3
4
|
import * as jv from "../src/components/index.js";
|
|
4
5
|
|
|
5
6
|
it("passes types", () => {
|
|
@@ -27,9 +28,9 @@ it("passes types", () => {
|
|
|
27
28
|
<jv.Class public name="TestGenerics">
|
|
28
29
|
{code`
|
|
29
30
|
public TestGenerics() {
|
|
30
|
-
List${
|
|
31
|
-
List${
|
|
32
|
-
List${
|
|
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 />}();
|
|
33
34
|
}
|
|
34
35
|
`}
|
|
35
36
|
</jv.Class>
|
package/test/utils.tsx
CHANGED
package/test/values.test.tsx
CHANGED
package/test/variables.test.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { code, namekey, Output, refkey } from "@alloy-js/core";
|
|
2
2
|
import { expect, it } from "vitest";
|
|
3
|
+
|
|
3
4
|
import * as jv from "../src/components/index.js";
|
|
4
5
|
import { TestPackage } from "./utils.js";
|
|
5
6
|
|
|
@@ -9,7 +10,7 @@ it("works", () => {
|
|
|
9
10
|
<jv.Declaration name="Test">
|
|
10
11
|
{code`
|
|
11
12
|
class Test {
|
|
12
|
-
${
|
|
13
|
+
${<jv.Variable public static final type="String" name="myVar" value={<jv.Value value="Test" />} />};
|
|
13
14
|
}
|
|
14
15
|
`}
|
|
15
16
|
</jv.Declaration>
|
|
@@ -29,7 +30,7 @@ it("takes a namekey", () => {
|
|
|
29
30
|
<jv.Declaration name={namekey("Test")}>
|
|
30
31
|
{code`
|
|
31
32
|
class Test {
|
|
32
|
-
${
|
|
33
|
+
${<jv.Variable public static final type="String" name="myVar" value={<jv.Value value="Test" />} />};
|
|
33
34
|
}
|
|
34
35
|
`}
|
|
35
36
|
</jv.Declaration>
|
|
@@ -60,7 +61,7 @@ it("works with external type", () => {
|
|
|
60
61
|
<jv.Declaration name="Test">
|
|
61
62
|
{code`
|
|
62
63
|
public class Test {
|
|
63
|
-
${
|
|
64
|
+
${<jv.Variable public static type={refkey("Model")} name="myModel" />};
|
|
64
65
|
}
|
|
65
66
|
`}
|
|
66
67
|
</jv.Declaration>
|
|
@@ -99,7 +100,7 @@ it("declares new object", () => {
|
|
|
99
100
|
<jv.Declaration name="Test">
|
|
100
101
|
{code`
|
|
101
102
|
public class Test {
|
|
102
|
-
${
|
|
103
|
+
${<jv.ObjectDeclaration public static type={refkey("Model")} name="myModel" args={[<jv.Value value="initValue" />]} />};
|
|
103
104
|
}
|
|
104
105
|
`}
|
|
105
106
|
</jv.Declaration>
|
package/tsdoc-metadata.json
CHANGED
package/vitest.config.ts
CHANGED
|
@@ -2,18 +2,6 @@ import alloyPlugin from "@alloy-js/rollup-plugin";
|
|
|
2
2
|
import { defineConfig } from "vitest/config";
|
|
3
3
|
|
|
4
4
|
export default defineConfig({
|
|
5
|
-
resolve: {
|
|
6
|
-
conditions: ["source"],
|
|
7
|
-
},
|
|
8
|
-
ssr: {
|
|
9
|
-
resolve: {
|
|
10
|
-
conditions: ["source"],
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
esbuild: {
|
|
14
|
-
jsx: "preserve",
|
|
15
|
-
sourcemap: "both",
|
|
16
|
-
},
|
|
17
5
|
test: {
|
|
18
6
|
exclude: ["**/dist/**", "**/node_modules/**"],
|
|
19
7
|
setupFiles: ["./test/vitest.setup.ts"],
|