@glutinum/cli 1.0.0-beta.14 → 1.0.0-beta.16
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/Glutinum.Converter/GlueAST.js +19 -14
- package/dist/Glutinum.Converter/Merge.js +490 -206
- package/dist/Glutinum.Converter/Packages.js +2 -2
- package/dist/Glutinum.Converter/Printer.js +26 -21
- package/dist/Glutinum.Converter/Read.js +377 -169
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +25 -8
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +2 -2
- package/dist/Glutinum.Converter/Reader/Declaration.js +15 -15
- package/dist/Glutinum.Converter/Reader/Deferred.js +114 -43
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +98 -44
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +2 -2
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +61 -46
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +31 -26
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +38 -25
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +6 -5
- package/dist/Glutinum.Converter/Reader/Node.js +1 -1
- package/dist/Glutinum.Converter/Reader/TypeNode.js +292 -30
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +1 -1
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +143 -35
- package/dist/Glutinum.Converter/Reader/UtilityType.js +179 -34
- package/dist/Glutinum.Converter/Reader/Utils.js +186 -17
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +46 -16
- package/dist/Glutinum.Converter/Transform.js +1073 -638
- package/dist/Glutinum.Converter/Transformer/CallableProperties.js +2 -2
- package/dist/Glutinum.Converter/Transformer/Conditionals.js +17 -16
- package/dist/Glutinum.Converter/Transformer/Context.js +12 -4
- package/dist/Glutinum.Converter/Transformer/Exports.js +242 -66
- package/dist/Glutinum.Converter/Transformer/Heritage.js +449 -17
- package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +4 -4
- package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +105 -19
- package/dist/Glutinum.Converter/Transformer/TypeParameters.js +2 -2
- package/dist/Glutinum.Converter/Transformer/Utils.js +3 -3
- package/dist/Glutinum.Converter/Utils/Naming.js +10 -3
- package/package.json +1 -1
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { choose as choose_1, toList, isEmpty } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
3
|
+
import { head, map, isEmpty as isEmpty_1, choose } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
4
|
+
import { exportedAlias, typeNodeBuilderFlags, identifierText, isExportedDeclaration, readMemberTypeParameters } from "./Utils.js";
|
|
5
|
+
import { GlueVariable, GlueType, GlueTypeLiteral, GlueMember, GlueCallSignature } from "../GlueAST.js";
|
|
3
6
|
import { ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
|
|
4
|
-
import { toList, choose } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
5
7
|
import { Exception, comparePrimitives } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
6
|
-
import { head, isEmpty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
7
8
|
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
8
9
|
import { defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
function signaturesOfFunctionValue(reader, declaration) {
|
|
12
|
+
const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeAtLocation(declaration);
|
|
13
|
+
const isOnlyCallable = isEmpty(typ.getProperties()) && isEmpty(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSignaturesOfType(typ, 1));
|
|
14
|
+
const declarations = choose((signature) => {
|
|
15
|
+
const matchValue = signature.declaration;
|
|
16
|
+
if (matchValue == null) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return matchValue;
|
|
21
|
+
}
|
|
22
|
+
}, toList(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSignaturesOfType(typ, 0)));
|
|
23
|
+
if (isOnlyCallable && !isEmpty_1(declarations)) {
|
|
24
|
+
return map((signature_1) => (new GlueMember(/* CallSignature */ 4, [new GlueCallSignature(readMemberTypeParameters(reader, signature_1.typeParameters), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadParameters716C1F42"](signature_1.parameters), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](signature_1.type))])), declarations);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
10
30
|
|
|
11
31
|
export function readVariableStatement(reader, statement) {
|
|
12
|
-
|
|
32
|
+
let typeNode;
|
|
33
|
+
if (isExportedDeclaration(statement, ofSeq(choose_1((declaration) => {
|
|
13
34
|
const name = declaration.name;
|
|
14
35
|
if (name.kind === 80) {
|
|
15
36
|
return identifierText(name);
|
|
@@ -21,7 +42,7 @@ export function readVariableStatement(reader, statement) {
|
|
|
21
42
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
22
43
|
}))) {
|
|
23
44
|
const matchValue = toList(statement.declarationList.declarations);
|
|
24
|
-
if (!
|
|
45
|
+
if (!isEmpty_1(matchValue)) {
|
|
25
46
|
const declaration_1 = head(matchValue);
|
|
26
47
|
let name_1;
|
|
27
48
|
if (declaration_1.name.kind === 80) {
|
|
@@ -29,24 +50,28 @@ export function readVariableStatement(reader, statement) {
|
|
|
29
50
|
name_1 = id.getText();
|
|
30
51
|
}
|
|
31
52
|
else {
|
|
32
|
-
throw new Exception(Report_readerError_Z19516DCE("variable statement", "Unable to read variable name", declaration_1, "/_//src/Glutinum.Converter/Reader/VariableStatement.fs",
|
|
53
|
+
throw new Exception(Report_readerError_Z19516DCE("variable statement", "Unable to read variable name", declaration_1, "/_//src/Glutinum.Converter/Reader/VariableStatement.fs", 71));
|
|
33
54
|
}
|
|
34
55
|
let typ_1;
|
|
35
56
|
const matchValue_2 = declaration_1.type;
|
|
36
57
|
const matchValue_3 = declaration_1.initializer;
|
|
37
|
-
let matchResult,
|
|
38
|
-
if (matchValue_2
|
|
39
|
-
if (
|
|
40
|
-
matchResult =
|
|
58
|
+
let matchResult, typeNode_1, typeNode_2;
|
|
59
|
+
if (matchValue_2 != null) {
|
|
60
|
+
if ((typeNode = matchValue_2, typeNode.kind === 187)) {
|
|
61
|
+
matchResult = 1;
|
|
62
|
+
typeNode_1 = matchValue_2;
|
|
41
63
|
}
|
|
42
64
|
else {
|
|
43
|
-
matchResult =
|
|
44
|
-
|
|
65
|
+
matchResult = 2;
|
|
66
|
+
typeNode_2 = matchValue_2;
|
|
45
67
|
}
|
|
46
68
|
}
|
|
69
|
+
else if (matchValue_3 != null) {
|
|
70
|
+
matchResult = 0;
|
|
71
|
+
}
|
|
47
72
|
else {
|
|
48
|
-
matchResult =
|
|
49
|
-
|
|
73
|
+
matchResult = 2;
|
|
74
|
+
typeNode_2 = matchValue_2;
|
|
50
75
|
}
|
|
51
76
|
switch (matchResult) {
|
|
52
77
|
case 0: {
|
|
@@ -59,8 +84,13 @@ export function readVariableStatement(reader, statement) {
|
|
|
59
84
|
typ_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typNode);
|
|
60
85
|
break;
|
|
61
86
|
}
|
|
87
|
+
case 1: {
|
|
88
|
+
const matchValue_5 = signaturesOfFunctionValue(reader, declaration_1);
|
|
89
|
+
typ_1 = ((matchValue_5 == null) ? reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typeNode_1) : (new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(matchValue_5, undefined)])));
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
62
92
|
default:
|
|
63
|
-
typ_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](
|
|
93
|
+
typ_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typeNode_2);
|
|
64
94
|
}
|
|
65
95
|
return new GlueType(/* Variable */ 2, [new GlueVariable(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](declaration_1), defaultArg(exportedAlias(statement, name_1), name_1), typ_1)]);
|
|
66
96
|
}
|