@glutinum/cli 0.14.1 → 1.0.0-beta.10
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/README.md +16 -0
- package/dist/Glutinum.Converter/Abbreviations.js +9 -32
- package/dist/Glutinum.Converter/DelegateExtensions.js +378 -0
- package/dist/Glutinum.Converter/FreeTypeParameters.js +211 -0
- package/dist/Glutinum.Converter/FsharpAST.js +154 -69
- package/dist/Glutinum.Converter/Generate.js +44 -23
- package/dist/Glutinum.Converter/GlueAST.js +122 -74
- package/dist/Glutinum.Converter/Hosting.js +892 -0
- package/dist/Glutinum.Converter/Merge.js +469 -301
- package/dist/Glutinum.Converter/Packages.js +403 -77
- package/dist/Glutinum.Converter/Printer.js +455 -388
- package/dist/Glutinum.Converter/Read.js +366 -104
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +9 -9
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
- package/dist/Glutinum.Converter/Reader/Declaration.js +24 -30
- package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
- package/dist/Glutinum.Converter/Reader/Documentation.js +56 -67
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +105 -38
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +52 -55
- package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +28 -16
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +46 -45
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +48 -5
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +82 -4
- package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +55 -7
- package/dist/Glutinum.Converter/Reader/Node.js +23 -26
- package/dist/Glutinum.Converter/Reader/Parameters.js +39 -30
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +5 -5
- package/dist/Glutinum.Converter/Reader/TypeNode.js +410 -1545
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +78 -51
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +116 -71
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +25 -7
- package/dist/Glutinum.Converter/Reader/Types.js +296 -16
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +21 -34
- package/dist/Glutinum.Converter/Reader/UtilityType.js +811 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +584 -148
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +2 -3
- package/dist/Glutinum.Converter/Transform.js +2971 -6875
- package/dist/Glutinum.Converter/Transformer/AnyFunctionOverloads.js +116 -0
- package/dist/Glutinum.Converter/Transformer/CallableProperties.js +454 -0
- package/dist/Glutinum.Converter/Transformer/Comment.js +136 -0
- package/dist/Glutinum.Converter/Transformer/Conditionals.js +1087 -0
- package/dist/Glutinum.Converter/Transformer/Context.js +678 -0
- package/dist/Glutinum.Converter/Transformer/Enum.js +80 -0
- package/dist/Glutinum.Converter/Transformer/Exports.js +704 -0
- package/dist/Glutinum.Converter/Transformer/Heritage.js +493 -0
- package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +488 -0
- package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +460 -0
- package/dist/Glutinum.Converter/Transformer/TypeParameter.js +219 -0
- package/dist/Glutinum.Converter/Transformer/TypeParameters.js +448 -0
- package/dist/Glutinum.Converter/Transformer/UnionOverloads.js +356 -0
- package/dist/Glutinum.Converter/Transformer/Utils.js +341 -0
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +193 -211
- package/dist/Glutinum.Converter/Utils/Naming.js +7 -0
- package/dist/Glutinum.Converter/Utils/String.js +15 -4
- package/dist/Program.js +107 -232
- package/package.json +4 -3
- package/dist/Glutinum.Converter/TypeScript.js +0 -12
- package/src/Glutinum.Converter/js/bootstrap.js +0 -123
- package/src/Glutinum.Converter/js/host.js +0 -144
- package/src/Glutinum.Converter/js/npm.js +0 -137
- package/src/Glutinum.Converter/js/resolve.js +0 -402
|
@@ -1,14 +1,92 @@
|
|
|
1
1
|
|
|
2
|
+
import { entityNameText, identifierText } from "./Utils.js";
|
|
3
|
+
import { exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
4
|
+
import { equals } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
5
|
+
import { ts } from "@ts-morph/bootstrap";
|
|
2
6
|
import { FSharpResult$2 } from "../../fable_modules/fable-library-js.5.17.2/Result.js";
|
|
3
7
|
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
4
8
|
import { head, tail, isEmpty, length } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
5
9
|
import { GlueType, GlueMappedType } from "../GlueAST.js";
|
|
6
10
|
|
|
11
|
+
function tryIdentitySource(reader, mappedTypeNode) {
|
|
12
|
+
let templateNode, constraintNode;
|
|
13
|
+
const matchValue = mappedTypeNode.readonlyToken;
|
|
14
|
+
const matchValue_1 = mappedTypeNode.questionToken;
|
|
15
|
+
const matchValue_2 = mappedTypeNode.typeParameter.constraint;
|
|
16
|
+
const matchValue_3 = mappedTypeNode.type;
|
|
17
|
+
let matchResult, constraintNode_1, templateNode_1;
|
|
18
|
+
if (matchValue == null) {
|
|
19
|
+
if (matchValue_1 == null) {
|
|
20
|
+
if (matchValue_2 != null) {
|
|
21
|
+
if (matchValue_3 != null) {
|
|
22
|
+
if ((templateNode = matchValue_3, (constraintNode = matchValue_2, ((constraintNode.kind === 199) && (constraintNode.operator === 143)) && (templateNode.kind === 200)))) {
|
|
23
|
+
matchResult = 0;
|
|
24
|
+
constraintNode_1 = matchValue_2;
|
|
25
|
+
templateNode_1 = matchValue_3;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
matchResult = 1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
matchResult = 1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
matchResult = 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
matchResult = 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
matchResult = 1;
|
|
45
|
+
}
|
|
46
|
+
switch (matchResult) {
|
|
47
|
+
case 0: {
|
|
48
|
+
const keyName = identifierText(mappedTypeNode.typeParameter.name);
|
|
49
|
+
const indexed = templateNode_1;
|
|
50
|
+
const isKey = (node) => {
|
|
51
|
+
if (node.kind === 184) {
|
|
52
|
+
return entityNameText(node.typeName) === keyName;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
let remapKeepsKey;
|
|
59
|
+
const matchValue_5 = mappedTypeNode.nameType;
|
|
60
|
+
if (matchValue_5 != null) {
|
|
61
|
+
const nameType = matchValue_5;
|
|
62
|
+
remapKeepsKey = ((nameType.kind === 193) && exists(isKey, nameType.types));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
remapKeepsKey = true;
|
|
66
|
+
}
|
|
67
|
+
if (isKey(indexed.indexType) && remapKeepsKey) {
|
|
68
|
+
const source_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constraintNode_1.type);
|
|
69
|
+
if (equals(source_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](indexed.objectType))) {
|
|
70
|
+
return source_1;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
default:
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
7
85
|
export function readMappedTypeNode(reader, mappedTypeNode) {
|
|
8
|
-
let input_1, typNode;
|
|
86
|
+
let matchValue, input_1, typNode;
|
|
9
87
|
let _arg_1;
|
|
10
88
|
let input_2;
|
|
11
|
-
const typeParameters = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
89
|
+
const typeParameters = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"]((ts.factory).createNodeArray([mappedTypeNode.typeParameter]));
|
|
12
90
|
let matchResult, tp;
|
|
13
91
|
if (!isEmpty(typeParameters)) {
|
|
14
92
|
if (isEmpty(tail(typeParameters))) {
|
|
@@ -28,9 +106,9 @@ export function readMappedTypeNode(reader, mappedTypeNode) {
|
|
|
28
106
|
break;
|
|
29
107
|
}
|
|
30
108
|
default:
|
|
31
|
-
input_2 = (new FSharpResult$2(/* Error */ 1, [Report_readerError_Z19516DCE("readMappedTypeNode", `Expected exactly one type parameter but was ${length(typeParameters)}`, mappedTypeNode, "/_//src/Glutinum.Converter/Reader/MappedTypeNode.fs",
|
|
109
|
+
input_2 = (new FSharpResult$2(/* Error */ 1, [Report_readerError_Z19516DCE("readMappedTypeNode", `Expected exactly one type parameter but was ${length(typeParameters)}`, mappedTypeNode, "/_//src/Glutinum.Converter/Reader/MappedTypeNode.fs", 60)]));
|
|
32
110
|
}
|
|
33
|
-
_arg_1 = ((input_2.tag === 1) ? (new FSharpResult$2(/* Error */ 1, [input_2.fields[0]])) : (new FSharpResult$2(/* Ok */ 0, [new GlueType(/* MappedType */
|
|
111
|
+
_arg_1 = ((input_2.tag === 1) ? (new FSharpResult$2(/* Error */ 1, [input_2.fields[0]])) : (new FSharpResult$2(/* Ok */ 0, [(matchValue = tryIdentitySource(reader, mappedTypeNode), (matchValue == null) ? (new GlueType(/* MappedType */ 28, [new GlueMappedType(input_2.fields[0], (input_1 = mappedTypeNode.type, (input_1 == null) ? undefined : ((typNode = input_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode)))))])) : matchValue)])));
|
|
34
112
|
if (_arg_1.tag === 1) {
|
|
35
113
|
void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(_arg_1.fields[0]));
|
|
36
114
|
return GlueType.Discard;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
|
|
2
|
+
import { Union } from "../../fable_modules/fable-library-js.5.17.2/Types.js";
|
|
3
|
+
import { union_type, class_type } from "../../fable_modules/fable-library-js.5.17.2/Reflection.js";
|
|
4
|
+
import { enclosingDeclarationOf, $007CHasSymbolFlags$007C_$007C, typeNodeBuilderFlags } from "./Utils.js";
|
|
5
|
+
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
6
|
+
import { concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
|
|
7
|
+
import { empty } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
8
|
+
import { GlueMethod, GlueMethodSignature, GlueMember, GlueProperty, GlueAccessor } from "../GlueAST.js";
|
|
9
|
+
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.17.2/FSharp.Core.js";
|
|
10
|
+
|
|
11
|
+
export class IntersectionTypePropertyResult extends Union {
|
|
12
|
+
constructor(tag, fields) {
|
|
13
|
+
super();
|
|
14
|
+
this.tag = tag;
|
|
15
|
+
this.fields = fields;
|
|
16
|
+
}
|
|
17
|
+
cases() {
|
|
18
|
+
return ["Single", "WithoutDeclaration", "ForceAny"];
|
|
19
|
+
}
|
|
20
|
+
static ForceAny = new IntersectionTypePropertyResult(2, []);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function IntersectionTypePropertyResult_$reflection() {
|
|
24
|
+
return union_type("Glutinum.Converter.Reader.MemberTypes.IntersectionTypePropertyResult", [], IntersectionTypePropertyResult, () => [[["Item1", class_type("TypeScript.Ts.Symbol")], ["Item2", class_type("TypeScript.Ts.Declaration")]], [["Item", class_type("TypeScript.Ts.Symbol")]], []]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function readPropertyWithoutDeclaration(reader, contextNode, property) {
|
|
28
|
+
let matchValue_1;
|
|
29
|
+
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeOfSymbol(property);
|
|
30
|
+
const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, typeNodeBuilderFlags);
|
|
31
|
+
if (matchValue == null) {
|
|
32
|
+
const item = Report_readerError_Z19516DCE("type node", concat("Could not resolve the type of the property \'", property.name, "\'"), contextNode, "/_//src/Glutinum.Converter/Reader/MemberTypes.fs", 52);
|
|
33
|
+
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
34
|
+
void (objectArg.push(item));
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const typeNode = matchValue;
|
|
39
|
+
const previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
|
|
40
|
+
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](contextNode);
|
|
41
|
+
let propertyType;
|
|
42
|
+
try {
|
|
43
|
+
propertyType = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode);
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
|
|
47
|
+
}
|
|
48
|
+
return new GlueMember(/* Property */ 1, [new GlueProperty(property.name, empty(), propertyType, false, (matchValue_1 = property.flags, $007CHasSymbolFlags$007C_$007C(16777216, matchValue_1) != null), GlueAccessor.ReadWrite, false)]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function readInstantiatedMember(reader, contextNode, property, declaration) {
|
|
53
|
+
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
54
|
+
const instantiatedType = checker.getTypeOfSymbol(property);
|
|
55
|
+
const isInstantiated = !Operators_IsNull(declaration.symbol) && !(instantiatedType === checker.getTypeOfSymbol(declaration.symbol));
|
|
56
|
+
const declaredMember = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration);
|
|
57
|
+
if (!isInstantiated) {
|
|
58
|
+
return declaredMember;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const matchValue = checker.typeToTypeNode(instantiatedType, enclosingDeclarationOf(contextNode), typeNodeBuilderFlags);
|
|
62
|
+
if (matchValue != null) {
|
|
63
|
+
const typeNode = matchValue;
|
|
64
|
+
const previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
|
|
65
|
+
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](contextNode);
|
|
66
|
+
let instantiatedMember;
|
|
67
|
+
try {
|
|
68
|
+
instantiatedMember = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode);
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
|
|
72
|
+
}
|
|
73
|
+
let matchResult, info, typ, functionType, info_1, functionType_1, info_2, declaredMember_1;
|
|
74
|
+
switch (declaredMember.tag) {
|
|
75
|
+
case 1: {
|
|
76
|
+
matchResult = 0;
|
|
77
|
+
info = declaredMember.fields[0];
|
|
78
|
+
typ = instantiatedMember;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
case 6: {
|
|
82
|
+
if (instantiatedMember.tag === 15) {
|
|
83
|
+
matchResult = 1;
|
|
84
|
+
functionType = instantiatedMember.fields[0];
|
|
85
|
+
info_1 = declaredMember.fields[0];
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
matchResult = 3;
|
|
89
|
+
declaredMember_1 = declaredMember;
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case 0: {
|
|
94
|
+
if (instantiatedMember.tag === 15) {
|
|
95
|
+
matchResult = 2;
|
|
96
|
+
functionType_1 = instantiatedMember.fields[0];
|
|
97
|
+
info_2 = declaredMember.fields[0];
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
matchResult = 3;
|
|
101
|
+
declaredMember_1 = declaredMember;
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
default: {
|
|
106
|
+
matchResult = 3;
|
|
107
|
+
declaredMember_1 = declaredMember;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
switch (matchResult) {
|
|
111
|
+
case 0:
|
|
112
|
+
return new GlueMember(/* Property */ 1, [new GlueProperty(info.Name, info.Documentation, typ, info.IsStatic, info.IsOptional, info.Accessor, info.IsPrivate)]);
|
|
113
|
+
case 1:
|
|
114
|
+
return new GlueMember(/* MethodSignature */ 6, [new GlueMethodSignature(info_1.Name, info_1.Documentation, info_1.TypeParameters, functionType.Parameters, functionType.Type, info_1.IsOptional)]);
|
|
115
|
+
case 2:
|
|
116
|
+
return new GlueMember(/* Method */ 0, [new GlueMethod(info_2.Name, info_2.Documentation, info_2.TypeParameters, functionType_1.Parameters, functionType_1.Type, info_2.IsOptional, info_2.IsStatic)]);
|
|
117
|
+
default:
|
|
118
|
+
return declaredMember_1;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return declaredMember;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
@@ -1,26 +1,74 @@
|
|
|
1
1
|
|
|
2
2
|
import { choose, concat, toList, exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { isExportedDeclaration, isGlobalAugmentation, isTopLevelModuleDeclaration, isMergedInterfaceDeclaration, identifierText } from "./Utils.js";
|
|
4
|
+
import { ofSeq, filter, empty, map, collect, singleton } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
5
|
+
import { singleton as singleton_1 } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
|
|
6
|
+
import { comparePrimitives } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
5
7
|
import { GlueModuleDeclaration } from "../GlueAST.js";
|
|
6
8
|
|
|
7
9
|
export function readModuleDeclaration(reader, declaration) {
|
|
8
10
|
const name = declaration.name;
|
|
9
11
|
const children = declaration.getChildren();
|
|
10
|
-
const
|
|
12
|
+
const isBodyOfDottedName = (declaration.parent.kind === 268) && (declaration.parent.body === declaration);
|
|
13
|
+
const isNamespace = isBodyOfDottedName ? true : exists((node) => (node.kind === 145), children);
|
|
14
|
+
const isAmbientModule = declaration.name.kind === 11;
|
|
15
|
+
const isExportAssigned = exists((statement) => {
|
|
16
|
+
if (statement.kind === 278) {
|
|
17
|
+
const expression = statement.expression;
|
|
18
|
+
if (expression.kind === 80) {
|
|
19
|
+
return identifierText(expression) === name.getText();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}, declaration.getSourceFile().statements);
|
|
11
29
|
const types = toList(concat(choose((child) => {
|
|
12
30
|
const matchValue = child.kind;
|
|
13
31
|
switch (matchValue) {
|
|
14
|
-
case
|
|
32
|
+
case 268:
|
|
15
33
|
return singleton(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](child));
|
|
16
|
-
case
|
|
34
|
+
case 269: {
|
|
17
35
|
const moduleBlock = child;
|
|
18
|
-
return
|
|
36
|
+
return collect((statement_2) => {
|
|
37
|
+
let exportClause;
|
|
38
|
+
if (statement_2.kind === 279) {
|
|
39
|
+
const exportDeclaration = statement_2;
|
|
40
|
+
const matchValue_2 = exportDeclaration.exportClause;
|
|
41
|
+
let matchResult, exportClause_1;
|
|
42
|
+
if (matchValue_2 != null) {
|
|
43
|
+
if ((exportClause = matchValue_2, (exportDeclaration.moduleSpecifier == null) && (exportClause.kind === 280))) {
|
|
44
|
+
matchResult = 0;
|
|
45
|
+
exportClause_1 = matchValue_2;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
matchResult = 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
matchResult = 1;
|
|
53
|
+
}
|
|
54
|
+
switch (matchResult) {
|
|
55
|
+
case 0:
|
|
56
|
+
return map((node_1) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](node_1), toList(exportClause_1.elements));
|
|
57
|
+
default:
|
|
58
|
+
return empty();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return singleton(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](statement_2));
|
|
63
|
+
}
|
|
64
|
+
}, filter((statement_1) => !isMergedInterfaceDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), statement_1), ofSeq(moduleBlock.statements)));
|
|
19
65
|
}
|
|
20
66
|
default:
|
|
21
67
|
return undefined;
|
|
22
68
|
}
|
|
23
69
|
}, children)));
|
|
24
|
-
return new GlueModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](declaration), name.getText(), isTopLevelModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), declaration), isNamespace, (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]() != null) && isGlobalAugmentation(declaration),
|
|
70
|
+
return new GlueModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](declaration), name.getText(), isTopLevelModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), declaration), isNamespace, (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]() != null) && isGlobalAugmentation(declaration), ((isAmbientModule ? true : isBodyOfDottedName) ? true : isExportAssigned) ? true : isExportedDeclaration(declaration, singleton_1(name.getText(), {
|
|
71
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
72
|
+
})), false, types);
|
|
25
73
|
}
|
|
26
74
|
|
|
@@ -1,56 +1,53 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { toList } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
4
|
-
import { GlueReExport, GlueType, GlueTypeLiteral } from "../GlueAST.js";
|
|
2
|
+
import { GlueReExport, GlueType } from "../GlueAST.js";
|
|
5
3
|
import { defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
6
|
-
import { resolveAlias } from "./Utils.js";
|
|
4
|
+
import { moduleExportNameText, resolveAlias } from "./Utils.js";
|
|
7
5
|
import { item } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
|
|
6
|
+
import { empty } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
8
7
|
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
9
8
|
import { concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
|
|
10
9
|
import { TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name } from "../TypeScript.Extensions.js";
|
|
11
10
|
|
|
12
11
|
export function readNode(reader, node) {
|
|
13
|
-
let option_3, option, binder, checker, option_1, target, matchValue_1, declarations, declarations_1, declaration_1, matchValue_2;
|
|
12
|
+
let option_3, option, binder, checker, option_1, target, matchValue_1, declarations, declarations_1, declaration, declaration_1, matchValue_2;
|
|
14
13
|
const matchValue = node.kind;
|
|
15
14
|
switch (matchValue) {
|
|
16
15
|
case 136:
|
|
17
16
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](node);
|
|
18
|
-
case
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
case 242:
|
|
23
|
-
case 270:
|
|
17
|
+
case 188:
|
|
18
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](node);
|
|
19
|
+
case 243:
|
|
24
20
|
case 271:
|
|
25
|
-
case
|
|
26
|
-
case
|
|
21
|
+
case 272:
|
|
22
|
+
case 279:
|
|
23
|
+
case 308:
|
|
27
24
|
return GlueType.Discard;
|
|
28
|
-
case
|
|
25
|
+
case 244:
|
|
29
26
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadVariableStatementZ66C4BA0A"](node);
|
|
30
|
-
case 262:
|
|
31
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadFunctionDeclarationZ72EBD329"](node);
|
|
32
27
|
case 263:
|
|
33
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
28
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadFunctionDeclarationZ72EBD329"](node);
|
|
34
29
|
case 264:
|
|
35
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
30
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadClassDeclarationZ4558F325"](node);
|
|
36
31
|
case 265:
|
|
37
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
32
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadInterfaceDeclaration1CB6FA10"](node);
|
|
38
33
|
case 266:
|
|
39
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
34
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeAliasDeclarationZ7FA16745"](node);
|
|
40
35
|
case 267:
|
|
36
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadEnumDeclaration49F76106"](node);
|
|
37
|
+
case 268:
|
|
41
38
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadModuleDeclarationC29C54F"](node);
|
|
42
|
-
case
|
|
43
|
-
return GlueType.Discard;
|
|
44
|
-
case 276:
|
|
39
|
+
case 273:
|
|
45
40
|
return GlueType.Discard;
|
|
46
41
|
case 277:
|
|
42
|
+
return GlueType.Discard;
|
|
43
|
+
case 278:
|
|
47
44
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadExportAssignmentZ3497D0FE"](node);
|
|
48
|
-
case
|
|
45
|
+
case 282: {
|
|
49
46
|
const exportSpecifier = node;
|
|
50
|
-
return defaultArg((option_3 = ((option = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getExportSpecifierLocalTargetSymbol(exportSpecifier), (binder = ((checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), (symbol) => resolveAlias(checker, symbol))), (option_1 = option, (option_1 != null) ? binder(option_1) : undefined)))), (option_3 != null) ? ((target = option_3, (matchValue_1 = target.declarations, (matchValue_1 != null) ? (((declarations = matchValue_1, declarations.length > 0)) ? ((declarations_1 = matchValue_1, (declaration_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](
|
|
47
|
+
return defaultArg((option_3 = ((option = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getExportSpecifierLocalTargetSymbol(exportSpecifier), (binder = ((checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), (symbol) => resolveAlias(checker, symbol))), (option_1 = option, (option_1 != null) ? binder(option_1) : undefined)))), (option_3 != null) ? ((target = option_3, (matchValue_1 = target.declarations, (matchValue_1 != null) ? (((declarations = matchValue_1, declarations.length > 0)) ? ((declarations_1 = matchValue_1, (declaration = item(0, declarations_1), (declaration_1 = ((declaration.kind === 261) ? reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration.parent.parent) : reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration)), (matchValue_2 = exportSpecifier.propertyName, (matchValue_2 == null) ? declaration_1 : (new GlueType(/* ReExport */ 32, [new GlueReExport(moduleExportNameText(exportSpecifier.name), declaration_1, empty())]))))))) : undefined) : undefined))) : undefined), GlueType.Discard);
|
|
51
48
|
}
|
|
52
49
|
default: {
|
|
53
|
-
const warning = Report_readerError_Z19516DCE("node", concat("Unsupported node kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue)), node, "/_//src/Glutinum.Converter/Reader/Node.fs",
|
|
50
|
+
const warning = Report_readerError_Z19516DCE("node", concat("Unsupported node kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue)), node, "/_//src/Glutinum.Converter/Reader/Node.fs", 83);
|
|
54
51
|
void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(warning));
|
|
55
52
|
return GlueType.Discard;
|
|
56
53
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { filter, singleton, mapIndexed, concat } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
3
|
-
import { isTupleType, identifierText } from "./Utils.js";
|
|
3
|
+
import { typeNodeBuilderFlags, isTupleType, identifierText } from "./Utils.js";
|
|
4
4
|
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
5
5
|
import { concat as concat_1 } from "../../fable_modules/fable-library-js.5.17.2/String.js";
|
|
6
6
|
import { TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name } from "../TypeScript.Extensions.js";
|
|
@@ -8,39 +8,40 @@ import { toList } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
|
8
8
|
import { GlueParameter } from "../GlueAST.js";
|
|
9
9
|
|
|
10
10
|
export function readParameters(reader, parameters) {
|
|
11
|
-
return concat(mapIndexed((index,
|
|
12
|
-
let tupleNode,
|
|
13
|
-
const nameNode_1 =
|
|
11
|
+
return concat(mapIndexed((index, parameter_2) => {
|
|
12
|
+
let tupleNode, typeNode_1, typeNode_2;
|
|
13
|
+
const nameNode_1 = parameter_2.name;
|
|
14
14
|
let name;
|
|
15
|
-
const
|
|
16
|
-
switch (
|
|
15
|
+
const matchValue_1 = nameNode_1.kind;
|
|
16
|
+
switch (matchValue_1) {
|
|
17
17
|
case 80: {
|
|
18
18
|
name = identifierText(nameNode_1);
|
|
19
19
|
break;
|
|
20
20
|
}
|
|
21
|
-
case
|
|
21
|
+
case 207:
|
|
22
|
+
case 208: {
|
|
22
23
|
name = (`arg${index}`);
|
|
23
24
|
break;
|
|
24
25
|
}
|
|
25
26
|
default: {
|
|
26
|
-
const item = Report_readerError_Z19516DCE("name", concat_1("Unsupported kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(nameNode_1.kind)), nameNode_1, "/_//src/Glutinum.Converter/Reader/Parameters.fs",
|
|
27
|
+
const item = Report_readerError_Z19516DCE("name", concat_1("Unsupported kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(nameNode_1.kind)), nameNode_1, "/_//src/Glutinum.Converter/Reader/Parameters.fs", 36);
|
|
27
28
|
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
28
29
|
void (objectArg.push(item));
|
|
29
30
|
name = (`arg${index}`);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
const isSpread =
|
|
33
|
+
const isSpread = parameter_2.dotDotDotToken != null;
|
|
33
34
|
let tupleElements;
|
|
34
|
-
const
|
|
35
|
-
let matchResult,
|
|
36
|
-
if (
|
|
37
|
-
if ((
|
|
35
|
+
const matchValue_2 = parameter_2.type;
|
|
36
|
+
let matchResult, typeNode_3, typeNode_4;
|
|
37
|
+
if (matchValue_2 != null) {
|
|
38
|
+
if ((typeNode_1 = matchValue_2, isSpread && (typeNode_1.kind === 190))) {
|
|
38
39
|
matchResult = 0;
|
|
39
|
-
|
|
40
|
+
typeNode_3 = matchValue_2;
|
|
40
41
|
}
|
|
41
|
-
else if ((
|
|
42
|
+
else if ((typeNode_2 = matchValue_2, (isSpread && (typeNode_2.kind === 184)) && (typeNode_2.pos >= 0))) {
|
|
42
43
|
matchResult = 1;
|
|
43
|
-
|
|
44
|
+
typeNode_4 = matchValue_2;
|
|
44
45
|
}
|
|
45
46
|
else {
|
|
46
47
|
matchResult = 2;
|
|
@@ -51,19 +52,18 @@ export function readParameters(reader, parameters) {
|
|
|
51
52
|
}
|
|
52
53
|
switch (matchResult) {
|
|
53
54
|
case 0: {
|
|
54
|
-
tupleElements = toList(
|
|
55
|
+
tupleElements = toList(typeNode_3.elements);
|
|
55
56
|
break;
|
|
56
57
|
}
|
|
57
58
|
case 1: {
|
|
58
|
-
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(
|
|
59
|
+
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeNode_4);
|
|
59
60
|
if (isTupleType(typ)) {
|
|
60
|
-
const
|
|
61
|
-
const matchValue_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, flags);
|
|
61
|
+
const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, undefined, typeNodeBuilderFlags);
|
|
62
62
|
let matchResult_1, tupleNode_1;
|
|
63
|
-
if (
|
|
64
|
-
if ((tupleNode =
|
|
63
|
+
if (matchValue_3 != null) {
|
|
64
|
+
if ((tupleNode = matchValue_3, tupleNode.kind === 190)) {
|
|
65
65
|
matchResult_1 = 0;
|
|
66
|
-
tupleNode_1 =
|
|
66
|
+
tupleNode_1 = matchValue_3;
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
69
|
matchResult_1 = 1;
|
|
@@ -90,18 +90,18 @@ export function readParameters(reader, parameters) {
|
|
|
90
90
|
tupleElements = undefined;
|
|
91
91
|
}
|
|
92
92
|
if (tupleElements == null) {
|
|
93
|
-
return singleton(new GlueParameter(name,
|
|
93
|
+
return singleton(new GlueParameter(name, parameter_2.questionToken != null, isSpread, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](parameter_2.type)));
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
96
|
return mapIndexed((elementIndex, element) => {
|
|
97
97
|
const element_1 = element;
|
|
98
|
-
const
|
|
99
|
-
switch (
|
|
100
|
-
case 190:
|
|
101
|
-
return new GlueParameter(`${name}${elementIndex}`, true, false, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](element_1.type));
|
|
98
|
+
const matchValue_4 = element_1.kind;
|
|
99
|
+
switch (matchValue_4) {
|
|
102
100
|
case 191:
|
|
101
|
+
return new GlueParameter(`${name}${elementIndex}`, true, false, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](element_1.type));
|
|
102
|
+
case 192:
|
|
103
103
|
return new GlueParameter(`${name}${elementIndex}`, false, true, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](element_1.type));
|
|
104
|
-
case
|
|
104
|
+
case 203: {
|
|
105
105
|
const namedMember = element_1;
|
|
106
106
|
return new GlueParameter(identifierText(namedMember.name), namedMember.questionToken != null, namedMember.dotDotDotToken != null, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](namedMember.type));
|
|
107
107
|
}
|
|
@@ -110,9 +110,18 @@ export function readParameters(reader, parameters) {
|
|
|
110
110
|
}
|
|
111
111
|
}, tupleElements);
|
|
112
112
|
}
|
|
113
|
+
}, filter((parameter_1) => {
|
|
114
|
+
const matchValue = parameter_1.type;
|
|
115
|
+
if (matchValue == null) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
const typeNode = matchValue;
|
|
120
|
+
return !((parameter_1.questionToken != null) && (typeNode.kind === 157));
|
|
121
|
+
}
|
|
113
122
|
}, filter((parameter) => {
|
|
114
123
|
const nameNode = parameter.name;
|
|
115
124
|
return !((nameNode.kind === 80) && (identifierText(nameNode) === "this"));
|
|
116
|
-
}, toList(parameters))));
|
|
125
|
+
}, toList(parameters)))));
|
|
117
126
|
}
|
|
118
127
|
|
|
@@ -6,22 +6,22 @@ export function readTypeAliasDeclaration(reader, declaration) {
|
|
|
6
6
|
let typ;
|
|
7
7
|
const matchValue = declaration.type.kind;
|
|
8
8
|
switch (matchValue) {
|
|
9
|
-
case
|
|
9
|
+
case 193: {
|
|
10
10
|
const unionTypeNode = declaration.type;
|
|
11
11
|
typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadUnionTypeNodeZ5A082EC2"](unionTypeNode);
|
|
12
12
|
break;
|
|
13
13
|
}
|
|
14
|
-
case
|
|
14
|
+
case 199: {
|
|
15
15
|
const typeOperatorNode = declaration.type;
|
|
16
16
|
typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeOperatorNodeZ6830FC33"](typeOperatorNode);
|
|
17
17
|
break;
|
|
18
18
|
}
|
|
19
|
-
case
|
|
19
|
+
case 200: {
|
|
20
20
|
const declaration_1 = declaration.type;
|
|
21
21
|
typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadIndexedAccessTypeZ5577BC0A"](declaration_1);
|
|
22
22
|
break;
|
|
23
23
|
}
|
|
24
|
-
case
|
|
24
|
+
case 201: {
|
|
25
25
|
const mappedTypeNode = declaration.type;
|
|
26
26
|
typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadMappedTypeNode28272C00"](mappedTypeNode);
|
|
27
27
|
break;
|
|
@@ -29,6 +29,6 @@ export function readTypeAliasDeclaration(reader, declaration) {
|
|
|
29
29
|
default:
|
|
30
30
|
typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](declaration.type);
|
|
31
31
|
}
|
|
32
|
-
return new GlueType(/* TypeAliasDeclaration */ 5, [new GlueTypeAliasDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](declaration), getFullNameOrEmpty(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), declaration), declaration.name.getText(), typ, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
32
|
+
return new GlueType(/* TypeAliasDeclaration */ 5, [new GlueTypeAliasDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](declaration), getFullNameOrEmpty(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), declaration), declaration.name.getText(), typ, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"](declaration.typeParameters))]);
|
|
33
33
|
}
|
|
34
34
|
|