@glutinum/cli 0.14.0 → 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/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs +89 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs.js +105 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/Fable.Promise.fableproj +25 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs +842 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs.js +232 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs +31 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs.js +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs +235 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +384 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AssemblyInfo.fs +19 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs +287 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs.js +128 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOption.fs +127 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs +174 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs.js +37 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResult.fs +483 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs +201 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs +87 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +26 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs +236 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidation.fs +185 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs +186 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationOp.fs +35 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/FsToolkit.ErrorHandling.fableproj +69 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs +276 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs.js +364 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Nullness.fs +81 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Option.fs +462 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs +139 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +48 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionOp.fs +21 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs +88 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +30 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs +200 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidation.fs +34 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs +244 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs +731 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs.js +45 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs +140 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs.js +23 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOp.fs +45 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs +201 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs.js +65 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs +135 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionOp.fs +57 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs +503 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +295 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Validation.fs +167 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs +142 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationOp.fs +35 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueOption.fs +148 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOption.fs +102 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionCE.fs +587 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionOp.fs +10 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Array.js +1348 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Async.js +163 -0
- package/dist/fable_modules/fable-library-js.5.17.2/AsyncBuilder.js +204 -0
- package/dist/fable_modules/fable-library-js.5.17.2/BigInt.js +307 -0
- package/dist/fable_modules/fable-library-js.5.17.2/BitConverter.js +138 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Boolean.js +22 -0
- package/dist/fable_modules/fable-library-js.5.17.2/CHANGELOG.md +348 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Char.js +202 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Choice.js +184 -0
- package/dist/fable_modules/fable-library-js.5.17.2/CollectionUtil.js +182 -0
- package/dist/fable_modules/fable-library-js.5.17.2/ConditionalWeakTable.js +21 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Date.js +834 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateOffset.js +252 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateOnly.js +124 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateOnlyTemporal.js +146 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeFormat.js +523 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeOffsetTemporal.js +283 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeTemporal.js +243 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Decimal.js +238 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Directory.js +11 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Double.js +53 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Encoding.js +185 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Environment.js +3 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Event.js +102 -0
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Collections.js +45 -0
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.CompilerServices.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.js +156 -0
- package/dist/fable_modules/fable-library-js.5.17.2/File.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Global.js +29 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Guid.js +163 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Int32.js +135 -0
- package/dist/fable_modules/fable-library-js.5.17.2/List.js +1337 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Long.js +38 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MailboxProcessor.js +100 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Map.js +1400 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MapUtil.js +130 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MutableMap.js +339 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MutableSet.js +233 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Native.js +14 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Numeric.js +112 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Observable.js +115 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Option.js +87 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Path.js +31 -0
- package/dist/fable_modules/fable-library-js.5.17.2/README.md +3 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Random.js +172 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Range.js +45 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Reflection.js +489 -0
- package/dist/fable_modules/fable-library-js.5.17.2/RegExp.js +170 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Result.js +165 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Seq.js +1504 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Seq2.js +111 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Set.js +1829 -0
- package/dist/fable_modules/fable-library-js.5.17.2/String.js +731 -0
- package/dist/fable_modules/fable-library-js.5.17.2/System.Collections.Generic.js +333 -0
- package/dist/fable_modules/fable-library-js.5.17.2/System.Text.js +200 -0
- package/dist/fable_modules/fable-library-js.5.17.2/System.js +289 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Task.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TaskBuilder.js +72 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeOnly.js +122 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeOnlyTemporal.js +142 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeSpan.js +180 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeSpanTemporal.js +259 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Timer.js +67 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Types.js +198 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Unicode.13.0.0.js +4 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Uri.js +165 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Util.js +807 -0
- package/dist/fable_modules/fable-library-js.5.17.2/big.d.ts +338 -0
- package/dist/fable_modules/fable-library-js.5.17.2/lib/big.js +829 -0
- package/dist/fable_modules/fable-library-js.5.17.2/package.json +24 -0
- package/dist/fable_modules/fable-library-js.5.17.2/quotation.js +682 -0
- 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
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
|
|
2
|
-
import { singleton, empty, append as append_1, delay, indexed, choose, toList, tryItem } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
3
2
|
import { ts } from "@ts-morph/bootstrap";
|
|
3
|
+
import { singleton, empty, append as append_1, delay, indexed, choose, toList, tryItem } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
4
4
|
import { isNullOrWhiteSpace, concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
|
|
5
5
|
import { value as value_5, defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
6
6
|
import { match } from "../../fable_modules/fable-library-js.5.17.2/RegExp.js";
|
|
7
7
|
import { empty as empty_1, forAll, append } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
8
8
|
import { splitLines } from "../Utils/String.js";
|
|
9
9
|
import { GlueCommentParam, GlueCommentTypeParam, GlueComment } from "../GlueAST.js";
|
|
10
|
+
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.17.2/FSharp.Core.js";
|
|
11
|
+
|
|
12
|
+
function textOfComment(comment) {
|
|
13
|
+
if (typeof comment === "string") {
|
|
14
|
+
return ts.getTextOfJSDocComment(comment);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return ts.getTextOfJSDocComment(comment);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
10
20
|
|
|
11
21
|
function readDocumentation(reader, summary, jsDocTags) {
|
|
12
22
|
const isInlineLinkReadAsTag = (tag) => {
|
|
13
|
-
if ((tag.kind ===
|
|
23
|
+
if ((tag.kind === 328) && (tag.tagName.getText() === "link")) {
|
|
14
24
|
const start = ~~tag.getStart() | 0;
|
|
15
25
|
if (start > 0) {
|
|
16
26
|
return tag.getSourceFile().text[start - 1] === "{";
|
|
@@ -44,13 +54,7 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
44
54
|
case 0: {
|
|
45
55
|
let option_4;
|
|
46
56
|
const option_2 = nextTag_1.comment;
|
|
47
|
-
|
|
48
|
-
const comment_1 = option_2;
|
|
49
|
-
option_4 = ts.getTextOfJSDocComment(comment_1);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
option_4 = undefined;
|
|
53
|
-
}
|
|
57
|
+
option_4 = ((option_2 != null) ? textOfComment(option_2) : undefined);
|
|
54
58
|
if (option_4 != null) {
|
|
55
59
|
return concat("{@link ", option_4);
|
|
56
60
|
}
|
|
@@ -63,8 +67,7 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
else {
|
|
66
|
-
|
|
67
|
-
return defaultArg(ts.getTextOfJSDocComment(comment), "");
|
|
70
|
+
return defaultArg(textOfComment(matchValue), "");
|
|
68
71
|
}
|
|
69
72
|
};
|
|
70
73
|
const blockLinks = toList(choose((tag_2) => {
|
|
@@ -72,7 +75,7 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
72
75
|
const matchValue_2 = tag_2.kind;
|
|
73
76
|
const matchValue_3 = tag_2.comment;
|
|
74
77
|
let matchResult_1, comment_3;
|
|
75
|
-
if (matchValue_2 ===
|
|
78
|
+
if (matchValue_2 === 328) {
|
|
76
79
|
if (matchValue_3 != null) {
|
|
77
80
|
if ((tag_2.tagName.getText() === "link") && !isInlineLinkReadAsTag(tag_2)) {
|
|
78
81
|
matchResult_1 = 0;
|
|
@@ -91,7 +94,7 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
91
94
|
}
|
|
92
95
|
switch (matchResult_1) {
|
|
93
96
|
case 0: {
|
|
94
|
-
const option_6 =
|
|
97
|
+
const option_6 = textOfComment(comment_3);
|
|
95
98
|
if (option_6 != null) {
|
|
96
99
|
return (text_1 = option_6, (m = match(/^\[(?<label>[^\]]+)\]\((?<url>[^)\s]+)\)$/gu, text_1.trim()), (m != null) ? (`{@link ${(m.groups && m.groups.url) || ""} | ${(m.groups && m.groups.label) || ""}}`) : concat("{@link ", text_1.trim(), "}")));
|
|
97
100
|
}
|
|
@@ -111,7 +114,7 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
111
114
|
const tag_3 = tupledArg[1];
|
|
112
115
|
const matchValue_5 = tag_3.kind;
|
|
113
116
|
switch (matchValue_5) {
|
|
114
|
-
case
|
|
117
|
+
case 328: {
|
|
115
118
|
const matchValue_8 = tag_3.tagName.getText();
|
|
116
119
|
switch (matchValue_8) {
|
|
117
120
|
case "remarks": {
|
|
@@ -120,8 +123,7 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
120
123
|
return undefined;
|
|
121
124
|
}
|
|
122
125
|
else {
|
|
123
|
-
|
|
124
|
-
return new GlueComment(/* Remarks */ 4, [defaultArg(ts.getTextOfJSDocComment(comment_6), "")]);
|
|
126
|
+
return new GlueComment(/* Remarks */ 4, [defaultArg(textOfComment(matchValue_9), "")]);
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
case "defaultValue": {
|
|
@@ -130,8 +132,7 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
130
132
|
return undefined;
|
|
131
133
|
}
|
|
132
134
|
else {
|
|
133
|
-
|
|
134
|
-
return new GlueComment(/* DefaultValue */ 5, [defaultArg(ts.getTextOfJSDocComment(comment_7), "")]);
|
|
135
|
+
return new GlueComment(/* DefaultValue */ 5, [defaultArg(textOfComment(matchValue_10), "")]);
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
case "example": {
|
|
@@ -140,8 +141,7 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
140
141
|
return undefined;
|
|
141
142
|
}
|
|
142
143
|
else {
|
|
143
|
-
|
|
144
|
-
return new GlueComment(/* Example */ 6, [defaultArg(ts.getTextOfJSDocComment(comment_8), "")]);
|
|
144
|
+
return new GlueComment(/* Example */ 6, [defaultArg(textOfComment(matchValue_11), "")]);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
case "typeParam": {
|
|
@@ -150,8 +150,7 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
150
150
|
return undefined;
|
|
151
151
|
}
|
|
152
152
|
else {
|
|
153
|
-
const
|
|
154
|
-
const matchValue_13 = ts.getTextOfJSDocComment(comment_9);
|
|
153
|
+
const matchValue_13 = textOfComment(matchValue_12);
|
|
155
154
|
if (matchValue_13 == null) {
|
|
156
155
|
return undefined;
|
|
157
156
|
}
|
|
@@ -174,31 +173,24 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
174
173
|
return undefined;
|
|
175
174
|
}
|
|
176
175
|
}
|
|
177
|
-
case
|
|
176
|
+
case 332: {
|
|
178
177
|
const matchValue_7 = tag_3.comment;
|
|
179
178
|
if (matchValue_7 == null) {
|
|
180
179
|
return new GlueComment(/* Deprecated */ 3, [undefined]);
|
|
181
180
|
}
|
|
182
181
|
else {
|
|
183
|
-
|
|
184
|
-
return new GlueComment(/* Deprecated */ 3, [ts.getTextOfJSDocComment(comment_5)]);
|
|
182
|
+
return new GlueComment(/* Deprecated */ 3, [textOfComment(matchValue_7)]);
|
|
185
183
|
}
|
|
186
184
|
}
|
|
187
|
-
case
|
|
185
|
+
case 342: {
|
|
188
186
|
const parameterTag = tag_3;
|
|
189
187
|
const identifier = parameterTag.name;
|
|
190
188
|
let content_1;
|
|
191
189
|
const matchValue_6 = parameterTag.comment;
|
|
192
|
-
|
|
193
|
-
content_1 = undefined;
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
const comment_4 = matchValue_6;
|
|
197
|
-
content_1 = ts.getTextOfJSDocComment(comment_4);
|
|
198
|
-
}
|
|
190
|
+
content_1 = ((matchValue_6 == null) ? undefined : textOfComment(matchValue_6));
|
|
199
191
|
return new GlueComment(/* Param */ 2, [new GlueCommentParam(identifier.getText(), content_1)]);
|
|
200
192
|
}
|
|
201
|
-
case
|
|
193
|
+
case 343: {
|
|
202
194
|
const option_8 = readTagComment(index_1, tag_3);
|
|
203
195
|
if (option_8 != null) {
|
|
204
196
|
return new GlueComment(/* Returns */ 1, [option_8]);
|
|
@@ -207,7 +199,7 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
207
199
|
return undefined;
|
|
208
200
|
}
|
|
209
201
|
}
|
|
210
|
-
case
|
|
202
|
+
case 350: {
|
|
211
203
|
const option_10 = readTagComment(index_1, tag_3);
|
|
212
204
|
if (option_10 != null) {
|
|
213
205
|
return new GlueComment(/* Throws */ 8, [option_10]);
|
|
@@ -237,6 +229,15 @@ export function readDocumentationForSignature(reader, declaration) {
|
|
|
237
229
|
}
|
|
238
230
|
}
|
|
239
231
|
|
|
232
|
+
function jsDocTagsOfParent(node) {
|
|
233
|
+
if (Operators_IsNull(node.parent)) {
|
|
234
|
+
return [];
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
return ts.getJSDocTags(node.parent);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
240
241
|
export function readDocumentationForNode(reader, node) {
|
|
241
242
|
const matchValue = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(node);
|
|
242
243
|
if (matchValue == null) {
|
|
@@ -251,7 +252,7 @@ export function readDocumentationForNode(reader, node) {
|
|
|
251
252
|
}
|
|
252
253
|
else {
|
|
253
254
|
const symbol = matchValue;
|
|
254
|
-
return readDocumentation(reader, symbol.getDocumentationComment(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]()),
|
|
255
|
+
return readDocumentation(reader, symbol.getDocumentationComment(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]()), jsDocTagsOfParent(node));
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
|
|
@@ -23,8 +23,8 @@ export function readExportAssignment(reader, exportNode) {
|
|
|
23
23
|
else {
|
|
24
24
|
exportEqualsDeclarationKind = undefined;
|
|
25
25
|
}
|
|
26
|
-
const isExportEqualsOfVariable = equals(exportEqualsDeclarationKind,
|
|
27
|
-
const isExportEqualsOfDeclaration = equals(exportEqualsDeclarationKind,
|
|
26
|
+
const isExportEqualsOfVariable = equals(exportEqualsDeclarationKind, 261);
|
|
27
|
+
const isExportEqualsOfDeclaration = equals(exportEqualsDeclarationKind, 263) ? true : equals(exportEqualsDeclarationKind, 264);
|
|
28
28
|
if (symbolOpt == null) {
|
|
29
29
|
return GlueType.Discard;
|
|
30
30
|
}
|
|
@@ -59,7 +59,7 @@ export function readExportAssignment(reader, exportNode) {
|
|
|
59
59
|
const tsTyp = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeAtLocation(exportNode.expression);
|
|
60
60
|
if (declaredTypeNode == null) {
|
|
61
61
|
const matchValue_1 = tsTyp.flags;
|
|
62
|
-
if ($007CHasTypeFlags$007C_$007C(
|
|
62
|
+
if ($007CHasTypeFlags$007C_$007C(1048576, matchValue_1) != null) {
|
|
63
63
|
const matchValue_2 = tsTyp.symbol.declarations;
|
|
64
64
|
if (matchValue_2 == null) {
|
|
65
65
|
typ = (new GlueType(/* Primitive */ 3, [GluePrimitive.Any]));
|
|
@@ -70,14 +70,14 @@ export function readExportAssignment(reader, exportNode) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
|
-
typ = (($007CHasTypeFlags$007C_$007C(
|
|
73
|
+
typ = (($007CHasTypeFlags$007C_$007C(32, matchValue_1) != null) ? (new GlueType(/* Primitive */ 3, [GluePrimitive.String$])) : (($007CHasTypeFlags$007C_$007C(64, matchValue_1) != null) ? (new GlueType(/* Primitive */ 3, [GluePrimitive.Number$])) : (($007CHasTypeFlags$007C_$007C(256, matchValue_1) != null) ? (new GlueType(/* Primitive */ 3, [GluePrimitive.Bool])) : (($007CHasTypeFlags$007C_$007C(1, matchValue_1) != null) ? (new GlueType(/* Primitive */ 3, [GluePrimitive.Any])) : (($007CHasTypeFlags$007C_$007C(16, matchValue_1) != null) ? (new GlueType(/* Primitive */ 3, [GluePrimitive.Unit])) : (new GlueType(/* Primitive */ 3, [GluePrimitive.Any])))))));
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
77
|
const typeNode = declaredTypeNode;
|
|
78
78
|
typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode);
|
|
79
79
|
}
|
|
80
|
-
return new GlueType(/* ExportDefault */
|
|
80
|
+
return new GlueType(/* ExportDefault */ 25, [new GlueType(/* Variable */ 2, [new GlueVariable(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](exportNode), isExportEqualsOfVariable ? ("export=" + identiferNode.getText()) : identiferNode.getText(), typ)])]);
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
83
|
return GlueType.Discard;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { modulePathForDeclaration, $007CHasSymbolFlags$007C_$007C } from "./Utils.js";
|
|
3
3
|
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.17.2/FSharp.Core.js";
|
|
4
4
|
import { normalizePath } from "../Utils/String.js";
|
|
5
|
-
import { item } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
|
|
5
|
+
import { contains, item } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
|
|
6
6
|
import { PackageContext__IsExternal_Z721C83C5 } from "./Types.js";
|
|
7
7
|
import { filter, collect, choose, empty } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
8
8
|
import { List_distinctBy } from "../../fable_modules/fable-library-js.5.17.2/Seq2.js";
|
|
@@ -55,7 +55,7 @@ function readReExport(reader, packageContext, currentFile, exportedName, symbol)
|
|
|
55
55
|
else {
|
|
56
56
|
return List_distinctBy((glueType) => {
|
|
57
57
|
let matchResult_1;
|
|
58
|
-
if (glueType.tag ===
|
|
58
|
+
if (glueType.tag === 32) {
|
|
59
59
|
if (glueType.fields[0].Declaration.tag === 1) {
|
|
60
60
|
matchResult_1 = 0;
|
|
61
61
|
}
|
|
@@ -79,15 +79,15 @@ function readReExport(reader, packageContext, currentFile, exportedName, symbol)
|
|
|
79
79
|
let option_1;
|
|
80
80
|
const matchValue_2 = declaration.kind;
|
|
81
81
|
switch (matchValue_2) {
|
|
82
|
-
case
|
|
82
|
+
case 261: {
|
|
83
83
|
option_1 = declaration.parent.parent;
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
|
-
case 262:
|
|
87
86
|
case 263:
|
|
88
87
|
case 264:
|
|
89
88
|
case 265:
|
|
90
|
-
case 266:
|
|
89
|
+
case 266:
|
|
90
|
+
case 267: {
|
|
91
91
|
option_1 = declaration;
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
@@ -95,7 +95,7 @@ function readReExport(reader, packageContext, currentFile, exportedName, symbol)
|
|
|
95
95
|
option_1 = undefined;
|
|
96
96
|
}
|
|
97
97
|
if (option_1 != null) {
|
|
98
|
-
return (declaration_1 = option_1, new GlueType(/* ReExport */
|
|
98
|
+
return (declaration_1 = option_1, new GlueType(/* ReExport */ 32, [new GlueReExport(exportedName, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration_1), modulePathForDeclaration(packageContext, declaration_1))]));
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
101
101
|
return undefined;
|
|
@@ -121,15 +121,15 @@ export function readExportDeclaration(reader, exportDeclaration) {
|
|
|
121
121
|
const packageContext = matchValue;
|
|
122
122
|
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
123
123
|
const currentFile = normalizePath(exportDeclaration.getSourceFile().fileName);
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
126
|
-
const exportClause =
|
|
127
|
-
if (exportClause.kind ===
|
|
124
|
+
const matchValue_2 = exportDeclaration.exportClause;
|
|
125
|
+
if (matchValue_2 != null) {
|
|
126
|
+
const exportClause = matchValue_2;
|
|
127
|
+
if (exportClause.kind === 280) {
|
|
128
128
|
return collect((specifier) => {
|
|
129
129
|
const exportedName = specifier.name.text;
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
return readReExport(reader, packageContext, currentFile, exportedName,
|
|
130
|
+
const matchValue_6 = checker.getExportSpecifierLocalTargetSymbol(specifier);
|
|
131
|
+
if (matchValue_6 != null) {
|
|
132
|
+
return readReExport(reader, packageContext, currentFile, exportedName, matchValue_6);
|
|
133
133
|
}
|
|
134
134
|
else {
|
|
135
135
|
return empty();
|
|
@@ -141,12 +141,12 @@ export function readExportDeclaration(reader, exportDeclaration) {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
146
|
-
const moduleSpecifier =
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
149
|
-
const moduleSymbol =
|
|
144
|
+
const matchValue_3 = exportDeclaration.moduleSpecifier;
|
|
145
|
+
if (matchValue_3 != null) {
|
|
146
|
+
const moduleSpecifier = matchValue_3;
|
|
147
|
+
const matchValue_4 = checker.getSymbolAtLocation(moduleSpecifier);
|
|
148
|
+
if (matchValue_4 != null) {
|
|
149
|
+
const moduleSymbol = matchValue_4;
|
|
150
150
|
return collect((symbol_1) => readReExport(reader, packageContext, currentFile, symbol_1.name, symbol_1), filter((symbol) => (symbol.name !== "default"), toList(checker.getExportsOfModule(moduleSymbol))));
|
|
151
151
|
}
|
|
152
152
|
else {
|
|
@@ -159,6 +159,18 @@ export function readExportDeclaration(reader, exportDeclaration) {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
else {
|
|
162
|
+
const matchValue_1 = exportDeclaration.moduleSpecifier;
|
|
163
|
+
if (matchValue_1 == null) {
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
const warning = "A re-export from another file is only resolved when generating a package, run `glue <package>` instead of a single declaration file";
|
|
167
|
+
if (!contains(warning, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"](), {
|
|
168
|
+
Equals: (x, y) => (x === y),
|
|
169
|
+
GetHashCode: (x) => (stringHash(x) | 0),
|
|
170
|
+
})) {
|
|
171
|
+
void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(warning));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
162
174
|
return empty();
|
|
163
175
|
}
|
|
164
176
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import { exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
3
|
-
import { tryReadKeyOfConstraint,
|
|
3
|
+
import { tryReadKeyOfConstraint, ModifierUtil_HasModifier_742AC9D } from "./Utils.js";
|
|
4
4
|
import { Exception } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
5
5
|
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
6
6
|
import { mapIndexed } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
7
|
-
import { item } from "../../fable_modules/fable-library-js.5.17.2/Array.js";
|
|
8
7
|
import { value } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
9
8
|
import { GlueType, GlueFunctionDeclaration, GlueTypeParameter } from "../GlueAST.js";
|
|
10
9
|
|
|
@@ -12,7 +11,7 @@ export function readFunctionDeclaration(reader, declaration) {
|
|
|
12
11
|
let isDeclared;
|
|
13
12
|
const matchValue = declaration.modifiers;
|
|
14
13
|
isDeclared = ((matchValue == null) ? false : exists((modifier) => (modifier.kind === 138), matchValue));
|
|
15
|
-
const isDefaultExport =
|
|
14
|
+
const isDefaultExport = ModifierUtil_HasModifier_742AC9D(declaration.modifiers, 90);
|
|
16
15
|
let name_1;
|
|
17
16
|
const matchValue_1 = declaration.name;
|
|
18
17
|
if (matchValue_1 == null) {
|
|
@@ -27,17 +26,17 @@ export function readFunctionDeclaration(reader, declaration) {
|
|
|
27
26
|
const name = matchValue_1;
|
|
28
27
|
name_1 = name.getText();
|
|
29
28
|
}
|
|
30
|
-
const functionDeclaration = new GlueFunctionDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromSignature61B89E55"](declaration), isDeclared, name_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](declaration.type), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
31
|
-
const matchValue_2 = tryReadKeyOfConstraint(reader,
|
|
29
|
+
const functionDeclaration = new GlueFunctionDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromSignature61B89E55"](declaration), isDeclared, name_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](declaration.type), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadParameters716C1F42"](declaration.parameters), mapIndexed((index, typeParameter) => {
|
|
30
|
+
const matchValue_2 = tryReadKeyOfConstraint(reader, value(declaration.typeParameters)[index]);
|
|
32
31
|
if (matchValue_2 == null) {
|
|
33
32
|
return typeParameter;
|
|
34
33
|
}
|
|
35
34
|
else {
|
|
36
35
|
return new GlueTypeParameter(typeParameter.Name, matchValue_2, typeParameter.Default);
|
|
37
36
|
}
|
|
38
|
-
}, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
37
|
+
}, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"](declaration.typeParameters)));
|
|
39
38
|
if (isDefaultExport) {
|
|
40
|
-
return new GlueType(/* ExportDefault */
|
|
39
|
+
return new GlueType(/* ExportDefault */ 25, [new GlueType(/* FunctionDeclaration */ 6, [functionDeclaration])]);
|
|
41
40
|
}
|
|
42
41
|
else {
|
|
43
42
|
return new GlueType(/* FunctionDeclaration */ 6, [functionDeclaration]);
|
|
@@ -10,27 +10,35 @@ export function readIndexedAccessType(reader, declaration) {
|
|
|
10
10
|
const idxNodeType = declaration.indexType;
|
|
11
11
|
const withIndexType = (indexType) => (new GlueType(/* IndexedAccessType */ 10, [new GlueIndexedAccessType(indexType, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](declaration.objectType))]));
|
|
12
12
|
const node = declaration;
|
|
13
|
-
const
|
|
13
|
+
const tryTypeToTypeNode = (typ, flags) => {
|
|
14
|
+
try {
|
|
15
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().typeToTypeNode(typ, node, flags);
|
|
16
|
+
}
|
|
17
|
+
catch (matchValue) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const matchValue_3 = idxNodeType.kind;
|
|
14
22
|
let matchResult;
|
|
15
|
-
switch (
|
|
23
|
+
switch (matchValue_3) {
|
|
16
24
|
case 150: {
|
|
17
25
|
matchResult = 1;
|
|
18
26
|
break;
|
|
19
27
|
}
|
|
20
28
|
case 154:
|
|
21
|
-
case
|
|
29
|
+
case 184: {
|
|
22
30
|
matchResult = 4;
|
|
23
31
|
break;
|
|
24
32
|
}
|
|
25
|
-
case
|
|
33
|
+
case 194: {
|
|
26
34
|
matchResult = 5;
|
|
27
35
|
break;
|
|
28
36
|
}
|
|
29
|
-
case
|
|
37
|
+
case 199: {
|
|
30
38
|
matchResult = 0;
|
|
31
39
|
break;
|
|
32
40
|
}
|
|
33
|
-
case
|
|
41
|
+
case 202: {
|
|
34
42
|
if (node.pos >= 0) {
|
|
35
43
|
matchResult = 2;
|
|
36
44
|
}
|
|
@@ -44,22 +52,21 @@ export function readIndexedAccessType(reader, declaration) {
|
|
|
44
52
|
}
|
|
45
53
|
switch (matchResult) {
|
|
46
54
|
case 0: {
|
|
47
|
-
let
|
|
55
|
+
let matchValue_4;
|
|
48
56
|
if (node.pos < 0) {
|
|
49
|
-
|
|
57
|
+
matchValue_4 = undefined;
|
|
50
58
|
}
|
|
51
59
|
else {
|
|
52
60
|
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
if ($007CHasTypeFlags$007C_$007C(
|
|
56
|
-
const
|
|
57
|
-
const matchValue_1 = checker.typeToTypeNode(typ, node, flags);
|
|
61
|
+
const typ_1 = checker.getTypeAtLocation(node);
|
|
62
|
+
const matchValue_1 = typ_1.flags;
|
|
63
|
+
if ($007CHasTypeFlags$007C_$007C(134217728, matchValue_1) != null) {
|
|
64
|
+
const matchValue_2 = tryTypeToTypeNode(typ_1, 1 | 16384);
|
|
58
65
|
let matchResult_1, typeNode_1;
|
|
59
|
-
if (
|
|
60
|
-
if ((typeNode =
|
|
66
|
+
if (matchValue_2 != null) {
|
|
67
|
+
if ((typeNode = matchValue_2, typeNode.kind === 193)) {
|
|
61
68
|
matchResult_1 = 0;
|
|
62
|
-
typeNode_1 =
|
|
69
|
+
typeNode_1 = matchValue_2;
|
|
63
70
|
}
|
|
64
71
|
else {
|
|
65
72
|
matchResult_1 = 1;
|
|
@@ -70,23 +77,23 @@ export function readIndexedAccessType(reader, declaration) {
|
|
|
70
77
|
}
|
|
71
78
|
switch (matchResult_1) {
|
|
72
79
|
case 0: {
|
|
73
|
-
|
|
80
|
+
matchValue_4 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode_1);
|
|
74
81
|
break;
|
|
75
82
|
}
|
|
76
83
|
default:
|
|
77
|
-
|
|
84
|
+
matchValue_4 = undefined;
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
87
|
else {
|
|
81
|
-
|
|
88
|
+
matchValue_4 = undefined;
|
|
82
89
|
}
|
|
83
90
|
}
|
|
84
|
-
if (
|
|
91
|
+
if (matchValue_4 == null) {
|
|
85
92
|
const typeOperatorNode = declaration.indexType;
|
|
86
93
|
return withIndexType(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeOperatorNodeZ6830FC33"](typeOperatorNode));
|
|
87
94
|
}
|
|
88
95
|
else {
|
|
89
|
-
return
|
|
96
|
+
return matchValue_4;
|
|
90
97
|
}
|
|
91
98
|
}
|
|
92
99
|
case 1:
|
|
@@ -95,19 +102,19 @@ export function readIndexedAccessType(reader, declaration) {
|
|
|
95
102
|
const checker_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
96
103
|
const objectType = checker_1.getTypeAtLocation(declaration.objectType);
|
|
97
104
|
const key = idxNodeType.literal.text;
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
105
|
+
const flags_2 = 1 | 16384;
|
|
106
|
+
const matchValue_5 = checker_1.getPropertyOfType(objectType, key);
|
|
107
|
+
if (matchValue_5 == null) {
|
|
101
108
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
102
109
|
}
|
|
103
110
|
else {
|
|
104
|
-
const property =
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
111
|
+
const property = matchValue_5;
|
|
112
|
+
const matchValue_6 = tryTypeToTypeNode(checker_1.getTypeOfSymbol(property), flags_2);
|
|
113
|
+
if (matchValue_6 == null) {
|
|
107
114
|
return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
|
|
108
115
|
}
|
|
109
116
|
else {
|
|
110
|
-
const typeNode_2 =
|
|
117
|
+
const typeNode_2 = matchValue_6;
|
|
111
118
|
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode_2);
|
|
112
119
|
}
|
|
113
120
|
}
|
|
@@ -119,7 +126,7 @@ export function readIndexedAccessType(reader, declaration) {
|
|
|
119
126
|
case 5:
|
|
120
127
|
return withIndexType(GlueType.Discard);
|
|
121
128
|
default: {
|
|
122
|
-
const warning = Report_readerError_Z19516DCE("readIndexedAccessType", concat("Unsupported node kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(
|
|
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", 93);
|
|
123
130
|
void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(warning));
|
|
124
131
|
return withIndexType(GlueType.Discard);
|
|
125
132
|
}
|
|
@@ -41,7 +41,7 @@ export function readInterfaceDeclaration(reader, declaration) {
|
|
|
41
41
|
}
|
|
42
42
|
const members = collect((declaration_1) => map((declaration_2) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_2), toList(declaration_1.members)), cons(declaration, otherDeclarations));
|
|
43
43
|
let typeParameters;
|
|
44
|
-
const own = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
44
|
+
const own = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"](declaration.typeParameters);
|
|
45
45
|
if (forAll((typeParameter) => (typeParameter.Default != null), own)) {
|
|
46
46
|
typeParameters = own;
|
|
47
47
|
}
|
|
@@ -53,8 +53,8 @@ export function readInterfaceDeclaration(reader, declaration) {
|
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
55
|
const symbol_1 = matchValue_1;
|
|
56
|
-
othersDefaults = map((other_1) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.
|
|
57
|
-
if (other.kind ===
|
|
56
|
+
othersDefaults = map((other_1) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"](other_1.typeParameters), filter((other) => {
|
|
57
|
+
if (other.kind === 265) {
|
|
58
58
|
return !(other === declaration);
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
@@ -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;
|