@alloy-js/java 0.19.0 → 0.20.0-dev.1
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/dist/src/components/Class.d.ts.map +1 -1
- package/dist/src/components/Class.js +3 -3
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +6 -1
- package/dist/src/components/Enum.d.ts.map +1 -1
- package/dist/src/components/Enum.js +3 -3
- package/dist/src/components/Interface.d.ts.map +1 -1
- package/dist/src/components/Interface.js +3 -3
- package/dist/src/components/LexicalScope.d.ts +8 -0
- package/dist/src/components/LexicalScope.d.ts.map +1 -0
- package/dist/src/components/LexicalScope.js +23 -0
- package/dist/src/components/PackageDirectory.d.ts.map +1 -1
- package/dist/src/components/PackageDirectory.js +3 -2
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +3 -3
- package/dist/src/create-library.d.ts.map +1 -1
- package/dist/src/create-library.js +3 -5
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/symbols/index.d.ts +1 -0
- package/dist/src/symbols/index.d.ts.map +1 -1
- package/dist/src/symbols/index.js +1 -0
- package/dist/src/symbols/java-lexical-scope.d.ts +6 -0
- package/dist/src/symbols/java-lexical-scope.d.ts.map +1 -0
- package/dist/src/symbols/java-lexical-scope.js +7 -0
- package/dist/src/symbols/java-output-symbol.d.ts +4 -2
- package/dist/src/symbols/java-output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/java-output-symbol.js +13 -2
- package/dist/src/symbols/java-package-scope.d.ts +2 -0
- package/dist/src/symbols/java-package-scope.d.ts.map +1 -1
- package/dist/src/symbols/java-package-scope.js +4 -0
- package/dist/src/symbols/java-project-scope.js +1 -1
- package/dist/src/symbols/reference.js +2 -2
- package/dist/src/utils.d.ts +3 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +12 -0
- package/dist/test/constructor.test.js +4 -4
- package/dist/test/method.test.js +3 -3
- package/dist/test/variables.test.js +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/components/Class.tsx +4 -3
- package/src/components/Declaration.tsx +7 -1
- package/src/components/Enum.tsx +4 -3
- package/src/components/Interface.tsx +4 -3
- package/src/components/LexicalScope.tsx +31 -0
- package/src/components/PackageDirectory.tsx +3 -1
- package/src/components/SourceFile.tsx +2 -4
- package/src/create-library.ts +2 -4
- package/src/index.ts +1 -0
- package/src/symbols/index.ts +1 -0
- package/src/symbols/java-lexical-scope.ts +9 -0
- package/src/symbols/java-output-symbol.ts +24 -3
- package/src/symbols/java-package-scope.ts +6 -0
- package/src/symbols/java-project-scope.ts +1 -1
- package/src/symbols/reference.ts +2 -2
- package/src/utils.ts +17 -0
- package/temp/api.json +290 -3
- package/test/constructor.test.tsx +7 -7
- package/test/method.test.tsx +5 -5
- package/test/variables.test.tsx +5 -5
- package/tsdoc-metadata.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Class.d.ts","sourceRoot":"","sources":["../../../src/components/Class.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,
|
|
1
|
+
{"version":3,"file":"Class.d.ts","sourceRoot":"","sources":["../../../src/components/Class.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,EAAQ,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAe,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,aAAa,EAAa,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAkB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3E,MAAM,WAAW,UACf,SAAQ,gBAAgB,EACtB,aAAa,EACb,mBAAmB;IACrB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;CACzB;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,YAmBtC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, memo as _$memo, createIntrinsic as _$createIntrinsic, mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { Block,
|
|
2
|
+
import { Block, Show } from "@alloy-js/core";
|
|
3
3
|
import { useJavaNamePolicy } from "../name-policy.js";
|
|
4
4
|
import { Declaration } from "./Declaration.js";
|
|
5
5
|
import { ExtendsClause } from "./ExtendsClause.js";
|
|
6
6
|
import { ImplementsClause } from "./ImplementsClause.js";
|
|
7
|
+
import { LexicalScope } from "./LexicalScope.js";
|
|
7
8
|
import { Modifiers } from "./Modifiers.js";
|
|
8
9
|
import { Name } from "./Name.js";
|
|
9
10
|
import { TypeParameters } from "./TypeParameters.js";
|
|
@@ -33,9 +34,8 @@ export function Class(props) {
|
|
|
33
34
|
get interfaces() {
|
|
34
35
|
return props.implements;
|
|
35
36
|
}
|
|
36
|
-
}), " ", _$createComponent(
|
|
37
|
+
}), " ", _$createComponent(LexicalScope, {
|
|
37
38
|
name: name,
|
|
38
|
-
kind: "class",
|
|
39
39
|
get children() {
|
|
40
40
|
return _$createComponent(Block, {
|
|
41
41
|
get children() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Declaration.d.ts","sourceRoot":"","sources":["../../../src/components/Declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,MAAM,EACP,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Declaration.d.ts","sourceRoot":"","sources":["../../../src/components/Declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,MAAM,EACP,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,gBAAgB;IAE/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,YAUlD"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { Declaration as CoreDeclaration } from "@alloy-js/core";
|
|
3
3
|
import { JavaOutputSymbol } from "../symbols/java-output-symbol.js";
|
|
4
|
+
import { useLexicalScope } from "../utils.js";
|
|
4
5
|
/**
|
|
5
6
|
* Declare a symbol in the program. Declaring classes, interfaces, enums, etc. Should also pass in
|
|
6
7
|
* access modifier so we can manage access
|
|
7
8
|
*/
|
|
8
9
|
export function Declaration(props) {
|
|
9
|
-
const
|
|
10
|
+
const scope = useLexicalScope();
|
|
11
|
+
if (!scope) {
|
|
12
|
+
throw new Error("A lexical scope is required for declaration");
|
|
13
|
+
}
|
|
14
|
+
const sym = new JavaOutputSymbol(props.name, scope.symbols, {
|
|
10
15
|
refkeys: props.refkey
|
|
11
16
|
});
|
|
12
17
|
return _$createComponent(CoreDeclaration, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Enum.d.ts","sourceRoot":"","sources":["../../../src/components/Enum.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,
|
|
1
|
+
{"version":3,"file":"Enum.d.ts","sourceRoot":"","sources":["../../../src/components/Enum.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,EAAQ,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAe,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGjE,OAAO,EAAE,aAAa,EAAa,MAAM,iBAAiB,CAAC;AAG3D,MAAM,WAAW,SAAU,SAAQ,gBAAgB,EAAE,aAAa;IAChE,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;CACzB;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,YAepC;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YAShD;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,YAExD"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic, mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { Block, List
|
|
2
|
+
import { Block, List } from "@alloy-js/core";
|
|
3
3
|
import { useJavaNamePolicy } from "../name-policy.js";
|
|
4
4
|
import { ArgumentList } from "./ArgumentList.js";
|
|
5
5
|
import { Declaration } from "./Declaration.js";
|
|
6
6
|
import { ImplementsClause } from "./ImplementsClause.js";
|
|
7
|
+
import { LexicalScope } from "./LexicalScope.js";
|
|
7
8
|
import { Modifiers } from "./Modifiers.js";
|
|
8
9
|
import { Name } from "./Name.js";
|
|
9
10
|
export function Enum(props) {
|
|
@@ -19,8 +20,7 @@ export function Enum(props) {
|
|
|
19
20
|
}
|
|
20
21
|
})];
|
|
21
22
|
}
|
|
22
|
-
}), " ", _$createComponent(
|
|
23
|
-
kind: "enum",
|
|
23
|
+
}), " ", _$createComponent(LexicalScope, {
|
|
24
24
|
get children() {
|
|
25
25
|
return _$createComponent(Block, {
|
|
26
26
|
get children() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interface.d.ts","sourceRoot":"","sources":["../../../src/components/Interface.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,
|
|
1
|
+
{"version":3,"file":"Interface.d.ts","sourceRoot":"","sources":["../../../src/components/Interface.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAe,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGjE,OAAO,EAAE,aAAa,EAAa,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAkB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3E,MAAM,WAAW,cACf,SAAQ,gBAAgB,EACtB,aAAa,EACb,mBAAmB;IACrB,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,YAe9C"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic, mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { Block
|
|
2
|
+
import { Block } from "@alloy-js/core";
|
|
3
3
|
import { useJavaNamePolicy } from "../name-policy.js";
|
|
4
4
|
import { Declaration } from "./Declaration.js";
|
|
5
5
|
import { ExtendsClause } from "./ExtendsClause.js";
|
|
6
|
+
import { LexicalScope } from "./LexicalScope.js";
|
|
6
7
|
import { Modifiers } from "./Modifiers.js";
|
|
7
8
|
import { Name } from "./Name.js";
|
|
8
9
|
import { TypeParameters } from "./TypeParameters.js";
|
|
@@ -23,9 +24,8 @@ export function Interface(props) {
|
|
|
23
24
|
}
|
|
24
25
|
}), " "];
|
|
25
26
|
}
|
|
26
|
-
}), _$createComponent(
|
|
27
|
+
}), _$createComponent(LexicalScope, {
|
|
27
28
|
name: name,
|
|
28
|
-
kind: "interface",
|
|
29
29
|
get children() {
|
|
30
30
|
return _$createComponent(Block, {
|
|
31
31
|
get children() {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ScopePropsWithInfo, ScopePropsWithValue } from "@alloy-js/core";
|
|
2
|
+
export interface LexicalScopePropsWithScopeValue extends ScopePropsWithValue {
|
|
3
|
+
}
|
|
4
|
+
export interface LeixcalScopePropsWithScopeInfo extends ScopePropsWithInfo {
|
|
5
|
+
}
|
|
6
|
+
export type LexicalScopeProps = LexicalScopePropsWithScopeValue | LeixcalScopePropsWithScopeInfo;
|
|
7
|
+
export declare function LexicalScope(props: LexicalScopeProps): import("@alloy-js/core").Children;
|
|
8
|
+
//# sourceMappingURL=LexicalScope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LexicalScope.d.ts","sourceRoot":"","sources":["../../../src/components/LexicalScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,WAAW,+BAAgC,SAAQ,mBAAmB;CAAG;AAC/E,MAAM,WAAW,8BAA+B,SAAQ,kBAAkB;CAAG;AAE7E,MAAM,MAAM,iBAAiB,GACzB,+BAA+B,GAC/B,8BAA8B,CAAC;AAEnC,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qCAepD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { Scope, useScope } from "@alloy-js/core";
|
|
3
|
+
import { JavaLexicalScope } from "../symbols/index.js";
|
|
4
|
+
export function LexicalScope(props) {
|
|
5
|
+
let scope;
|
|
6
|
+
if ("value" in props) {
|
|
7
|
+
if (!(props.value instanceof JavaLexicalScope)) {
|
|
8
|
+
throw new Error("LexicalScope value must be a TSLexicalScope instance");
|
|
9
|
+
}
|
|
10
|
+
scope = props.value;
|
|
11
|
+
} else {
|
|
12
|
+
const parentScope = useScope();
|
|
13
|
+
scope = new JavaLexicalScope(props.name ?? "lexical scope", parentScope, {
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return _$createComponent(Scope, {
|
|
18
|
+
value: scope,
|
|
19
|
+
get children() {
|
|
20
|
+
return props.children;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageDirectory.d.ts","sourceRoot":"","sources":["../../../src/components/PackageDirectory.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,gBAAgB,
|
|
1
|
+
{"version":3,"file":"PackageDirectory.d.ts","sourceRoot":"","sources":["../../../src/components/PackageDirectory.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAOjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,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,YAiD5D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { createContext, Scope, SourceDirectory, SourceDirectoryContext, useContext } from "@alloy-js/core";
|
|
2
|
+
import { createContext, Scope, SourceDirectory, SourceDirectoryContext, useContext, useScope } from "@alloy-js/core";
|
|
3
3
|
import { JavaPackageScope } from "../symbols/java-package-scope.js";
|
|
4
4
|
export const PackageDirectoryContext = createContext();
|
|
5
5
|
export function usePackage() {
|
|
@@ -11,7 +11,8 @@ export function PackageDirectory(props) {
|
|
|
11
11
|
const packageNames = props.package.split(".");
|
|
12
12
|
const packageName = packageNames[0];
|
|
13
13
|
const fullyQualifiedPackageName = parentPackage ? parentPackage.qualifiedName + "." + packageName : packageName;
|
|
14
|
-
const
|
|
14
|
+
const parentScope = useScope();
|
|
15
|
+
const scope = new JavaPackageScope(fullyQualifiedPackageName, parentScope);
|
|
15
16
|
const packagePath = sourceDirectory?.path + "/" + packageName;
|
|
16
17
|
const packageContext = {
|
|
17
18
|
scope,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGhB,YAAY,
|
|
1
|
+
{"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGhB,YAAY,EAEb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAOtD,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,YAsDhD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { memo as _$memo, createIntrinsic as _$createIntrinsic, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { SourceFile as CoreSourceFile, createContext, reactive
|
|
2
|
+
import { SourceFile as CoreSourceFile, createContext, reactive } from "@alloy-js/core";
|
|
3
3
|
import { ImportStatements } from "./ImportStatement.js";
|
|
4
|
+
import { LexicalScope } from "./LexicalScope.js";
|
|
4
5
|
import { usePackage } from "./PackageDirectory.js";
|
|
5
6
|
import { Reference } from "./Reference.js";
|
|
6
7
|
export const SourceFileContext = createContext();
|
|
@@ -52,11 +53,10 @@ export function SourceFile(props) {
|
|
|
52
53
|
}), _$createIntrinsic("hbr", {}), _$createIntrinsic("hbr", {})] : undefined), _$createComponent(SourceFileContext.Provider, {
|
|
53
54
|
value: sfContext,
|
|
54
55
|
get children() {
|
|
55
|
-
return _$createComponent(
|
|
56
|
+
return _$createComponent(LexicalScope, {
|
|
56
57
|
get name() {
|
|
57
58
|
return props.path;
|
|
58
59
|
},
|
|
59
|
-
kind: "source-file",
|
|
60
60
|
get children() {
|
|
61
61
|
return props.children;
|
|
62
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-library.d.ts","sourceRoot":"","sources":["../../src/create-library.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,MAAM,EAEN,aAAa,EACd,MAAM,gBAAgB,CAAC;AAOxB,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;
|
|
1
|
+
{"version":3,"file":"create-library.d.ts","sourceRoot":"","sources":["../../src/create-library.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,MAAM,EAEN,aAAa,EACd,MAAM,gBAAgB,CAAC;AAOxB,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAwBD,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,iBAAiB,IAAI;KACvD,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAC7D,KAAK,GAAG,MAAM;CACjB,CAAC;AAEF,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,iBAAiB;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,CAAC,CAAC;CACf;AAED,wBAAgB,aAAa,CAAC,KAAK,CAAC,CAAC,SAAS,iBAAiB,EAC7D,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC3B,cAAc,CAAC,CAAC,CAAC,GAAG,aAAa,CAcnC"}
|
|
@@ -8,14 +8,12 @@ function createSymbols(binder, props, refkeys) {
|
|
|
8
8
|
binder
|
|
9
9
|
});
|
|
10
10
|
for (const [pkg, symbols] of Object.entries(props.descriptor)) {
|
|
11
|
-
const packageScope = new JavaPackageScope(pkg, {
|
|
12
|
-
binder
|
|
13
|
-
parent: projectScope
|
|
11
|
+
const packageScope = new JavaPackageScope(pkg, projectScope, {
|
|
12
|
+
binder
|
|
14
13
|
});
|
|
15
14
|
for (const symB of symbols) {
|
|
16
|
-
new JavaOutputSymbol(symB, {
|
|
15
|
+
new JavaOutputSymbol(symB, packageScope.symbols, {
|
|
17
16
|
binder,
|
|
18
|
-
scope: packageScope,
|
|
19
17
|
refkeys: refkeys[symB],
|
|
20
18
|
package: packageScope.name
|
|
21
19
|
});
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/symbols/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/symbols/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"java-lexical-scope.d.ts","sourceRoot":"","sources":["../../../src/symbols/java-lexical-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,gBAAuB,iBAAiB,WAAe;IAEvD,IAAI,OAAO,yCAEV;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OutputSymbol, OutputSymbolOptions } from "@alloy-js/core";
|
|
1
|
+
import { OutputSpace, OutputSymbol, OutputSymbolOptions } from "@alloy-js/core";
|
|
2
2
|
export interface JavaOutputSymbolOptions extends OutputSymbolOptions {
|
|
3
3
|
package?: string;
|
|
4
4
|
}
|
|
@@ -8,10 +8,12 @@ export interface JavaOutputSymbolOptions extends OutputSymbolOptions {
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class JavaOutputSymbol extends OutputSymbol {
|
|
10
10
|
#private;
|
|
11
|
+
static memberSpaces: readonly ["static", "instance"];
|
|
11
12
|
/**
|
|
12
13
|
* Fully qualified package name
|
|
13
14
|
*/
|
|
14
15
|
get package(): string | undefined;
|
|
15
|
-
constructor(name: string, options?: JavaOutputSymbolOptions);
|
|
16
|
+
constructor(name: string, spaces: OutputSpace[] | OutputSpace | undefined, options?: JavaOutputSymbolOptions);
|
|
17
|
+
copy(): JavaOutputSymbol;
|
|
16
18
|
}
|
|
17
19
|
//# sourceMappingURL=java-output-symbol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"java-output-symbol.d.ts","sourceRoot":"","sources":["../../../src/symbols/java-output-symbol.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"java-output-symbol.d.ts","sourceRoot":"","sources":["../../../src/symbols/java-output-symbol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;;IAChD,MAAM,CAAC,YAAY,kCAAmC;IAEtD;;OAEG;IACH,IAAI,OAAO,uBAEV;gBAIC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,GAAG,SAAS,EAC/C,OAAO,GAAE,uBAA4B;IAkBvC,IAAI;CASL"}
|
|
@@ -5,6 +5,8 @@ import { usePackage } from "../components/PackageDirectory.js";
|
|
|
5
5
|
* Not considered exported if private
|
|
6
6
|
*/
|
|
7
7
|
export class JavaOutputSymbol extends OutputSymbol {
|
|
8
|
+
static memberSpaces = ["static", "instance"];
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* Fully qualified package name
|
|
10
12
|
*/
|
|
@@ -12,11 +14,11 @@ export class JavaOutputSymbol extends OutputSymbol {
|
|
|
12
14
|
return this.#package;
|
|
13
15
|
}
|
|
14
16
|
#package;
|
|
15
|
-
constructor(name, options = {}) {
|
|
17
|
+
constructor(name, spaces, options = {}) {
|
|
16
18
|
if (options.refkeys === undefined) {
|
|
17
19
|
options.refkeys = [refkey(name)];
|
|
18
20
|
}
|
|
19
|
-
super(name, options);
|
|
21
|
+
super(name, spaces, options);
|
|
20
22
|
if (options.package) {
|
|
21
23
|
this.#package = options.package;
|
|
22
24
|
} else {
|
|
@@ -24,4 +26,13 @@ export class JavaOutputSymbol extends OutputSymbol {
|
|
|
24
26
|
this.#package = options.package ?? parentPackage !== null ? parentPackage?.qualifiedName : "";
|
|
25
27
|
}
|
|
26
28
|
}
|
|
29
|
+
copy() {
|
|
30
|
+
const options = this.getCopyOptions();
|
|
31
|
+
const copy = new JavaOutputSymbol(this.name, undefined, {
|
|
32
|
+
...options,
|
|
33
|
+
package: this.#package
|
|
34
|
+
});
|
|
35
|
+
this.initializeCopy(copy);
|
|
36
|
+
return copy;
|
|
37
|
+
}
|
|
27
38
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { OutputScope } from "@alloy-js/core";
|
|
2
2
|
export declare class JavaPackageScope extends OutputScope {
|
|
3
|
+
static readonly declarationSpaces: readonly ["symbols"];
|
|
3
4
|
get kind(): string;
|
|
5
|
+
get symbols(): import("@alloy-js/core").OutputSpace;
|
|
4
6
|
}
|
|
5
7
|
//# sourceMappingURL=java-package-scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"java-package-scope.d.ts","sourceRoot":"","sources":["../../../src/symbols/java-package-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,IAAI,IAAI,WAEP;CACF"}
|
|
1
|
+
{"version":3,"file":"java-package-scope.d.ts","sourceRoot":"","sources":["../../../src/symbols/java-package-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,gBAAuB,iBAAiB,uBAAwB;IAEhE,IAAI,IAAI,WAEP;IAED,IAAI,OAAO,yCAEV;CACF"}
|
|
@@ -57,7 +57,7 @@ export class JavaProjectScope extends OutputScope {
|
|
|
57
57
|
}
|
|
58
58
|
#gradleProjectConfig;
|
|
59
59
|
constructor(name, options = {}) {
|
|
60
|
-
super(name, options);
|
|
60
|
+
super(name, undefined, options);
|
|
61
61
|
this.#mavenProjectConfig = options.mavenProjectConfig;
|
|
62
62
|
this.#gradleProjectConfig = options.gradleProjectConfig;
|
|
63
63
|
}
|
|
@@ -13,8 +13,8 @@ export function ref(refkey) {
|
|
|
13
13
|
return "<Unresolved Symbol>";
|
|
14
14
|
}
|
|
15
15
|
const {
|
|
16
|
-
|
|
16
|
+
symbol
|
|
17
17
|
} = result.value;
|
|
18
|
-
return untrack(() => sourceFile.addImport(
|
|
18
|
+
return untrack(() => sourceFile.addImport(symbol));
|
|
19
19
|
});
|
|
20
20
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,wBAAgB,eAAe,IAAI,gBAAgB,GAAG,SAAS,CAa9D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useScope } from "@alloy-js/core";
|
|
2
|
+
import { JavaLexicalScope } from "./symbols/java-lexical-scope.js";
|
|
3
|
+
export function useLexicalScope() {
|
|
4
|
+
const scopeContext = useScope();
|
|
5
|
+
if (!scopeContext) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (!(scopeContext instanceof JavaLexicalScope)) {
|
|
9
|
+
throw new Error("A lexical scope is required but the current scope is not a lexical scope");
|
|
10
|
+
}
|
|
11
|
+
return scopeContext;
|
|
12
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { code,
|
|
2
|
+
import { code, refkey } from "@alloy-js/core";
|
|
3
3
|
import { d } from "@alloy-js/core/testing";
|
|
4
4
|
import { expect, it } from "vitest";
|
|
5
5
|
import * as jv from "../src/components/index.js";
|
|
6
6
|
import { assertFileContents, testRender, toSourceText } from "./utils.js";
|
|
7
7
|
it("works", () => {
|
|
8
|
-
const res = toSourceText([_$createComponent(Declaration, {
|
|
8
|
+
const res = toSourceText([_$createComponent(jv.Declaration, {
|
|
9
9
|
name: "TestClass",
|
|
10
10
|
get children() {
|
|
11
11
|
return code`
|
|
@@ -27,7 +27,7 @@ it("works", () => {
|
|
|
27
27
|
`);
|
|
28
28
|
});
|
|
29
29
|
it("takes name from class", () => {
|
|
30
|
-
const res = toSourceText([_$createComponent(Declaration, {
|
|
30
|
+
const res = toSourceText([_$createComponent(jv.Declaration, {
|
|
31
31
|
name: "TestClass",
|
|
32
32
|
get children() {
|
|
33
33
|
return code`
|
|
@@ -65,7 +65,7 @@ it("declares parameters", () => {
|
|
|
65
65
|
return _$createComponent(jv.SourceFile, {
|
|
66
66
|
path: "TestClass.java",
|
|
67
67
|
get children() {
|
|
68
|
-
return _$createComponent(Declaration, {
|
|
68
|
+
return _$createComponent(jv.Declaration, {
|
|
69
69
|
name: "TestClass",
|
|
70
70
|
get children() {
|
|
71
71
|
return code`
|
package/dist/test/method.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memo as _$memo, createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { code,
|
|
2
|
+
import { code, refkey } from "@alloy-js/core";
|
|
3
3
|
import { d } from "@alloy-js/core/testing";
|
|
4
4
|
import { describe, expect, it } from "vitest";
|
|
5
5
|
import * as jv from "../src/components/index.js";
|
|
@@ -173,7 +173,7 @@ it("declares parameters", () => {
|
|
|
173
173
|
return _$createComponent(jv.SourceFile, {
|
|
174
174
|
path: "Test.java",
|
|
175
175
|
get children() {
|
|
176
|
-
return _$createComponent(Declaration, {
|
|
176
|
+
return _$createComponent(jv.Declaration, {
|
|
177
177
|
name: "Test",
|
|
178
178
|
get children() {
|
|
179
179
|
return code`
|
|
@@ -229,7 +229,7 @@ it("defines generics", () => {
|
|
|
229
229
|
return _$createComponent(jv.SourceFile, {
|
|
230
230
|
path: "Test.java",
|
|
231
231
|
get children() {
|
|
232
|
-
return _$createComponent(Declaration, {
|
|
232
|
+
return _$createComponent(jv.Declaration, {
|
|
233
233
|
name: "Test",
|
|
234
234
|
get children() {
|
|
235
235
|
return code`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { code,
|
|
2
|
+
import { code, refkey } from "@alloy-js/core";
|
|
3
3
|
import { d } from "@alloy-js/core/testing";
|
|
4
4
|
import { expect, it } from "vitest";
|
|
5
5
|
import * as jv from "../src/components/index.js";
|
|
@@ -52,7 +52,7 @@ it("works with external type", () => {
|
|
|
52
52
|
return _$createComponent(jv.SourceFile, {
|
|
53
53
|
path: "Test.java",
|
|
54
54
|
get children() {
|
|
55
|
-
return _$createComponent(Declaration, {
|
|
55
|
+
return _$createComponent(jv.Declaration, {
|
|
56
56
|
name: "Test",
|
|
57
57
|
get children() {
|
|
58
58
|
return code`
|
|
@@ -103,7 +103,7 @@ it("declares new object", () => {
|
|
|
103
103
|
return _$createComponent(jv.SourceFile, {
|
|
104
104
|
path: "Test.java",
|
|
105
105
|
get children() {
|
|
106
|
-
return _$createComponent(Declaration, {
|
|
106
|
+
return _$createComponent(jv.Declaration, {
|
|
107
107
|
name: "Test",
|
|
108
108
|
get children() {
|
|
109
109
|
return code`
|