@alloy-js/java 0.20.0 → 0.21.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 +2 -2
- package/dist/src/components/Class.d.ts.map +1 -1
- package/dist/src/components/Class.js +4 -4
- package/dist/src/components/Class.js.map +1 -1
- package/dist/src/components/Declaration.d.ts +10 -3
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +3 -1
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/Enum.d.ts +2 -2
- package/dist/src/components/Enum.d.ts.map +1 -1
- package/dist/src/components/Enum.js +4 -2
- package/dist/src/components/Enum.js.map +1 -1
- package/dist/src/components/Interface.d.ts +2 -2
- package/dist/src/components/Interface.d.ts.map +1 -1
- package/dist/src/components/Interface.js +4 -4
- package/dist/src/components/Interface.js.map +1 -1
- package/dist/src/components/ObjectDeclaration.d.ts +2 -2
- package/dist/src/components/ObjectDeclaration.d.ts.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 +1 -1
- package/dist/src/components/Variable.js.map +1 -1
- package/dist/src/symbols/java-output-symbol.d.ts +2 -2
- 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/test/class.test.js +16 -1
- package/dist/test/class.test.js.map +1 -1
- package/dist/test/enum.test.js +14 -1
- package/dist/test/enum.test.js.map +1 -1
- package/dist/test/interface.test.js +14 -1
- package/dist/test/interface.test.js.map +1 -1
- package/dist/test/variables.test.js +33 -1
- package/dist/test/variables.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/components/Class.tsx +4 -7
- package/src/components/Declaration.tsx +12 -2
- package/src/components/Enum.tsx +3 -5
- package/src/components/Interface.tsx +4 -6
- package/src/components/ObjectDeclaration.tsx +2 -2
- package/src/components/Variable.tsx +6 -3
- package/src/symbols/java-output-symbol.ts +2 -1
- package/temp/api.json +154 -79
- package/test/class.test.tsx +13 -1
- package/test/enum.test.tsx +13 -1
- package/test/interface.test.tsx +13 -1
- package/test/variables.test.tsx +21 -1
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Children,
|
|
3
3
|
Declaration as CoreDeclaration,
|
|
4
|
+
Namekey,
|
|
4
5
|
Refkey,
|
|
5
6
|
} from "@alloy-js/core";
|
|
7
|
+
import { JavaElements, useJavaNamePolicy } from "../name-policy.js";
|
|
6
8
|
import { JavaOutputSymbol } from "../symbols/java-output-symbol.js";
|
|
7
9
|
import { useLexicalScope } from "../utils.js";
|
|
8
10
|
|
|
9
|
-
export interface
|
|
11
|
+
export interface CommonDeclarationProps {
|
|
10
12
|
// Name of declaration, should be fully qualified name, e.g me.example.code.Main
|
|
11
|
-
name: string;
|
|
13
|
+
name: string | Namekey;
|
|
12
14
|
refkey?: Refkey;
|
|
13
15
|
children?: Children;
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
export interface DeclarationProps extends CommonDeclarationProps {
|
|
19
|
+
/**
|
|
20
|
+
* The name policy kind to apply to the declaration.
|
|
21
|
+
*/
|
|
22
|
+
nameKind?: JavaElements;
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
/**
|
|
17
26
|
* Declare a symbol in the program. Declaring classes, interfaces, enums, etc. Should also pass in
|
|
18
27
|
* access modifier so we can manage access
|
|
@@ -25,6 +34,7 @@ export function Declaration(props: DeclarationProps) {
|
|
|
25
34
|
|
|
26
35
|
const sym = new JavaOutputSymbol(props.name, scope.symbols, {
|
|
27
36
|
refkeys: props.refkey,
|
|
37
|
+
namePolicy: useJavaNamePolicy().for(props.nameKind),
|
|
28
38
|
});
|
|
29
39
|
return <CoreDeclaration symbol={sym}>{props.children}</CoreDeclaration>;
|
|
30
40
|
}
|
package/src/components/Enum.tsx
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { Block, Children, List } from "@alloy-js/core";
|
|
2
2
|
import { useJavaNamePolicy } from "../name-policy.js";
|
|
3
3
|
import { ArgumentList } from "./ArgumentList.jsx";
|
|
4
|
-
import {
|
|
4
|
+
import { CommonDeclarationProps, Declaration } from "./Declaration.js";
|
|
5
5
|
import { ImplementsClause } from "./ImplementsClause.jsx";
|
|
6
6
|
import { LexicalScope } from "./LexicalScope.jsx";
|
|
7
7
|
import { ModifierProps, Modifiers } from "./Modifiers.jsx";
|
|
8
8
|
import { Name } from "./Name.js";
|
|
9
9
|
|
|
10
|
-
export interface EnumProps extends
|
|
10
|
+
export interface EnumProps extends CommonDeclarationProps, ModifierProps {
|
|
11
11
|
implements?: Children[];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function Enum(props: EnumProps) {
|
|
15
|
-
const name = useJavaNamePolicy().getName(props.name, "enum");
|
|
16
|
-
|
|
17
15
|
return (
|
|
18
|
-
<Declaration {...props} name={name}>
|
|
16
|
+
<Declaration {...props} name={props.name} nameKind="enum">
|
|
19
17
|
<group>
|
|
20
18
|
<Modifiers {...props} />
|
|
21
19
|
enum <Name />
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Block, Children } from "@alloy-js/core";
|
|
2
|
-
import {
|
|
3
|
-
import { Declaration, DeclarationProps } from "./Declaration.js";
|
|
2
|
+
import { CommonDeclarationProps, Declaration } from "./Declaration.js";
|
|
4
3
|
import { ExtendsClause } from "./ExtendsClause.jsx";
|
|
5
4
|
import { LexicalScope } from "./LexicalScope.jsx";
|
|
6
5
|
import { ModifierProps, Modifiers } from "./Modifiers.jsx";
|
|
@@ -8,23 +7,22 @@ import { Name } from "./Name.js";
|
|
|
8
7
|
import { TypeParameters, TypeParametersProps } from "./TypeParameters.jsx";
|
|
9
8
|
|
|
10
9
|
export interface InterfaceProps
|
|
11
|
-
extends
|
|
10
|
+
extends CommonDeclarationProps,
|
|
12
11
|
ModifierProps,
|
|
13
12
|
TypeParametersProps {
|
|
14
13
|
extends?: Children[];
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
export function Interface(props: InterfaceProps) {
|
|
18
|
-
const name = useJavaNamePolicy().getName(props.name, "interface");
|
|
19
17
|
return (
|
|
20
|
-
<Declaration {...props} name={name}>
|
|
18
|
+
<Declaration {...props} name={props.name} nameKind="interface">
|
|
21
19
|
<group>
|
|
22
20
|
<Modifiers {...props} />
|
|
23
21
|
interface <Name />
|
|
24
22
|
<TypeParameters generics={props.generics} />
|
|
25
23
|
<ExtendsClause extends={props.extends} />{" "}
|
|
26
24
|
</group>
|
|
27
|
-
<LexicalScope
|
|
25
|
+
<LexicalScope>
|
|
28
26
|
<Block>{props.children}</Block>
|
|
29
27
|
</LexicalScope>
|
|
30
28
|
</Declaration>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Children, code } from "@alloy-js/core";
|
|
2
2
|
import { ArgumentList } from "./ArgumentList.jsx";
|
|
3
|
-
import {
|
|
3
|
+
import { CommonDeclarationProps } from "./Declaration.js";
|
|
4
4
|
import { ModifierProps } from "./Modifiers.jsx";
|
|
5
5
|
import { Variable } from "./Variable.js";
|
|
6
6
|
|
|
7
7
|
export interface ObjectDeclarationProps
|
|
8
|
-
extends
|
|
8
|
+
extends CommonDeclarationProps,
|
|
9
9
|
ModifierProps {
|
|
10
10
|
type: Children;
|
|
11
11
|
args?: Children[];
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { Children, code } from "@alloy-js/core";
|
|
1
|
+
import { Children, code, Namekey } from "@alloy-js/core";
|
|
2
2
|
import { useJavaNamePolicy } from "../name-policy.js";
|
|
3
3
|
import { ModifierProps, Modifiers } from "./Modifiers.jsx";
|
|
4
4
|
|
|
5
5
|
export interface VariableProps extends ModifierProps {
|
|
6
6
|
type: Children;
|
|
7
|
-
name: string;
|
|
7
|
+
name: string | Namekey;
|
|
8
8
|
value?: Children;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function Variable(props: VariableProps) {
|
|
12
|
-
const name = useJavaNamePolicy().getName(
|
|
12
|
+
const name = useJavaNamePolicy().getName(
|
|
13
|
+
typeof props.name === "string" ? props.name : props.name.name,
|
|
14
|
+
"variable",
|
|
15
|
+
);
|
|
13
16
|
const modifiers = <Modifiers {...props} />;
|
|
14
17
|
|
|
15
18
|
return code`${modifiers}${props.type} ${name}${props.value ? code` = ${props.value}` : ""}`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Namekey,
|
|
2
3
|
OutputSpace,
|
|
3
4
|
OutputSymbol,
|
|
4
5
|
OutputSymbolOptions,
|
|
@@ -25,7 +26,7 @@ export class JavaOutputSymbol extends OutputSymbol {
|
|
|
25
26
|
#package?: string;
|
|
26
27
|
|
|
27
28
|
constructor(
|
|
28
|
-
name: string,
|
|
29
|
+
name: string | Namekey,
|
|
29
30
|
spaces: OutputSpace[] | OutputSpace | undefined,
|
|
30
31
|
options: JavaOutputSymbolOptions = {},
|
|
31
32
|
) {
|
package/temp/api.json
CHANGED
|
@@ -488,8 +488,8 @@
|
|
|
488
488
|
},
|
|
489
489
|
{
|
|
490
490
|
"kind": "Reference",
|
|
491
|
-
"text": "
|
|
492
|
-
"canonicalReference": "@alloy-js/java!
|
|
491
|
+
"text": "CommonDeclarationProps",
|
|
492
|
+
"canonicalReference": "@alloy-js/java!CommonDeclarationProps:interface"
|
|
493
493
|
},
|
|
494
494
|
{
|
|
495
495
|
"kind": "Content",
|
|
@@ -595,6 +595,112 @@
|
|
|
595
595
|
}
|
|
596
596
|
]
|
|
597
597
|
},
|
|
598
|
+
{
|
|
599
|
+
"kind": "Interface",
|
|
600
|
+
"canonicalReference": "@alloy-js/java!CommonDeclarationProps:interface",
|
|
601
|
+
"docComment": "",
|
|
602
|
+
"excerptTokens": [
|
|
603
|
+
{
|
|
604
|
+
"kind": "Content",
|
|
605
|
+
"text": "export interface CommonDeclarationProps "
|
|
606
|
+
}
|
|
607
|
+
],
|
|
608
|
+
"fileUrlPath": "src/components/Declaration.tsx",
|
|
609
|
+
"releaseTag": "Public",
|
|
610
|
+
"name": "CommonDeclarationProps",
|
|
611
|
+
"preserveMemberOrder": false,
|
|
612
|
+
"members": [
|
|
613
|
+
{
|
|
614
|
+
"kind": "PropertySignature",
|
|
615
|
+
"canonicalReference": "@alloy-js/java!CommonDeclarationProps#children:member",
|
|
616
|
+
"docComment": "",
|
|
617
|
+
"excerptTokens": [
|
|
618
|
+
{
|
|
619
|
+
"kind": "Content",
|
|
620
|
+
"text": "children?: "
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
"kind": "Reference",
|
|
624
|
+
"text": "Children",
|
|
625
|
+
"canonicalReference": "@alloy-js/core!Children:type"
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
"kind": "Content",
|
|
629
|
+
"text": ";"
|
|
630
|
+
}
|
|
631
|
+
],
|
|
632
|
+
"isReadonly": false,
|
|
633
|
+
"isOptional": true,
|
|
634
|
+
"releaseTag": "Public",
|
|
635
|
+
"name": "children",
|
|
636
|
+
"propertyTypeTokenRange": {
|
|
637
|
+
"startIndex": 1,
|
|
638
|
+
"endIndex": 2
|
|
639
|
+
}
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
"kind": "PropertySignature",
|
|
643
|
+
"canonicalReference": "@alloy-js/java!CommonDeclarationProps#name:member",
|
|
644
|
+
"docComment": "",
|
|
645
|
+
"excerptTokens": [
|
|
646
|
+
{
|
|
647
|
+
"kind": "Content",
|
|
648
|
+
"text": "name: "
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
"kind": "Content",
|
|
652
|
+
"text": "string | "
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"kind": "Reference",
|
|
656
|
+
"text": "Namekey",
|
|
657
|
+
"canonicalReference": "@alloy-js/core!Namekey:interface"
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
"kind": "Content",
|
|
661
|
+
"text": ";"
|
|
662
|
+
}
|
|
663
|
+
],
|
|
664
|
+
"isReadonly": false,
|
|
665
|
+
"isOptional": false,
|
|
666
|
+
"releaseTag": "Public",
|
|
667
|
+
"name": "name",
|
|
668
|
+
"propertyTypeTokenRange": {
|
|
669
|
+
"startIndex": 1,
|
|
670
|
+
"endIndex": 3
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
"kind": "PropertySignature",
|
|
675
|
+
"canonicalReference": "@alloy-js/java!CommonDeclarationProps#refkey:member",
|
|
676
|
+
"docComment": "",
|
|
677
|
+
"excerptTokens": [
|
|
678
|
+
{
|
|
679
|
+
"kind": "Content",
|
|
680
|
+
"text": "refkey?: "
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
"kind": "Reference",
|
|
684
|
+
"text": "Refkey",
|
|
685
|
+
"canonicalReference": "@alloy-js/core!Refkey:type"
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
"kind": "Content",
|
|
689
|
+
"text": ";"
|
|
690
|
+
}
|
|
691
|
+
],
|
|
692
|
+
"isReadonly": false,
|
|
693
|
+
"isOptional": true,
|
|
694
|
+
"releaseTag": "Public",
|
|
695
|
+
"name": "refkey",
|
|
696
|
+
"propertyTypeTokenRange": {
|
|
697
|
+
"startIndex": 1,
|
|
698
|
+
"endIndex": 2
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
],
|
|
702
|
+
"extendsTokenRanges": []
|
|
703
|
+
},
|
|
598
704
|
{
|
|
599
705
|
"kind": "Function",
|
|
600
706
|
"canonicalReference": "@alloy-js/java!Constructor:function(1)",
|
|
@@ -1096,7 +1202,16 @@
|
|
|
1096
1202
|
"excerptTokens": [
|
|
1097
1203
|
{
|
|
1098
1204
|
"kind": "Content",
|
|
1099
|
-
"text": "export interface DeclarationProps "
|
|
1205
|
+
"text": "export interface DeclarationProps extends "
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
"kind": "Reference",
|
|
1209
|
+
"text": "CommonDeclarationProps",
|
|
1210
|
+
"canonicalReference": "@alloy-js/java!CommonDeclarationProps:interface"
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
"kind": "Content",
|
|
1214
|
+
"text": " "
|
|
1100
1215
|
}
|
|
1101
1216
|
],
|
|
1102
1217
|
"fileUrlPath": "src/components/Declaration.tsx",
|
|
@@ -1106,17 +1221,17 @@
|
|
|
1106
1221
|
"members": [
|
|
1107
1222
|
{
|
|
1108
1223
|
"kind": "PropertySignature",
|
|
1109
|
-
"canonicalReference": "@alloy-js/java!DeclarationProps#
|
|
1110
|
-
"docComment": "",
|
|
1224
|
+
"canonicalReference": "@alloy-js/java!DeclarationProps#nameKind:member",
|
|
1225
|
+
"docComment": "/**\n * The name policy kind to apply to the declaration.\n */\n",
|
|
1111
1226
|
"excerptTokens": [
|
|
1112
1227
|
{
|
|
1113
1228
|
"kind": "Content",
|
|
1114
|
-
"text": "
|
|
1229
|
+
"text": "nameKind?: "
|
|
1115
1230
|
},
|
|
1116
1231
|
{
|
|
1117
1232
|
"kind": "Reference",
|
|
1118
|
-
"text": "
|
|
1119
|
-
"canonicalReference": "@alloy-js/
|
|
1233
|
+
"text": "JavaElements",
|
|
1234
|
+
"canonicalReference": "@alloy-js/java!JavaElements:type"
|
|
1120
1235
|
},
|
|
1121
1236
|
{
|
|
1122
1237
|
"kind": "Content",
|
|
@@ -1126,69 +1241,19 @@
|
|
|
1126
1241
|
"isReadonly": false,
|
|
1127
1242
|
"isOptional": true,
|
|
1128
1243
|
"releaseTag": "Public",
|
|
1129
|
-
"name": "
|
|
1130
|
-
"propertyTypeTokenRange": {
|
|
1131
|
-
"startIndex": 1,
|
|
1132
|
-
"endIndex": 2
|
|
1133
|
-
}
|
|
1134
|
-
},
|
|
1135
|
-
{
|
|
1136
|
-
"kind": "PropertySignature",
|
|
1137
|
-
"canonicalReference": "@alloy-js/java!DeclarationProps#name:member",
|
|
1138
|
-
"docComment": "",
|
|
1139
|
-
"excerptTokens": [
|
|
1140
|
-
{
|
|
1141
|
-
"kind": "Content",
|
|
1142
|
-
"text": "name: "
|
|
1143
|
-
},
|
|
1144
|
-
{
|
|
1145
|
-
"kind": "Content",
|
|
1146
|
-
"text": "string"
|
|
1147
|
-
},
|
|
1148
|
-
{
|
|
1149
|
-
"kind": "Content",
|
|
1150
|
-
"text": ";"
|
|
1151
|
-
}
|
|
1152
|
-
],
|
|
1153
|
-
"isReadonly": false,
|
|
1154
|
-
"isOptional": false,
|
|
1155
|
-
"releaseTag": "Public",
|
|
1156
|
-
"name": "name",
|
|
1157
|
-
"propertyTypeTokenRange": {
|
|
1158
|
-
"startIndex": 1,
|
|
1159
|
-
"endIndex": 2
|
|
1160
|
-
}
|
|
1161
|
-
},
|
|
1162
|
-
{
|
|
1163
|
-
"kind": "PropertySignature",
|
|
1164
|
-
"canonicalReference": "@alloy-js/java!DeclarationProps#refkey:member",
|
|
1165
|
-
"docComment": "",
|
|
1166
|
-
"excerptTokens": [
|
|
1167
|
-
{
|
|
1168
|
-
"kind": "Content",
|
|
1169
|
-
"text": "refkey?: "
|
|
1170
|
-
},
|
|
1171
|
-
{
|
|
1172
|
-
"kind": "Reference",
|
|
1173
|
-
"text": "Refkey",
|
|
1174
|
-
"canonicalReference": "@alloy-js/core!Refkey:type"
|
|
1175
|
-
},
|
|
1176
|
-
{
|
|
1177
|
-
"kind": "Content",
|
|
1178
|
-
"text": ";"
|
|
1179
|
-
}
|
|
1180
|
-
],
|
|
1181
|
-
"isReadonly": false,
|
|
1182
|
-
"isOptional": true,
|
|
1183
|
-
"releaseTag": "Public",
|
|
1184
|
-
"name": "refkey",
|
|
1244
|
+
"name": "nameKind",
|
|
1185
1245
|
"propertyTypeTokenRange": {
|
|
1186
1246
|
"startIndex": 1,
|
|
1187
1247
|
"endIndex": 2
|
|
1188
1248
|
}
|
|
1189
1249
|
}
|
|
1190
1250
|
],
|
|
1191
|
-
"extendsTokenRanges": [
|
|
1251
|
+
"extendsTokenRanges": [
|
|
1252
|
+
{
|
|
1253
|
+
"startIndex": 1,
|
|
1254
|
+
"endIndex": 2
|
|
1255
|
+
}
|
|
1256
|
+
]
|
|
1192
1257
|
},
|
|
1193
1258
|
{
|
|
1194
1259
|
"kind": "Function",
|
|
@@ -1479,8 +1544,8 @@
|
|
|
1479
1544
|
},
|
|
1480
1545
|
{
|
|
1481
1546
|
"kind": "Reference",
|
|
1482
|
-
"text": "
|
|
1483
|
-
"canonicalReference": "@alloy-js/java!
|
|
1547
|
+
"text": "CommonDeclarationProps",
|
|
1548
|
+
"canonicalReference": "@alloy-js/java!CommonDeclarationProps:interface"
|
|
1484
1549
|
},
|
|
1485
1550
|
{
|
|
1486
1551
|
"kind": "Content",
|
|
@@ -2119,8 +2184,8 @@
|
|
|
2119
2184
|
},
|
|
2120
2185
|
{
|
|
2121
2186
|
"kind": "Reference",
|
|
2122
|
-
"text": "
|
|
2123
|
-
"canonicalReference": "@alloy-js/java!
|
|
2187
|
+
"text": "CommonDeclarationProps",
|
|
2188
|
+
"canonicalReference": "@alloy-js/java!CommonDeclarationProps:interface"
|
|
2124
2189
|
},
|
|
2125
2190
|
{
|
|
2126
2191
|
"kind": "Content",
|
|
@@ -2519,7 +2584,12 @@
|
|
|
2519
2584
|
},
|
|
2520
2585
|
{
|
|
2521
2586
|
"kind": "Content",
|
|
2522
|
-
"text": "string"
|
|
2587
|
+
"text": "string | "
|
|
2588
|
+
},
|
|
2589
|
+
{
|
|
2590
|
+
"kind": "Reference",
|
|
2591
|
+
"text": "Namekey",
|
|
2592
|
+
"canonicalReference": "@alloy-js/core!Namekey:interface"
|
|
2523
2593
|
},
|
|
2524
2594
|
{
|
|
2525
2595
|
"kind": "Content",
|
|
@@ -2565,23 +2635,23 @@
|
|
|
2565
2635
|
"parameterName": "name",
|
|
2566
2636
|
"parameterTypeTokenRange": {
|
|
2567
2637
|
"startIndex": 1,
|
|
2568
|
-
"endIndex":
|
|
2638
|
+
"endIndex": 3
|
|
2569
2639
|
},
|
|
2570
2640
|
"isOptional": false
|
|
2571
2641
|
},
|
|
2572
2642
|
{
|
|
2573
2643
|
"parameterName": "spaces",
|
|
2574
2644
|
"parameterTypeTokenRange": {
|
|
2575
|
-
"startIndex":
|
|
2576
|
-
"endIndex":
|
|
2645
|
+
"startIndex": 4,
|
|
2646
|
+
"endIndex": 8
|
|
2577
2647
|
},
|
|
2578
2648
|
"isOptional": false
|
|
2579
2649
|
},
|
|
2580
2650
|
{
|
|
2581
2651
|
"parameterName": "options",
|
|
2582
2652
|
"parameterTypeTokenRange": {
|
|
2583
|
-
"startIndex":
|
|
2584
|
-
"endIndex":
|
|
2653
|
+
"startIndex": 9,
|
|
2654
|
+
"endIndex": 10
|
|
2585
2655
|
},
|
|
2586
2656
|
"isOptional": true
|
|
2587
2657
|
}
|
|
@@ -4695,8 +4765,8 @@
|
|
|
4695
4765
|
},
|
|
4696
4766
|
{
|
|
4697
4767
|
"kind": "Reference",
|
|
4698
|
-
"text": "
|
|
4699
|
-
"canonicalReference": "@alloy-js/java!
|
|
4768
|
+
"text": "CommonDeclarationProps",
|
|
4769
|
+
"canonicalReference": "@alloy-js/java!CommonDeclarationProps:interface"
|
|
4700
4770
|
},
|
|
4701
4771
|
{
|
|
4702
4772
|
"kind": "Content",
|
|
@@ -6581,7 +6651,12 @@
|
|
|
6581
6651
|
},
|
|
6582
6652
|
{
|
|
6583
6653
|
"kind": "Content",
|
|
6584
|
-
"text": "string"
|
|
6654
|
+
"text": "string | "
|
|
6655
|
+
},
|
|
6656
|
+
{
|
|
6657
|
+
"kind": "Reference",
|
|
6658
|
+
"text": "Namekey",
|
|
6659
|
+
"canonicalReference": "@alloy-js/core!Namekey:interface"
|
|
6585
6660
|
},
|
|
6586
6661
|
{
|
|
6587
6662
|
"kind": "Content",
|
|
@@ -6594,7 +6669,7 @@
|
|
|
6594
6669
|
"name": "name",
|
|
6595
6670
|
"propertyTypeTokenRange": {
|
|
6596
6671
|
"startIndex": 1,
|
|
6597
|
-
"endIndex":
|
|
6672
|
+
"endIndex": 3
|
|
6598
6673
|
}
|
|
6599
6674
|
},
|
|
6600
6675
|
{
|
package/test/class.test.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { code, refkey } from "@alloy-js/core";
|
|
1
|
+
import { code, namekey, refkey } from "@alloy-js/core";
|
|
2
2
|
import { d } from "@alloy-js/core/testing";
|
|
3
3
|
import { expect, it } from "vitest";
|
|
4
4
|
import * as jv from "../src/components/index.js";
|
|
@@ -16,6 +16,18 @@ it("works", () => {
|
|
|
16
16
|
`);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
+
it("takes a namekey", () => {
|
|
20
|
+
const res = toSourceText(
|
|
21
|
+
<jv.Class public abstract final name={namekey("TestClass")}></jv.Class>,
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
expect(res).toBe(d`
|
|
25
|
+
package me.test.code;
|
|
26
|
+
|
|
27
|
+
public abstract final class TestClass {}
|
|
28
|
+
`);
|
|
29
|
+
});
|
|
30
|
+
|
|
19
31
|
it("extends class", () => {
|
|
20
32
|
const res = testRender(
|
|
21
33
|
<>
|
package/test/enum.test.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { code, refkey } from "@alloy-js/core";
|
|
1
|
+
import { code, namekey, refkey } from "@alloy-js/core";
|
|
2
2
|
import { d } from "@alloy-js/core/testing";
|
|
3
3
|
import { expect, it } from "vitest";
|
|
4
4
|
import * as jv from "../src/components/index.js";
|
|
@@ -14,6 +14,18 @@ it("works", () => {
|
|
|
14
14
|
`);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
+
it("takes a namekey", () => {
|
|
18
|
+
const res = toSourceText(
|
|
19
|
+
<jv.Enum public name={namekey("TestEnum")}></jv.Enum>,
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
expect(res).toBe(d`
|
|
23
|
+
package me.test.code;
|
|
24
|
+
|
|
25
|
+
public enum TestEnum {}
|
|
26
|
+
`);
|
|
27
|
+
});
|
|
28
|
+
|
|
17
29
|
it("implements interfaces", () => {
|
|
18
30
|
const res = testRender(
|
|
19
31
|
<>
|
package/test/interface.test.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { refkey } from "@alloy-js/core";
|
|
1
|
+
import { namekey, refkey } from "@alloy-js/core";
|
|
2
2
|
import { d } from "@alloy-js/core/testing";
|
|
3
3
|
import { expect, it } from "vitest";
|
|
4
4
|
import * as jv from "../src/components/index.js";
|
|
@@ -16,6 +16,18 @@ it("works", () => {
|
|
|
16
16
|
`);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
+
it("takes a namekey", () => {
|
|
20
|
+
const res = toSourceText(
|
|
21
|
+
<jv.Interface public name={namekey("TestInterface")}></jv.Interface>,
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
expect(res).toBe(d`
|
|
25
|
+
package me.test.code;
|
|
26
|
+
|
|
27
|
+
public interface TestInterface {}
|
|
28
|
+
`);
|
|
29
|
+
});
|
|
30
|
+
|
|
19
31
|
it("extends other interfaces", () => {
|
|
20
32
|
const res = testRender(
|
|
21
33
|
<>
|
package/test/variables.test.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { code, refkey } from "@alloy-js/core";
|
|
1
|
+
import { code, namekey, refkey } from "@alloy-js/core";
|
|
2
2
|
import { d } from "@alloy-js/core/testing";
|
|
3
3
|
import { expect, it } from "vitest";
|
|
4
4
|
import * as jv from "../src/components/index.js";
|
|
@@ -24,6 +24,26 @@ it("works", () => {
|
|
|
24
24
|
`);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
+
it("takes a namekey", () => {
|
|
28
|
+
const res = toSourceText(
|
|
29
|
+
<jv.Declaration name={namekey("Test")}>
|
|
30
|
+
{code`
|
|
31
|
+
class Test {
|
|
32
|
+
${(<jv.Variable public static final type="String" name="myVar" value={<jv.Value value="Test" />} />)};
|
|
33
|
+
}
|
|
34
|
+
`}
|
|
35
|
+
</jv.Declaration>,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
expect(res).toBe(d`
|
|
39
|
+
package me.test.code;
|
|
40
|
+
|
|
41
|
+
class Test {
|
|
42
|
+
public static final String myVar = "Test";
|
|
43
|
+
}
|
|
44
|
+
`);
|
|
45
|
+
});
|
|
46
|
+
|
|
27
47
|
it("works with external type", () => {
|
|
28
48
|
const res = testRender(
|
|
29
49
|
<>
|