@glutinum/cli 1.0.0-beta.1 → 1.0.0-beta.11
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 +16 -39
- package/dist/Glutinum.Converter/DelegateExtensions.js +378 -0
- package/dist/Glutinum.Converter/FreeTypeParameters.js +211 -0
- package/dist/Glutinum.Converter/FsharpAST.js +117 -66
- package/dist/Glutinum.Converter/Generate.js +52 -26
- package/dist/Glutinum.Converter/GlueAST.js +85 -46
- package/dist/Glutinum.Converter/Hosting.js +148 -174
- package/dist/Glutinum.Converter/Merge.js +463 -355
- package/dist/Glutinum.Converter/Packages.js +387 -97
- package/dist/Glutinum.Converter/Printer.js +439 -400
- package/dist/Glutinum.Converter/Read.js +362 -100
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +7 -7
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
- package/dist/Glutinum.Converter/Reader/Declaration.js +13 -19
- package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
- package/dist/Glutinum.Converter/Reader/Documentation.js +28 -40
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +2 -2
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +104 -37
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +24 -39
- package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +30 -17
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +16 -22
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +49 -6
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +4 -4
- package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +54 -6
- package/dist/Glutinum.Converter/Reader/Node.js +11 -14
- package/dist/Glutinum.Converter/Reader/Parameters.js +39 -30
- package/dist/Glutinum.Converter/Reader/Report.js +4 -4
- package/dist/Glutinum.Converter/Reader/TypeNode.js +390 -1584
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +80 -53
- package/dist/Glutinum.Converter/Reader/TypeParameters.js +2 -2
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +24 -47
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +24 -6
- package/dist/Glutinum.Converter/Reader/Types.js +297 -17
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +16 -30
- package/dist/Glutinum.Converter/Reader/UtilityType.js +811 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +497 -111
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +7 -8
- package/dist/Glutinum.Converter/Transform.js +2915 -8180
- 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 +338 -0
- package/dist/Glutinum.Converter/Transformer/Utils.js +341 -0
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +0 -10
- package/dist/Glutinum.Converter/Utils/Keywords.js +3 -3
- package/dist/Glutinum.Converter/Utils/List.js +2 -2
- package/dist/Glutinum.Converter/Utils/Naming.js +6 -6
- package/dist/Glutinum.Converter/Utils/String.js +16 -5
- package/dist/Program.js +104 -241
- package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs.js +2 -2
- package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs.js +4 -4
- package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs.js +2 -2
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +5 -5
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs.js +4 -4
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs.js +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs.js +4 -4
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs.js +2 -2
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs.js +2 -2
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs.js +1 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +7 -7
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs.js +1 -1
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Async.js +21 -7
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/AsyncBuilder.js +51 -6
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/CHANGELOG.md +23 -1
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/CollectionUtil.js +10 -16
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MailboxProcessor.js +19 -3
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MutableMap.js +5 -1
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MutableSet.js +5 -1
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Util.js +15 -3
- package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/package.json +1 -1
- package/package.json +3 -2
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Array.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/BigInt.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/BitConverter.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Boolean.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Char.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Choice.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/ConditionalWeakTable.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Date.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOffset.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOnlyTemporal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeFormat.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeOffsetTemporal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeTemporal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Decimal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Directory.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Double.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Encoding.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Environment.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Event.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Collections.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Core.CompilerServices.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Core.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/File.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Global.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Guid.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Int32.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/List.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Long.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Map.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MapUtil.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Native.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Numeric.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Observable.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Option.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Path.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/README.md +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Random.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Range.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Reflection.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/RegExp.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Result.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Seq.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Seq2.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Set.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/String.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.Collections.Generic.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.Text.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Task.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TaskBuilder.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeOnlyTemporal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeSpan.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeSpanTemporal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Timer.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Types.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Unicode.13.0.0.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Uri.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/big.d.ts +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/lib/big.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/quotation.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { GluePrimitive, GlueType, GlueIndexedAccessType } from "../GlueAST.js";
|
|
3
|
-
import { $007CHasTypeFlags$007C_$007C } from "./Utils.js";
|
|
3
|
+
import { typeNodeBuilderFlags, $007CHasTypeFlags$007C_$007C, enclosingDeclarationOf } from "./Utils.js";
|
|
4
4
|
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
5
|
-
import { concat } from "../../fable_modules/fable-library-js.5.
|
|
5
|
+
import { concat } from "../../fable_modules/fable-library-js.5.21.0/String.js";
|
|
6
6
|
import { TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name } from "../TypeScript.Extensions.js";
|
|
7
7
|
|
|
8
8
|
export function readIndexedAccessType(reader, declaration) {
|
|
@@ -12,7 +12,7 @@ export function readIndexedAccessType(reader, declaration) {
|
|
|
12
12
|
const node = declaration;
|
|
13
13
|
const tryTypeToTypeNode = (typ, flags) => {
|
|
14
14
|
try {
|
|
15
|
-
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, node, flags);
|
|
15
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, enclosingDeclarationOf(node), flags);
|
|
16
16
|
}
|
|
17
17
|
catch (matchValue) {
|
|
18
18
|
return undefined;
|
|
@@ -21,17 +21,14 @@ export function readIndexedAccessType(reader, declaration) {
|
|
|
21
21
|
const matchValue_3 = idxNodeType.kind;
|
|
22
22
|
let matchResult;
|
|
23
23
|
switch (matchValue_3) {
|
|
24
|
-
case 150:
|
|
25
|
-
matchResult = 1;
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
24
|
+
case 150:
|
|
28
25
|
case 154:
|
|
29
26
|
case 184: {
|
|
30
|
-
matchResult =
|
|
27
|
+
matchResult = 3;
|
|
31
28
|
break;
|
|
32
29
|
}
|
|
33
30
|
case 194: {
|
|
34
|
-
matchResult =
|
|
31
|
+
matchResult = 4;
|
|
35
32
|
break;
|
|
36
33
|
}
|
|
37
34
|
case 199: {
|
|
@@ -40,15 +37,15 @@ export function readIndexedAccessType(reader, declaration) {
|
|
|
40
37
|
}
|
|
41
38
|
case 202: {
|
|
42
39
|
if (node.pos >= 0) {
|
|
43
|
-
matchResult =
|
|
40
|
+
matchResult = 1;
|
|
44
41
|
}
|
|
45
42
|
else {
|
|
46
|
-
matchResult =
|
|
43
|
+
matchResult = 2;
|
|
47
44
|
}
|
|
48
45
|
break;
|
|
49
46
|
}
|
|
50
47
|
default:
|
|
51
|
-
matchResult =
|
|
48
|
+
matchResult = 5;
|
|
52
49
|
}
|
|
53
50
|
switch (matchResult) {
|
|
54
51
|
case 0: {
|
|
@@ -61,7 +58,7 @@ export function readIndexedAccessType(reader, declaration) {
|
|
|
61
58
|
const typ_1 = checker.getTypeAtLocation(node);
|
|
62
59
|
const matchValue_1 = typ_1.flags;
|
|
63
60
|
if ($007CHasTypeFlags$007C_$007C(134217728, matchValue_1) != null) {
|
|
64
|
-
const matchValue_2 = tryTypeToTypeNode(typ_1,
|
|
61
|
+
const matchValue_2 = tryTypeToTypeNode(typ_1, typeNodeBuilderFlags);
|
|
65
62
|
let matchResult_1, typeNode_1;
|
|
66
63
|
if (matchValue_2 != null) {
|
|
67
64
|
if ((typeNode = matchValue_2, typeNode.kind === 193)) {
|
|
@@ -96,20 +93,17 @@ export function readIndexedAccessType(reader, declaration) {
|
|
|
96
93
|
return matchValue_4;
|
|
97
94
|
}
|
|
98
95
|
}
|
|
99
|
-
case 1:
|
|
100
|
-
return withIndexType(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](idxNodeType));
|
|
101
|
-
case 2: {
|
|
96
|
+
case 1: {
|
|
102
97
|
const checker_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
103
98
|
const objectType = checker_1.getTypeAtLocation(declaration.objectType);
|
|
104
99
|
const key = idxNodeType.literal.text;
|
|
105
|
-
const flags_2 = 1 | 16384;
|
|
106
100
|
const matchValue_5 = checker_1.getPropertyOfType(objectType, key);
|
|
107
101
|
if (matchValue_5 == null) {
|
|
108
102
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
109
103
|
}
|
|
110
104
|
else {
|
|
111
105
|
const property = matchValue_5;
|
|
112
|
-
const matchValue_6 = tryTypeToTypeNode(checker_1.getTypeOfSymbol(property),
|
|
106
|
+
const matchValue_6 = tryTypeToTypeNode(checker_1.getTypeOfSymbol(property), typeNodeBuilderFlags);
|
|
113
107
|
if (matchValue_6 == null) {
|
|
114
108
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
115
109
|
}
|
|
@@ -119,14 +113,14 @@ export function readIndexedAccessType(reader, declaration) {
|
|
|
119
113
|
}
|
|
120
114
|
}
|
|
121
115
|
}
|
|
122
|
-
case
|
|
116
|
+
case 2:
|
|
123
117
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
124
|
-
case
|
|
118
|
+
case 3:
|
|
125
119
|
return withIndexType(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](idxNodeType));
|
|
126
|
-
case
|
|
120
|
+
case 4:
|
|
127
121
|
return withIndexType(GlueType.Discard);
|
|
128
122
|
default: {
|
|
129
|
-
const warning = Report_readerError_Z19516DCE("readIndexedAccessType", concat("Unsupported node kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue_3)), idxNodeType, "/_//src/Glutinum.Converter/Reader/IndexedAccessType.fs",
|
|
123
|
+
const warning = Report_readerError_Z19516DCE("readIndexedAccessType", concat("Unsupported node kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue_3)), idxNodeType, "/_//src/Glutinum.Converter/Reader/IndexedAccessType.fs", 87);
|
|
130
124
|
void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(warning));
|
|
131
125
|
return withIndexType(GlueType.Discard);
|
|
132
126
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
import { tryItem, tryPick, mapIndexed, filter, forAll, cons, map, collect, empty } from "../../fable_modules/fable-library-js.5.
|
|
2
|
+
import { isEmpty, tryItem, tryPick, mapIndexed, filter, forAll, cons, map, collect, empty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
3
3
|
import { readHeritageClauses, getFullNameOrEmpty, otherFileInterfaceDeclarations, mainDeclaration } from "./Utils.js";
|
|
4
|
-
import { toList } from "../../fable_modules/fable-library-js.5.
|
|
5
|
-
import { defaultArg } from "../../fable_modules/fable-library-js.5.
|
|
6
|
-
import { GlueInterface, GlueTypeParameter } from "../GlueAST.js";
|
|
7
|
-
import { List_distinct } from "../../fable_modules/fable-library-js.5.
|
|
8
|
-
import { safeHash, equals } from "../../fable_modules/fable-library-js.5.
|
|
4
|
+
import { toList } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
5
|
+
import { defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
6
|
+
import { GlueReExport, GlueType, GlueInterface, GlueTypeParameter } from "../GlueAST.js";
|
|
7
|
+
import { List_distinct } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
|
|
8
|
+
import { safeHash, equals } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
9
|
+
import { PackageContext__TryFindExternalModulePath_Z721C83C5 } from "./Types.js";
|
|
9
10
|
|
|
10
11
|
export function readInterfaceDeclaration(reader, declaration) {
|
|
11
12
|
let option_1;
|
|
@@ -85,3 +86,45 @@ export function readInterfaceDeclaration(reader, declaration) {
|
|
|
85
86
|
}));
|
|
86
87
|
}
|
|
87
88
|
|
|
89
|
+
/**
|
|
90
|
+
* <c>interface Blob extends _Blob {}</c> of <c>@types/node</c> redeclares a type of the DOM lib,
|
|
91
|
+
* with no member of its own: the declaration of the external binding is the one carrying the API
|
|
92
|
+
*/
|
|
93
|
+
export function tryReadExternalRedeclaration(reader, declaration, glueInterface) {
|
|
94
|
+
let option_1;
|
|
95
|
+
if (!isEmpty(glueInterface.Members)) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
|
|
100
|
+
const matchValue_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(declaration.name);
|
|
101
|
+
let matchResult, packageContext, symbol;
|
|
102
|
+
if (matchValue != null) {
|
|
103
|
+
if (matchValue_1 != null) {
|
|
104
|
+
matchResult = 0;
|
|
105
|
+
packageContext = matchValue;
|
|
106
|
+
symbol = matchValue_1;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
matchResult = 1;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
matchResult = 1;
|
|
114
|
+
}
|
|
115
|
+
switch (matchResult) {
|
|
116
|
+
case 0: {
|
|
117
|
+
const option_4 = tryPick((other) => PackageContext__TryFindExternalModulePath_Z721C83C5(packageContext, other.getSourceFile().fileName), defaultArg((option_1 = symbol.declarations, (option_1 != null) ? toList(option_1) : undefined), empty()));
|
|
118
|
+
if (option_4 != null) {
|
|
119
|
+
return new GlueType(/* ReExport */ 32, [new GlueReExport(glueInterface.Name, new GlueType(/* Interface */ 1, [glueInterface]), option_4)]);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
default:
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
|
|
2
|
+
import { Exception, stringHash, structuralHash, equals, disposeSafe } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
3
|
+
import { head, tail, append, forAll as forAll_1, filter, empty, exists as exists_1, collect, isEmpty, map, concat, choose } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
4
|
+
import { readInstantiatedMember, readPropertyWithoutDeclaration, IntersectionTypePropertyResult } from "./MemberTypes.js";
|
|
5
|
+
import { item } from "../../fable_modules/fable-library-js.5.21.0/Array.js";
|
|
6
|
+
import { filter as filter_1, exists, toList, forAll } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
7
|
+
import { List_distinctBy, List_distinct } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
|
|
8
|
+
import { withInProgress, typeNodeBuilderFlags } from "./Utils.js";
|
|
9
|
+
import { GluePrimitive, GlueType } from "../GlueAST.js";
|
|
10
|
+
|
|
11
|
+
function readIntersectionConstituents(reader, typeNode) {
|
|
12
|
+
let matchValue;
|
|
13
|
+
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
14
|
+
const intersectionTypeNode = typeNode;
|
|
15
|
+
const unionOrIntersectionType = checker.getTypeAtLocation(intersectionTypeNode);
|
|
16
|
+
void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Intersections.push(unionOrIntersectionType));
|
|
17
|
+
const _guard = {
|
|
18
|
+
Dispose() {
|
|
19
|
+
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Intersections.splice(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Intersections.length - 1, 1);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
try {
|
|
23
|
+
const properties_1 = choose((property_1) => {
|
|
24
|
+
const matchValue_1 = property_1.declarations;
|
|
25
|
+
if (matchValue_1 == null) {
|
|
26
|
+
return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_1]);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
const declarations = matchValue_1;
|
|
30
|
+
if (declarations.length === 1) {
|
|
31
|
+
return new IntersectionTypePropertyResult(/* Single */ 0, [property_1, item(0, declarations)]);
|
|
32
|
+
}
|
|
33
|
+
else if (forAll((declaration) => {
|
|
34
|
+
if (declaration.kind === 172) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return declaration.kind === 173;
|
|
39
|
+
}
|
|
40
|
+
}, declarations)) {
|
|
41
|
+
return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_1]);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return IntersectionTypePropertyResult.ForceAny;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}, unionOrIntersectionType.isUnion() ? List_distinct(concat(map((arg) => toList(checker.getPropertiesOfType(arg)), toList(unionOrIntersectionType.types))), {
|
|
48
|
+
Equals: equals,
|
|
49
|
+
GetHashCode: (x) => (structuralHash(x) | 0),
|
|
50
|
+
}) : ((matchValue = toList(unionOrIntersectionType.getProperties()), isEmpty(matchValue) ? ((intersectionTypeNode.pos >= 0) ? List_distinctBy((property) => property.name, collect((constituent) => {
|
|
51
|
+
let type_1;
|
|
52
|
+
return toList((type_1 = checker.getTypeAtLocation(constituent), checker.getPropertiesOfType(type_1)));
|
|
53
|
+
}, toList(intersectionTypeNode.types)), {
|
|
54
|
+
Equals: (x_1, y_1) => (x_1 === y_1),
|
|
55
|
+
GetHashCode: (x_1) => (stringHash(x_1) | 0),
|
|
56
|
+
}) : matchValue) : matchValue)));
|
|
57
|
+
const intersectsATypeQuery = exists((constituent_1) => (constituent_1.kind === 187), intersectionTypeNode.types);
|
|
58
|
+
const everyConstituentIsAReference = forAll((constituent_2) => (constituent_2.kind === 184), intersectionTypeNode.types);
|
|
59
|
+
const hasUnsupportedProperties = intersectsATypeQuery ? true : exists_1((property_2) => {
|
|
60
|
+
switch (property_2.tag) {
|
|
61
|
+
case 1:
|
|
62
|
+
return false;
|
|
63
|
+
case 0:
|
|
64
|
+
if (everyConstituentIsAReference) {
|
|
65
|
+
return property_2.fields[1].kind === 175;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
default:
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}, properties_1);
|
|
74
|
+
const callSignatures = unionOrIntersectionType.isUnion() ? empty() : choose((signature) => {
|
|
75
|
+
const synthesized = checker.signatureToSignatureDeclaration(signature, 180, typeNode, typeNodeBuilderFlags);
|
|
76
|
+
if (synthesized == null) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const declaration_2 = synthesized;
|
|
81
|
+
declaration_2.parent = typeNode;
|
|
82
|
+
const previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
|
|
83
|
+
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](declaration_2);
|
|
84
|
+
try {
|
|
85
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_2);
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, toList(checker.getSignaturesOfType(unionOrIntersectionType, 0)));
|
|
92
|
+
if (hasUnsupportedProperties) {
|
|
93
|
+
const references = map((constituent_3) => {
|
|
94
|
+
if (constituent_3.kind === 184) {
|
|
95
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constituent_3);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return GlueType.Discard;
|
|
99
|
+
}
|
|
100
|
+
}, toList(intersectionTypeNode.types));
|
|
101
|
+
const literalMembers = collect((constituent_4) => {
|
|
102
|
+
if (constituent_4.kind === 188) {
|
|
103
|
+
const matchValue_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constituent_4);
|
|
104
|
+
if (matchValue_2.tag === 22) {
|
|
105
|
+
return matchValue_2.fields[0].Members;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return empty();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
return empty();
|
|
113
|
+
}
|
|
114
|
+
}, toList(intersectionTypeNode.types));
|
|
115
|
+
const inheritable = filter((reference) => !equals(reference, GlueType.Discard), references);
|
|
116
|
+
return (!isEmpty(inheritable) && forAll_1((_arg) => {
|
|
117
|
+
if (_arg.tag === 13) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
}, inheritable)) ? (new GlueType(/* IntersectionOfReferences */ 21, [inheritable, literalMembers])) : (new GlueType(/* Primitive */ 3, [GluePrimitive.Any]));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
return new GlueType(/* IntersectionType */ 20, [append(withInProgress(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_InProgress"]().Landing, typeNode, () => choose((_arg_1) => {
|
|
127
|
+
switch (_arg_1.tag) {
|
|
128
|
+
case 1:
|
|
129
|
+
return readPropertyWithoutDeclaration(reader, typeNode, _arg_1.fields[0]);
|
|
130
|
+
case 2:
|
|
131
|
+
throw new Exception("Should not happen here");
|
|
132
|
+
default:
|
|
133
|
+
return readInstantiatedMember(reader, typeNode, _arg_1.fields[0], _arg_1.fields[1]);
|
|
134
|
+
}
|
|
135
|
+
}, properties_1)), append(callSignatures, collect((constituent_5) => {
|
|
136
|
+
if (constituent_5.kind === 188) {
|
|
137
|
+
return map((declaration_4) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_4), filter((element) => (element.kind === 182), toList(constituent_5.members)));
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
return empty();
|
|
141
|
+
}
|
|
142
|
+
}, toList(intersectionTypeNode.types))))]);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
disposeSafe(_guard);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* `DateArg<Date> & {}` is `DateArg<Date>`, the empty type literal only bars `null`
|
|
152
|
+
*/
|
|
153
|
+
export function readIntersectionType(reader, typeNode) {
|
|
154
|
+
const constituents = toList(filter_1((arg) => {
|
|
155
|
+
let constituent, this$;
|
|
156
|
+
return !((constituent = arg, (constituent.kind === 188) && (((this$ = constituent.members, ~~this$.length)) === 0)));
|
|
157
|
+
}, typeNode.types));
|
|
158
|
+
let matchResult, single;
|
|
159
|
+
if (!isEmpty(constituents)) {
|
|
160
|
+
if (isEmpty(tail(constituents))) {
|
|
161
|
+
matchResult = 0;
|
|
162
|
+
single = head(constituents);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
matchResult = 1;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
matchResult = 1;
|
|
170
|
+
}
|
|
171
|
+
switch (matchResult) {
|
|
172
|
+
case 0:
|
|
173
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](single);
|
|
174
|
+
default:
|
|
175
|
+
return readIntersectionConstituents(reader, typeNode);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import { entityNameText, identifierText } from "./Utils.js";
|
|
3
|
-
import { exists } from "../../fable_modules/fable-library-js.5.
|
|
4
|
-
import { equals } from "../../fable_modules/fable-library-js.5.
|
|
3
|
+
import { exists } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
4
|
+
import { equals } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
5
5
|
import { ts } from "@ts-morph/bootstrap";
|
|
6
|
-
import { FSharpResult$2 } from "../../fable_modules/fable-library-js.5.
|
|
6
|
+
import { FSharpResult$2 } from "../../fable_modules/fable-library-js.5.21.0/Result.js";
|
|
7
7
|
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
8
|
-
import { head, tail, isEmpty, length } from "../../fable_modules/fable-library-js.5.
|
|
8
|
+
import { head, tail, isEmpty, length } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
9
9
|
import { GlueType, GlueMappedType } from "../GlueAST.js";
|
|
10
10
|
|
|
11
11
|
function tryIdentitySource(reader, mappedTypeNode) {
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
|
|
2
|
+
import { Union } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
|
|
3
|
+
import { union_type, class_type } from "../../fable_modules/fable-library-js.5.21.0/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.21.0/String.js";
|
|
7
|
+
import { empty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
8
|
+
import { GlueMethod, GlueMethodSignature, GlueMember, GlueProperty, GlueAccessor } from "../GlueAST.js";
|
|
9
|
+
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.21.0/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,13 +1,31 @@
|
|
|
1
1
|
|
|
2
|
-
import { choose, concat, toList, exists } from "../../fable_modules/fable-library-js.5.
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { choose, concat, toList, exists } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
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.21.0/List.js";
|
|
5
|
+
import { singleton as singleton_1 } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
|
|
6
|
+
import { comparePrimitives } from "../../fable_modules/fable-library-js.5.21.0/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) {
|
|
@@ -15,12 +33,42 @@ export function readModuleDeclaration(reader, declaration) {
|
|
|
15
33
|
return singleton(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](child));
|
|
16
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,24 +1,21 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { moduleExportNameText, resolveAlias
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { item } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
|
|
2
|
+
import { GlueReExport, GlueType } from "../GlueAST.js";
|
|
3
|
+
import { defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
4
|
+
import { moduleExportNameText, resolveAlias } from "./Utils.js";
|
|
5
|
+
import { item } from "../../fable_modules/fable-library-js.5.21.0/Array.js";
|
|
6
|
+
import { empty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
8
7
|
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
9
|
-
import { concat } from "../../fable_modules/fable-library-js.5.
|
|
8
|
+
import { concat } from "../../fable_modules/fable-library-js.5.21.0/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 188:
|
|
19
|
-
|
|
20
|
-
return new GlueType(/* TypeLiteral */ 22, [new GlueTypeLiteral(map((declaration) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration), toList(typeLiteralNode.members)), typeLiteralId(typeLiteralNode))]);
|
|
21
|
-
}
|
|
17
|
+
case 188:
|
|
18
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](node);
|
|
22
19
|
case 243:
|
|
23
20
|
case 271:
|
|
24
21
|
case 272:
|
|
@@ -47,10 +44,10 @@ export function readNode(reader, node) {
|
|
|
47
44
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadExportAssignmentZ3497D0FE"](node);
|
|
48
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
|
}
|