@glutinum/cli 0.14.1 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Glutinum.Converter/FsharpAST.js +38 -4
- package/dist/Glutinum.Converter/Generate.js +15 -7
- package/dist/Glutinum.Converter/GlueAST.js +45 -36
- package/dist/Glutinum.Converter/Hosting.js +918 -0
- package/dist/Glutinum.Converter/Merge.js +218 -82
- package/dist/Glutinum.Converter/Packages.js +44 -8
- package/dist/Glutinum.Converter/Printer.js +77 -49
- package/dist/Glutinum.Converter/Read.js +8 -8
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +7 -7
- package/dist/Glutinum.Converter/Reader/Declaration.js +26 -26
- package/dist/Glutinum.Converter/Reader/Documentation.js +37 -36
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +5 -5
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +31 -19
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +6 -7
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +36 -29
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +3 -3
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +82 -4
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +3 -3
- package/dist/Glutinum.Converter/Reader/Node.js +20 -20
- package/dist/Glutinum.Converter/Reader/Parameters.js +7 -7
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +5 -5
- package/dist/Glutinum.Converter/Reader/TypeNode.js +291 -232
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +8 -8
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +108 -40
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +2 -2
- package/dist/Glutinum.Converter/Reader/Types.js +6 -6
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +7 -6
- package/dist/Glutinum.Converter/Reader/Utils.js +106 -56
- package/dist/Glutinum.Converter/Transform.js +2057 -700
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +194 -202
- package/dist/Glutinum.Converter/Utils/Naming.js +7 -0
- package/dist/Glutinum.Converter/Utils/String.js +2 -2
- package/dist/Program.js +38 -26
- package/package.json +2 -2
- 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
|
@@ -14,7 +14,7 @@ function removeParenthesizedType(node_mut) {
|
|
|
14
14
|
removeParenthesizedType:
|
|
15
15
|
while (true) {
|
|
16
16
|
const node = node_mut;
|
|
17
|
-
if (node.kind ===
|
|
17
|
+
if (node.kind === 197) {
|
|
18
18
|
node_mut = node.type;
|
|
19
19
|
continue removeParenthesizedType;
|
|
20
20
|
}
|
|
@@ -37,7 +37,7 @@ export function readTypeOperatorNode(reader, node) {
|
|
|
37
37
|
switch (matchValue_1) {
|
|
38
38
|
case 133:
|
|
39
39
|
return new GlueType(/* Union */ 7, [new GlueTypeUnion(ofArray([new GlueType(/* Primitive */ 3, [GluePrimitive.String$]), new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]), new GlueType(/* Primitive */ 3, [GluePrimitive.Symbol$])]))]);
|
|
40
|
-
case
|
|
40
|
+
case 184: {
|
|
41
41
|
const typeReferenceNode = operandNode;
|
|
42
42
|
const symbolOpt = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(typeReferenceNode.typeName);
|
|
43
43
|
if (symbolOpt != null) {
|
|
@@ -48,8 +48,8 @@ export function readTypeOperatorNode(reader, node) {
|
|
|
48
48
|
}
|
|
49
49
|
else if ((declarations = matchValue_2, declarations.length > 0)) {
|
|
50
50
|
const declarations_1 = matchValue_2;
|
|
51
|
-
const declaration_1 = defaultArg(tryFind((declaration) => (declaration.kind ===
|
|
52
|
-
if (declaration_1.kind ===
|
|
51
|
+
const declaration_1 = defaultArg(tryFind((declaration) => (declaration.kind === 264), declarations_1), item_2(0, declarations_1));
|
|
52
|
+
if (declaration_1.kind === 169) {
|
|
53
53
|
return new GlueType(/* KeyOf */ 9, [new GlueType(/* TypeParameter */ 16, [symbol.name])]);
|
|
54
54
|
}
|
|
55
55
|
else if (contains(declaration_1, declarationsInProgress, {
|
|
@@ -79,10 +79,10 @@ export function readTypeOperatorNode(reader, node) {
|
|
|
79
79
|
throw new Exception(Report_readerError_Z19516DCE("type operator (keyof)", "Missing symbol", node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 35));
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
case
|
|
82
|
+
case 187:
|
|
83
83
|
return new GlueType(/* KeyOf */ 9, [readTypeQueryNode(reader, operandNode)]);
|
|
84
|
-
case
|
|
85
|
-
case
|
|
84
|
+
case 194:
|
|
85
|
+
case 200:
|
|
86
86
|
return new GlueType(/* KeyOf */ 9, [GlueType.Discard]);
|
|
87
87
|
default: {
|
|
88
88
|
const item = Report_readerError_Z19516DCE("type operator (keyof)", concat("Was expecting a type reference or a type query instead got a Node of type ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(operandNode.kind)), node, "/_//src/Glutinum.Converter/Reader/TypeOperatorNode.fs", 88);
|
|
@@ -93,7 +93,7 @@ export function readTypeOperatorNode(reader, node) {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
case 148:
|
|
96
|
-
return new GlueType(/* ReadOnly */
|
|
96
|
+
return new GlueType(/* ReadOnly */ 30, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](node.type)]);
|
|
97
97
|
case 158:
|
|
98
98
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](node.type);
|
|
99
99
|
default: {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { isFromEsLib, isFromEs5Lib, identifierText, modulePathForSymbol, declaredName, resolveAlias, $007CHasTypeFlags$007C_$007C } from "./Utils.js";
|
|
2
|
+
import { isFromEsLib, isFromEs5Lib, identifierText, isTopLevelModuleDeclaration, modulePathForSymbol, declaredName, $007CHasSymbolFlags$007C_$007C, resolveAlias, $007CHasTypeFlags$007C_$007C } from "./Utils.js";
|
|
3
3
|
import { defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
4
4
|
import { contains, item } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
|
|
5
|
-
import {
|
|
5
|
+
import { collect as collect_1, append as append_1, delay, toList, exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
6
|
+
import { filter, isEmpty, singleton, append, map, empty } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
6
7
|
import { GlueFunctionDeclaration, GlueSubstitution_substituteParameter, GlueSubstitution_substitute, GlueSubstitution_mentionedTypeParameters, GlueFunctionType, GlueTypeReference, GlueType, GluePrimitive } from "../GlueAST.js";
|
|
7
|
-
import {
|
|
8
|
+
import { sanitizeTypeName, removeSurroundingQuotes } from "../Utils/Naming.js";
|
|
9
|
+
import { PackageContext__ModulePath_Z721C83C5 } from "./Types.js";
|
|
10
|
+
import { normalizePath } from "../Utils/String.js";
|
|
8
11
|
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.17.2/FSharp.Core.js";
|
|
9
12
|
import { FSharpSet__Contains, ofSeq } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
|
|
10
13
|
import { structuralHash, equals, comparePrimitives } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
@@ -21,7 +24,7 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
21
24
|
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
22
25
|
const typ = checker.getTypeAtLocation(typeQueryNode.exprName);
|
|
23
26
|
const matchValue = typ.flags;
|
|
24
|
-
if ($007CHasTypeFlags$007C_$007C(
|
|
27
|
+
if ($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) {
|
|
25
28
|
const exprNameKind = typeQueryNode.exprName.kind;
|
|
26
29
|
const matchValue_1 = typ.getSymbol();
|
|
27
30
|
if (matchValue_1 != null) {
|
|
@@ -44,58 +47,123 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
44
47
|
switch (matchResult) {
|
|
45
48
|
case 0: {
|
|
46
49
|
const declaration_1 = item(0, declarations_2);
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
const hasValueExport = (isOwnDeclaration) => exists((export$) => {
|
|
51
|
+
let declarations_3;
|
|
52
|
+
const export$_1 = defaultArg(resolveAlias(checker, export$), export$);
|
|
53
|
+
const matchValue_6 = export$_1.flags;
|
|
54
|
+
if ($007CHasSymbolFlags$007C_$007C(111551, matchValue_6) != null) {
|
|
55
|
+
const matchValue_7 = export$_1.declarations;
|
|
56
|
+
let matchResult_1, declarations_4;
|
|
57
|
+
if (matchValue_7 != null) {
|
|
58
|
+
if ((declarations_3 = matchValue_7, declarations_3.length > 0)) {
|
|
59
|
+
matchResult_1 = 0;
|
|
60
|
+
declarations_4 = matchValue_7;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
matchResult_1 = 1;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
matchResult_1 = 1;
|
|
68
|
+
}
|
|
69
|
+
switch (matchResult_1) {
|
|
70
|
+
case 0:
|
|
71
|
+
return isOwnDeclaration(item(0, declarations_4));
|
|
72
|
+
default:
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
54
75
|
}
|
|
55
|
-
|
|
56
|
-
|
|
76
|
+
else {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}, checker.getExportsOfModule(symbol_1));
|
|
80
|
+
const matchValue_8 = declaration_1.kind;
|
|
81
|
+
let matchResult_2;
|
|
82
|
+
switch (matchValue_8) {
|
|
83
|
+
case 174:
|
|
84
|
+
case 175: {
|
|
85
|
+
matchResult_2 = 4;
|
|
57
86
|
break;
|
|
58
87
|
}
|
|
59
88
|
case 263: {
|
|
60
|
-
|
|
89
|
+
matchResult_2 = 3;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
case 264: {
|
|
93
|
+
matchResult_2 = 0;
|
|
61
94
|
break;
|
|
62
95
|
}
|
|
63
|
-
case
|
|
64
|
-
|
|
96
|
+
case 268: {
|
|
97
|
+
matchResult_2 = 1;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
case 308: {
|
|
101
|
+
matchResult_2 = 2;
|
|
65
102
|
break;
|
|
66
103
|
}
|
|
67
104
|
default:
|
|
68
105
|
if (isFromEs5Lib(symbol_1) ? true : isFromEsLib(symbol_1)) {
|
|
69
|
-
|
|
106
|
+
matchResult_2 = 5;
|
|
70
107
|
}
|
|
71
108
|
else {
|
|
72
|
-
|
|
109
|
+
matchResult_2 = 6;
|
|
73
110
|
}
|
|
74
111
|
}
|
|
75
|
-
switch (
|
|
112
|
+
switch (matchResult_2) {
|
|
76
113
|
case 0: {
|
|
77
114
|
let typeArguments;
|
|
78
|
-
const
|
|
79
|
-
typeArguments = ((
|
|
115
|
+
const matchValue_9 = declaration_1.typeParameters;
|
|
116
|
+
typeArguments = ((matchValue_9 == null) ? empty() : map((_arg_6) => (new GlueType(/* Primitive */ 3, [GluePrimitive.Any])), toList(matchValue_9)));
|
|
80
117
|
return new GlueType(/* TypeReference */ 13, [new GlueTypeReference(defaultArg(declaredName(symbol_1), symbol_1.name), checker.getFullyQualifiedName(symbol_1), modulePathForSymbol(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), false, symbol_1), typeArguments, false)]);
|
|
81
118
|
}
|
|
82
119
|
case 1:
|
|
83
|
-
|
|
120
|
+
if (!hasValueExport((_arg_7) => true)) {
|
|
121
|
+
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
const moduleDeclaration = declaration_1;
|
|
125
|
+
const rawName = removeSurroundingQuotes(moduleDeclaration.name.getText());
|
|
126
|
+
const moduleName = isTopLevelModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), declaration_1) ? sanitizeTypeName(rawName + "_") : sanitizeTypeName(rawName);
|
|
127
|
+
return new GlueType(/* TypeReference */ 13, [new GlueTypeReference("Exports", checker.getFullyQualifiedName(symbol_1), append(modulePathForSymbol(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), false, symbol_1), singleton(moduleName)), empty(), false)]);
|
|
128
|
+
}
|
|
84
129
|
case 2: {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
130
|
+
const sourceFile = declaration_1;
|
|
131
|
+
const matchValue_10 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
|
|
132
|
+
let matchResult_3, packageContext_1;
|
|
133
|
+
if (matchValue_10 != null) {
|
|
134
|
+
if (hasValueExport((declaration_2) => (normalizePath(declaration_2.getSourceFile().fileName) === normalizePath(sourceFile.fileName)))) {
|
|
135
|
+
matchResult_3 = 0;
|
|
136
|
+
packageContext_1 = matchValue_10;
|
|
89
137
|
}
|
|
90
138
|
else {
|
|
91
|
-
|
|
139
|
+
matchResult_3 = 1;
|
|
92
140
|
}
|
|
93
141
|
}
|
|
94
142
|
else {
|
|
95
|
-
|
|
143
|
+
matchResult_3 = 1;
|
|
144
|
+
}
|
|
145
|
+
switch (matchResult_3) {
|
|
146
|
+
case 0:
|
|
147
|
+
return new GlueType(/* TypeReference */ 13, [new GlueTypeReference("Exports", checker.getFullyQualifiedName(symbol_1), PackageContext__ModulePath_Z721C83C5(packageContext_1, sourceFile.fileName), empty(), false)]);
|
|
148
|
+
default:
|
|
149
|
+
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
96
150
|
}
|
|
97
151
|
}
|
|
98
152
|
case 3: {
|
|
153
|
+
const matchValue_11 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration_1);
|
|
154
|
+
if (matchValue_11.tag === 6) {
|
|
155
|
+
if (!isEmpty(matchValue_11.fields[0].TypeParameters)) {
|
|
156
|
+
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return new GlueType(/* FunctionType */ 15, [new GlueFunctionType(matchValue_11.fields[0].Documentation, matchValue_11.fields[0].Type, matchValue_11.fields[0].TypeParameters, empty(), matchValue_11.fields[0].Parameters)]);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
return matchValue_11;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
case 4: {
|
|
99
167
|
let inScope;
|
|
100
168
|
const collect = (node_mut, acc_mut) => {
|
|
101
169
|
collect:
|
|
@@ -123,21 +191,21 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
123
191
|
});
|
|
124
192
|
return new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(documentation, true, name, GlueSubstitution_substitute(free, returnType), map((parameter_1) => GlueSubstitution_substituteParameter(free, parameter_1), parameters), empty())]);
|
|
125
193
|
};
|
|
126
|
-
const
|
|
127
|
-
switch (
|
|
194
|
+
const matchValue_12 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_1);
|
|
195
|
+
switch (matchValue_12.tag) {
|
|
128
196
|
case 0: {
|
|
129
|
-
const info_3 =
|
|
197
|
+
const info_3 = matchValue_12.fields[0];
|
|
130
198
|
return toFunctionDeclaration(info_3.Name, info_3.Documentation, info_3.Parameters, info_3.Type);
|
|
131
199
|
}
|
|
132
200
|
case 6: {
|
|
133
|
-
const info_4 =
|
|
201
|
+
const info_4 = matchValue_12.fields[0];
|
|
134
202
|
return toFunctionDeclaration(info_4.Name, info_4.Documentation, info_4.Parameters, info_4.Type);
|
|
135
203
|
}
|
|
136
204
|
default:
|
|
137
205
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
138
206
|
}
|
|
139
207
|
}
|
|
140
|
-
case
|
|
208
|
+
case 5:
|
|
141
209
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
142
210
|
default:
|
|
143
211
|
if (contains(declaration_1, declarationsInProgress, {
|
|
@@ -191,7 +259,7 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
191
259
|
const declaration = input_5.fields[0];
|
|
192
260
|
let input_3;
|
|
193
261
|
const matchValue_3 = declaration.kind;
|
|
194
|
-
input_3 = ((matchValue_3 ===
|
|
262
|
+
input_3 = ((matchValue_3 === 261) ? (new FSharpResult$2(/* Ok */ 0, [declaration])) : (new FSharpResult$2(/* Error */ 1, [Report_readerError_Z19516DCE("type node (TypeQuery)", concat("Unsupported declaration kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue_3)), typeQueryNode, "/_//src/Glutinum.Converter/Reader/TypeQueryNode.fs", 66)])));
|
|
195
263
|
if (input_3.tag === 1) {
|
|
196
264
|
_arg_5 = (new FSharpResult$2(/* Error */ 1, [input_3.fields[0]]));
|
|
197
265
|
}
|
|
@@ -208,11 +276,11 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
208
276
|
const typeNode = input_1.fields[0];
|
|
209
277
|
const matchValue_4 = typeNode.kind;
|
|
210
278
|
switch (matchValue_4) {
|
|
211
|
-
case
|
|
279
|
+
case 190: {
|
|
212
280
|
_arg_5 = (new FSharpResult$2(/* Ok */ 0, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode)]));
|
|
213
281
|
break;
|
|
214
282
|
}
|
|
215
|
-
case
|
|
283
|
+
case 199: {
|
|
216
284
|
const typeOperatorNode = typeNode;
|
|
217
285
|
_arg_5 = (new FSharpResult$2(/* Ok */ 0, [reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeOperatorNodeZ6830FC33"](typeOperatorNode)]));
|
|
218
286
|
break;
|
|
@@ -239,19 +307,19 @@ export function readTypeQueryNode(reader, typeQueryNode) {
|
|
|
239
307
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
240
308
|
}
|
|
241
309
|
}
|
|
242
|
-
else if ($007CHasTypeFlags$007C_$007C(
|
|
310
|
+
else if ($007CHasTypeFlags$007C_$007C(32, matchValue) != null) {
|
|
243
311
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.String$]);
|
|
244
312
|
}
|
|
245
|
-
else if ($007CHasTypeFlags$007C_$007C(
|
|
313
|
+
else if ($007CHasTypeFlags$007C_$007C(64, matchValue) != null) {
|
|
246
314
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Number$]);
|
|
247
315
|
}
|
|
248
|
-
else if ($007CHasTypeFlags$007C_$007C(
|
|
316
|
+
else if ($007CHasTypeFlags$007C_$007C(256, matchValue) != null) {
|
|
249
317
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Bool]);
|
|
250
318
|
}
|
|
251
319
|
else if ($007CHasTypeFlags$007C_$007C(1, matchValue) != null) {
|
|
252
320
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
253
321
|
}
|
|
254
|
-
else if ($007CHasTypeFlags$007C_$007C(
|
|
322
|
+
else if ($007CHasTypeFlags$007C_$007C(16, matchValue) != null) {
|
|
255
323
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Unit]);
|
|
256
324
|
}
|
|
257
325
|
else {
|
|
@@ -104,7 +104,7 @@ export class TypeScriptReader {
|
|
|
104
104
|
const this$ = this;
|
|
105
105
|
return readDeclaration(this$, declaration);
|
|
106
106
|
}
|
|
107
|
-
"Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
107
|
+
"Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadParameters716C1F42"(parameters) {
|
|
108
108
|
const this$ = this;
|
|
109
109
|
return readParameters(this$, parameters);
|
|
110
110
|
}
|
|
@@ -120,7 +120,7 @@ export class TypeScriptReader {
|
|
|
120
120
|
const this$ = this;
|
|
121
121
|
return readIndexedAccessType(this$, declaration);
|
|
122
122
|
}
|
|
123
|
-
"Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
123
|
+
"Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"(typeParametersOpt) {
|
|
124
124
|
const this$ = this;
|
|
125
125
|
return readTypeParameters(this$, typeParametersOpt);
|
|
126
126
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { Record } from "../../fable_modules/fable-library-js.5.17.2/Types.js";
|
|
3
|
-
import { lambda_type,
|
|
3
|
+
import { lambda_type, option_type, record_type, list_type, tuple_type, bool_type, string_type } from "../../fable_modules/fable-library-js.5.17.2/Reflection.js";
|
|
4
4
|
import { normalizePath } from "../Utils/String.js";
|
|
5
5
|
import { tryFind, cons, head, tail, empty as empty_1, isEmpty, reverse, map, ofArray, exists, tryPick, filter, tryHead } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
6
6
|
import { split, join, substring } from "../../fable_modules/fable-library-js.5.17.2/String.js";
|
|
@@ -11,10 +11,11 @@ import { equals } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
|
11
11
|
import { defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
12
12
|
|
|
13
13
|
export class PackageInfo extends Record {
|
|
14
|
-
constructor(ModuleName, RuntimeName, Dir, TypesRoot, EntryFile, SubpathEntries) {
|
|
14
|
+
constructor(ModuleName, RuntimeName, HasRuntime, Dir, TypesRoot, EntryFile, SubpathEntries) {
|
|
15
15
|
super();
|
|
16
16
|
this.ModuleName = ModuleName;
|
|
17
17
|
this.RuntimeName = RuntimeName;
|
|
18
|
+
this.HasRuntime = HasRuntime;
|
|
18
19
|
this.Dir = Dir;
|
|
19
20
|
this.TypesRoot = TypesRoot;
|
|
20
21
|
this.EntryFile = EntryFile;
|
|
@@ -23,7 +24,7 @@ export class PackageInfo extends Record {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export function PackageInfo_$reflection() {
|
|
26
|
-
return record_type("Glutinum.Converter.Reader.Types.PackageInfo", [], PackageInfo, () => [["ModuleName", string_type], ["RuntimeName", string_type], ["Dir", string_type], ["TypesRoot", string_type], ["EntryFile", string_type], ["SubpathEntries", list_type(tuple_type(string_type, string_type))]]);
|
|
27
|
+
return record_type("Glutinum.Converter.Reader.Types.PackageInfo", [], PackageInfo, () => [["ModuleName", string_type], ["RuntimeName", string_type], ["HasRuntime", bool_type], ["Dir", string_type], ["TypesRoot", string_type], ["EntryFile", string_type], ["SubpathEntries", list_type(tuple_type(string_type, string_type))]]);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
/**
|
|
@@ -116,10 +117,9 @@ export function PackageContext__IsExternal_Z721C83C5(this$, fileName) {
|
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
export function PackageContext__FileModuleName_Z11793CAF(this$, package$, fileName) {
|
|
119
|
-
let matchValue, rest, withoutExtension;
|
|
120
|
+
let matchValue, rest, withoutExtension, isSubpathEntry;
|
|
120
121
|
const fileName_1 = normalizePath(fileName);
|
|
121
|
-
|
|
122
|
-
return sanitizeTypeName(join("_", map((segment_1) => join("_", split(segment_1, ["-", ".", " "], undefined, 1)), (matchValue = reverse(filter((segment) => (segment !== ""), ofArray(relativePath.split("/")))), isEmpty(matchValue) ? empty_1() : ((rest = tail(matchValue), (withoutExtension = replace(head(matchValue), "\\.d\\.[cm]?ts$", ""), ((withoutExtension === "index") && !isEmpty(rest)) ? reverse(rest) : (equals(tryHead(rest), withoutExtension) ? reverse(rest) : reverse(cons(withoutExtension, rest))))))))));
|
|
122
|
+
return sanitizeTypeName(join("_", map((segment_1) => join("_", split(segment_1, ["-", ".", " "], undefined, 1)), (matchValue = reverse(filter((segment) => (segment !== ""), ofArray(split(fileName_1.startsWith(package$.TypesRoot) ? substring(fileName_1, package$.TypesRoot.length) : substring(fileName_1, package$.Dir.length), ["/"], undefined, 0)))), isEmpty(matchValue) ? empty_1() : ((rest = tail(matchValue), (withoutExtension = replace(head(matchValue), "\\.d\\.[cm]?ts$", ""), (isSubpathEntry = exists((tupledArg) => (tupledArg[0] === fileName_1), package$.SubpathEntries), ((withoutExtension === "index") && !isEmpty(rest)) ? reverse(rest) : ((equals(tryHead(rest), withoutExtension) && isSubpathEntry) ? reverse(rest) : reverse(cons(withoutExtension, rest)))))))))));
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/**
|
|
@@ -30,7 +30,7 @@ function readUnionTypeCases(reader, unionTypeNode) {
|
|
|
30
30
|
if (ts.isLiteralTypeNode(node_1)) {
|
|
31
31
|
const literalTypeNode = node_1;
|
|
32
32
|
const literalExpression = literalTypeNode.literal;
|
|
33
|
-
if (ts.isStringLiteral(literalExpression) ? true : ts.isNumericLiteral(literalExpression)) {
|
|
33
|
+
if ((ts.isStringLiteral(literalExpression)) ? true : (ts.isNumericLiteral(literalExpression))) {
|
|
34
34
|
return singleton(new GlueType(/* Literal */ 8, [(option_1 = tryReadLiteral(checker, literalExpression), (option_1 != null) ? option_1 : (() => {
|
|
35
35
|
throw new Exception("Expected a NumericLiteral");
|
|
36
36
|
})())]));
|
|
@@ -51,7 +51,7 @@ function readUnionTypeCases(reader, unionTypeNode) {
|
|
|
51
51
|
case 106:
|
|
52
52
|
case 157:
|
|
53
53
|
return singleton(new GlueType(/* Primitive */ 3, [GluePrimitive.Null]));
|
|
54
|
-
case
|
|
54
|
+
case 225: {
|
|
55
55
|
const option_5 = tryReadLiteral(checker, literalExpression);
|
|
56
56
|
if (option_5 != null) {
|
|
57
57
|
return singleton(new GlueType(/* Literal */ 8, [option_5]));
|
|
@@ -91,7 +91,7 @@ function readUnionTypeCases(reader, unionTypeNode) {
|
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
93
|
const declaration = item(0, declarations);
|
|
94
|
-
if (declaration.kind ===
|
|
94
|
+
if (declaration.kind === 266) {
|
|
95
95
|
if (!isEmpty(modulePathForSymbol(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), false, symbolOpt))) {
|
|
96
96
|
return singleton(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeReferenceNode));
|
|
97
97
|
}
|
|
@@ -131,7 +131,7 @@ function readUnionTypeCases(reader, unionTypeNode) {
|
|
|
131
131
|
throw new Exception(Report_readerError_Z19516DCE("union type cases", "Missing symbol", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/UnionTypeNode.fs", 71));
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
else if (node_1.kind ===
|
|
134
|
+
else if (node_1.kind === 193) {
|
|
135
135
|
return readUnionTypeCases(reader, node_1).fields[0];
|
|
136
136
|
}
|
|
137
137
|
else {
|
|
@@ -141,8 +141,9 @@ function readUnionTypeCases(reader, unionTypeNode) {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
export function readUnionTypeNode(reader, unionTypeNode) {
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
let this$;
|
|
145
|
+
if (((((this$ = unionTypeNode.types, ~~this$.length)) === 1) && !(ts.isLiteralTypeNode(unionTypeNode.types[0]))) && !(ts.isTypeReferenceNode(unionTypeNode.types[0]))) {
|
|
146
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](unionTypeNode.types[0]);
|
|
146
147
|
}
|
|
147
148
|
else {
|
|
148
149
|
return new GlueType(/* Union */ 7, [readUnionTypeCases(reader, unionTypeNode)]);
|