@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,13 +1,13 @@
|
|
|
1
1
|
|
|
2
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.
|
|
4
|
-
import { isNullOrWhiteSpace, concat } from "../../fable_modules/fable-library-js.5.
|
|
5
|
-
import { value as
|
|
6
|
-
import { match } from "../../fable_modules/fable-library-js.5.
|
|
7
|
-
import { empty as empty_1, forAll, append } from "../../fable_modules/fable-library-js.5.
|
|
3
|
+
import { singleton, empty, append as append_1, delay, indexed, choose, toList, tryItem } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
4
|
+
import { isNullOrWhiteSpace, concat } from "../../fable_modules/fable-library-js.5.21.0/String.js";
|
|
5
|
+
import { value as value_3, defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
6
|
+
import { match } from "../../fable_modules/fable-library-js.5.21.0/RegExp.js";
|
|
7
|
+
import { empty as empty_1, forAll, append } from "../../fable_modules/fable-library-js.5.21.0/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.
|
|
10
|
+
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.21.0/FSharp.Core.js";
|
|
11
11
|
|
|
12
12
|
function textOfComment(comment) {
|
|
13
13
|
if (typeof comment === "string") {
|
|
@@ -115,47 +115,35 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
115
115
|
const matchValue_5 = tag_3.kind;
|
|
116
116
|
switch (matchValue_5) {
|
|
117
117
|
case 328: {
|
|
118
|
+
const textTag = (make) => {
|
|
119
|
+
const option_13 = tag_3.comment;
|
|
120
|
+
if (option_13 != null) {
|
|
121
|
+
return make(defaultArg(textOfComment(option_13), ""));
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
118
127
|
const matchValue_8 = tag_3.tagName.getText();
|
|
119
128
|
switch (matchValue_8) {
|
|
120
|
-
case "remarks":
|
|
129
|
+
case "remarks":
|
|
130
|
+
return textTag((Item_4) => (new GlueComment(/* Remarks */ 4, [Item_4])));
|
|
131
|
+
case "defaultValue":
|
|
132
|
+
return textTag((Item_5) => (new GlueComment(/* DefaultValue */ 5, [Item_5])));
|
|
133
|
+
case "example":
|
|
134
|
+
return textTag((Item_6) => (new GlueComment(/* Example */ 6, [Item_6])));
|
|
135
|
+
case "typeParam": {
|
|
121
136
|
const matchValue_9 = tag_3.comment;
|
|
122
137
|
if (matchValue_9 == null) {
|
|
123
138
|
return undefined;
|
|
124
139
|
}
|
|
125
140
|
else {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
case "defaultValue": {
|
|
130
|
-
const matchValue_10 = tag_3.comment;
|
|
131
|
-
if (matchValue_10 == null) {
|
|
132
|
-
return undefined;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
return new GlueComment(/* DefaultValue */ 5, [defaultArg(textOfComment(matchValue_10), "")]);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
case "example": {
|
|
139
|
-
const matchValue_11 = tag_3.comment;
|
|
140
|
-
if (matchValue_11 == null) {
|
|
141
|
-
return undefined;
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
return new GlueComment(/* Example */ 6, [defaultArg(textOfComment(matchValue_11), "")]);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
case "typeParam": {
|
|
148
|
-
const matchValue_12 = tag_3.comment;
|
|
149
|
-
if (matchValue_12 == null) {
|
|
150
|
-
return undefined;
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
const matchValue_13 = textOfComment(matchValue_12);
|
|
154
|
-
if (matchValue_13 == null) {
|
|
141
|
+
const matchValue_10 = textOfComment(matchValue_9);
|
|
142
|
+
if (matchValue_10 == null) {
|
|
155
143
|
return undefined;
|
|
156
144
|
}
|
|
157
145
|
else {
|
|
158
|
-
const text_3 =
|
|
146
|
+
const text_3 = matchValue_10;
|
|
159
147
|
const m_1 = match(/\s*(?<type>[^-\s]*)\s*-\s*(?<description>.*)/gus, text_3);
|
|
160
148
|
if (m_1 != null) {
|
|
161
149
|
return new GlueComment(/* TypeParam */ 7, [new GlueCommentTypeParam((m_1.groups && m_1.groups.type) || "", ((m_1.groups && m_1.groups.description) != null) ? ((m_1.groups && m_1.groups.description) || "") : undefined)]);
|
|
@@ -213,8 +201,8 @@ function readDocumentation(reader, summary, jsDocTags) {
|
|
|
213
201
|
}
|
|
214
202
|
}, indexed(jsDocTags)));
|
|
215
203
|
return toList(delay(() => {
|
|
216
|
-
let
|
|
217
|
-
return append_1((
|
|
204
|
+
let matchValue_11;
|
|
205
|
+
return append_1((matchValue_11 = summary_1, (matchValue_11 == null) ? (empty()) : singleton(matchValue_11)), delay(() => jsDocTags_1));
|
|
218
206
|
}));
|
|
219
207
|
}
|
|
220
208
|
|
|
@@ -246,7 +234,7 @@ export function readDocumentationForNode(reader, node) {
|
|
|
246
234
|
return empty_1();
|
|
247
235
|
}
|
|
248
236
|
else {
|
|
249
|
-
const symbol_1 =
|
|
237
|
+
const symbol_1 = value_3(matchValue_1);
|
|
250
238
|
return readDocumentation(reader, symbol_1.getDocumentationComment(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]()), ts.getJSDocTags(node));
|
|
251
239
|
}
|
|
252
240
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { GlueEnum, GlueEnumMember, GlueLiteral } from "../GlueAST.js";
|
|
3
|
-
import { fold, ofSeq, empty, singleton, append } from "../../fable_modules/fable-library-js.5.
|
|
4
|
-
import { uncurry2 } from "../../fable_modules/fable-library-js.5.
|
|
3
|
+
import { fold, ofSeq, empty, singleton, append } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
4
|
+
import { uncurry2 } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
5
5
|
|
|
6
6
|
function readEnumMembers(checker, state, enumMember) {
|
|
7
7
|
let num, str;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
import { equals } from "../../fable_modules/fable-library-js.5.
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { defaultOf, equals } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
3
|
+
import { PackageContext__DefaultExportName_Z721C83C5, PackageContext__TryFindPackage_Z721C83C5 } from "./Types.js";
|
|
4
|
+
import { normalizePath } from "../Utils/String.js";
|
|
5
|
+
import { forAll } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
6
|
+
import { isLetterOrDigit } from "../../fable_modules/fable-library-js.5.21.0/Char.js";
|
|
7
|
+
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.21.0/FSharp.Core.js";
|
|
8
|
+
import { primitiveOfFlags, $007CHasTypeFlags$007C_$007C, $007CHasSymbolFlags$007C_$007C } from "./Utils.js";
|
|
9
|
+
import { value as value_2, some, defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
10
|
+
import { GlueVariable, GlueFunctionDeclaration, GluePrimitive, GlueType } from "../GlueAST.js";
|
|
11
|
+
import { item } from "../../fable_modules/fable-library-js.5.21.0/Array.js";
|
|
6
12
|
|
|
7
13
|
export function readExportAssignment(reader, exportNode) {
|
|
8
|
-
let declaration;
|
|
14
|
+
let declaration, package$, name_1, declares, exports, option_5, moduleSymbol, declaration_1, declarations;
|
|
9
15
|
const symbolOpt = exportNode.symbol;
|
|
10
|
-
let
|
|
11
|
-
if (
|
|
16
|
+
let targetDeclarationKind;
|
|
17
|
+
if (exportNode.expression.kind === 80) {
|
|
12
18
|
let option_3;
|
|
13
19
|
const option_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(exportNode.expression);
|
|
14
20
|
if (option_1 != null) {
|
|
@@ -18,39 +24,77 @@ export function readExportAssignment(reader, exportNode) {
|
|
|
18
24
|
else {
|
|
19
25
|
option_3 = undefined;
|
|
20
26
|
}
|
|
21
|
-
|
|
27
|
+
targetDeclarationKind = ((option_3 != null) ? ((declaration = option_3, declaration.kind)) : undefined);
|
|
22
28
|
}
|
|
23
29
|
else {
|
|
24
|
-
|
|
30
|
+
targetDeclarationKind = undefined;
|
|
25
31
|
}
|
|
32
|
+
const exportEqualsDeclarationKind = equals(exportNode.isExportEquals, true) ? targetDeclarationKind : undefined;
|
|
33
|
+
const isDefaultOfVariable = !equals(exportNode.isExportEquals, true) && equals(targetDeclarationKind, 261);
|
|
34
|
+
const sourceFile = exportNode.getSourceFile();
|
|
35
|
+
let packageName;
|
|
36
|
+
let option_14;
|
|
37
|
+
let option_12;
|
|
38
|
+
let option_10;
|
|
39
|
+
const option_8 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
|
|
40
|
+
option_10 = ((option_8 != null) ? PackageContext__TryFindPackage_Z721C83C5(option_8, sourceFile.fileName) : undefined);
|
|
41
|
+
option_12 = ((option_10 != null) ? (((package$ = option_10, normalizePath(sourceFile.fileName) === package$.EntryFile)) ? option_10 : undefined) : undefined);
|
|
42
|
+
option_14 = ((option_12 != null) ? option_12.RuntimeName : undefined);
|
|
43
|
+
packageName = ((option_14 != null) ? (((name_1 = option_14, forAll((c) => {
|
|
44
|
+
if (isLetterOrDigit(c)) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return c === "_";
|
|
49
|
+
}
|
|
50
|
+
}, name_1.split("")) && !((declares = ((table) => {
|
|
51
|
+
if (Operators_IsNull(table)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const symbol_1 = table.get(name_1);
|
|
56
|
+
if (!Operators_IsNull(symbol_1)) {
|
|
57
|
+
const matchValue = symbol_1.flags;
|
|
58
|
+
if ($007CHasSymbolFlags$007C_$007C(2097152, matchValue) != null) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}), (exports = defaultArg((option_5 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(sourceFile), (option_5 != null) ? some((moduleSymbol = option_5, moduleSymbol.exports)) : undefined), defaultOf()), declares(sourceFile.locals) ? true : declares(exports)))))) ? option_14 : undefined) : undefined);
|
|
70
|
+
let publishedName;
|
|
71
|
+
const option_16 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
|
|
72
|
+
publishedName = ((option_16 != null) ? PackageContext__DefaultExportName_Z721C83C5(option_16, sourceFile.fileName) : undefined);
|
|
26
73
|
const isExportEqualsOfVariable = equals(exportEqualsDeclarationKind, 261);
|
|
27
74
|
const isExportEqualsOfDeclaration = equals(exportEqualsDeclarationKind, 263) ? true : equals(exportEqualsDeclarationKind, 264);
|
|
28
75
|
if (symbolOpt == null) {
|
|
29
76
|
return GlueType.Discard;
|
|
30
77
|
}
|
|
31
78
|
else {
|
|
32
|
-
const
|
|
33
|
-
if (((
|
|
79
|
+
const symbol_2 = symbolOpt;
|
|
80
|
+
if (((symbol_2.name === "default") ? true : isExportEqualsOfVariable) ? true : isExportEqualsOfDeclaration) {
|
|
34
81
|
if (exportNode.expression.kind === 80) {
|
|
35
82
|
const identiferNode = exportNode.expression;
|
|
36
83
|
let declaredTypeNode;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
else {
|
|
52
|
-
declaredTypeNode = undefined;
|
|
53
|
-
}
|
|
84
|
+
let option_22;
|
|
85
|
+
let option_20;
|
|
86
|
+
const option_18 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(exportNode.expression);
|
|
87
|
+
if (option_18 != null) {
|
|
88
|
+
const _arg_1 = option_18;
|
|
89
|
+
option_20 = _arg_1.valueDeclaration;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
option_20 = undefined;
|
|
93
|
+
}
|
|
94
|
+
option_22 = ((option_20 != null) ? (((declaration_1 = option_20, declaration_1.kind === 261)) ? option_20 : undefined) : undefined);
|
|
95
|
+
if (option_22 != null) {
|
|
96
|
+
const declaration_2 = option_22;
|
|
97
|
+
declaredTypeNode = declaration_2.type;
|
|
54
98
|
}
|
|
55
99
|
else {
|
|
56
100
|
declaredTypeNode = undefined;
|
|
@@ -58,26 +102,49 @@ export function readExportAssignment(reader, exportNode) {
|
|
|
58
102
|
let typ;
|
|
59
103
|
const tsTyp = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeAtLocation(exportNode.expression);
|
|
60
104
|
if (declaredTypeNode == null) {
|
|
61
|
-
const
|
|
62
|
-
if ($007CHasTypeFlags$007C_$007C(1048576,
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
105
|
+
const matchValue_2 = tsTyp.flags;
|
|
106
|
+
if ($007CHasTypeFlags$007C_$007C(1048576, matchValue_2) != null) {
|
|
107
|
+
const matchValue_3 = tsTyp.symbol.declarations;
|
|
108
|
+
let matchResult, declarations_1;
|
|
109
|
+
if (matchValue_3 != null) {
|
|
110
|
+
if ((declarations = matchValue_3, declarations.length === 1)) {
|
|
111
|
+
matchResult = 0;
|
|
112
|
+
declarations_1 = matchValue_3;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
matchResult = 1;
|
|
116
|
+
}
|
|
66
117
|
}
|
|
67
118
|
else {
|
|
68
|
-
|
|
69
|
-
|
|
119
|
+
matchResult = 1;
|
|
120
|
+
}
|
|
121
|
+
switch (matchResult) {
|
|
122
|
+
case 0: {
|
|
123
|
+
typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](item(0, declarations_1));
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
default:
|
|
127
|
+
typ = (new GlueType(/* Primitive */ 3, [GluePrimitive.Any]));
|
|
70
128
|
}
|
|
71
129
|
}
|
|
72
130
|
else {
|
|
73
|
-
typ = (
|
|
131
|
+
typ = primitiveOfFlags(tsTyp);
|
|
74
132
|
}
|
|
75
133
|
}
|
|
76
134
|
else {
|
|
77
135
|
const typeNode = declaredTypeNode;
|
|
78
136
|
typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode);
|
|
79
137
|
}
|
|
80
|
-
|
|
138
|
+
const documentation = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](exportNode);
|
|
139
|
+
const isPublished = isDefaultOfVariable && (publishedName != null);
|
|
140
|
+
const name_2 = isExportEqualsOfVariable ? ("export=" + identiferNode.getText()) : (isPublished ? value_2(publishedName) : (isDefaultOfVariable ? defaultArg(packageName, identiferNode.getText()) : identiferNode.getText()));
|
|
141
|
+
const declaration_3 = (typ.tag === 15) ? (isDefaultOfVariable ? (new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(documentation, true, name_2, typ.fields[0].Type, typ.fields[0].Parameters, typ.fields[0].TypeParameters)])) : (new GlueType(/* Variable */ 2, [new GlueVariable(documentation, name_2, typ)]))) : (new GlueType(/* Variable */ 2, [new GlueVariable(documentation, name_2, typ)]));
|
|
142
|
+
if (isPublished) {
|
|
143
|
+
return declaration_3;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
return new GlueType(/* ExportDefault */ 25, [declaration_3]);
|
|
147
|
+
}
|
|
81
148
|
}
|
|
82
149
|
else {
|
|
83
150
|
return GlueType.Discard;
|
|
@@ -1,35 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
import { modulePathForDeclaration,
|
|
3
|
-
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.17.2/FSharp.Core.js";
|
|
2
|
+
import { modulePathForDeclaration, resolveAlias } from "./Utils.js";
|
|
4
3
|
import { normalizePath } from "../Utils/String.js";
|
|
5
|
-
import { contains, item } from "../../fable_modules/fable-library-js.5.
|
|
4
|
+
import { contains, item } from "../../fable_modules/fable-library-js.5.21.0/Array.js";
|
|
6
5
|
import { PackageContext__IsExternal_Z721C83C5 } from "./Types.js";
|
|
7
|
-
import { filter, collect, choose, empty } from "../../fable_modules/fable-library-js.5.
|
|
8
|
-
import { List_distinctBy } from "../../fable_modules/fable-library-js.5.17.2/Seq2.js";
|
|
9
|
-
import { newGuid } from "../../fable_modules/fable-library-js.5.17.2/Guid.js";
|
|
6
|
+
import { filter, collect, choose, cons, fold, reverse, empty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
10
7
|
import { GlueType, GlueReExport } from "../GlueAST.js";
|
|
11
|
-
import { toList } from "../../fable_modules/fable-library-js.5.
|
|
12
|
-
import { stringHash } from "../../fable_modules/fable-library-js.5.
|
|
13
|
-
|
|
14
|
-
function tryResolveAlias(checker, symbol) {
|
|
15
|
-
const matchValue = symbol.flags;
|
|
16
|
-
if ($007CHasSymbolFlags$007C_$007C(2097152, matchValue) != null) {
|
|
17
|
-
try {
|
|
18
|
-
const aliased = checker.getAliasedSymbol(symbol);
|
|
19
|
-
return Operators_IsNull(aliased) ? undefined : aliased;
|
|
20
|
-
}
|
|
21
|
-
catch (matchValue_1) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
return symbol;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
8
|
+
import { toList } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
9
|
+
import { stringHash } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
29
10
|
|
|
30
11
|
function readReExport(reader, packageContext, currentFile, exportedName, symbol) {
|
|
31
12
|
let declarations;
|
|
32
|
-
const matchValue =
|
|
13
|
+
const matchValue = resolveAlias(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), symbol);
|
|
33
14
|
if (matchValue != null) {
|
|
34
15
|
const target = matchValue;
|
|
35
16
|
const matchValue_1 = target.declarations;
|
|
@@ -53,28 +34,35 @@ function readReExport(reader, packageContext, currentFile, exportedName, symbol)
|
|
|
53
34
|
return empty();
|
|
54
35
|
}
|
|
55
36
|
else {
|
|
56
|
-
return
|
|
37
|
+
return reverse(fold((tupledArg, glueType) => {
|
|
38
|
+
const kept = tupledArg[0];
|
|
39
|
+
const hasInterface = tupledArg[1];
|
|
57
40
|
let matchResult_1;
|
|
58
41
|
if (glueType.tag === 32) {
|
|
59
42
|
if (glueType.fields[0].Declaration.tag === 1) {
|
|
60
|
-
|
|
43
|
+
if (hasInterface) {
|
|
44
|
+
matchResult_1 = 0;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
matchResult_1 = 1;
|
|
48
|
+
}
|
|
61
49
|
}
|
|
62
50
|
else {
|
|
63
|
-
matchResult_1 =
|
|
51
|
+
matchResult_1 = 2;
|
|
64
52
|
}
|
|
65
53
|
}
|
|
66
54
|
else {
|
|
67
|
-
matchResult_1 =
|
|
55
|
+
matchResult_1 = 2;
|
|
68
56
|
}
|
|
69
57
|
switch (matchResult_1) {
|
|
70
58
|
case 0:
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
59
|
+
return [kept, true];
|
|
60
|
+
case 1:
|
|
61
|
+
return [cons(glueType, kept), true];
|
|
62
|
+
default:
|
|
63
|
+
return [cons(glueType, kept), hasInterface];
|
|
76
64
|
}
|
|
77
|
-
}, choose((declaration) => {
|
|
65
|
+
}, [empty(), false], choose((declaration) => {
|
|
78
66
|
let declaration_1;
|
|
79
67
|
let option_1;
|
|
80
68
|
const matchValue_2 = declaration.kind;
|
|
@@ -100,10 +88,7 @@ function readReExport(reader, packageContext, currentFile, exportedName, symbol)
|
|
|
100
88
|
else {
|
|
101
89
|
return undefined;
|
|
102
90
|
}
|
|
103
|
-
}, toList(declarations_1))
|
|
104
|
-
Equals: (x, y) => (x === y),
|
|
105
|
-
GetHashCode: (x) => (stringHash(x) | 0),
|
|
106
|
-
});
|
|
91
|
+
}, toList(declarations_1)))[0]);
|
|
107
92
|
}
|
|
108
93
|
}
|
|
109
94
|
default:
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
import { defaultArg, orElse } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
3
|
+
import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.21.0/FSharp.Core.js";
|
|
4
|
+
import { resolvedBaseTypeArguments, typeNodeBuilderFlags, readTypeArguments, landingOf, crossesNamespace, modulePathForSymbol, isLibraryName, resolveValueAlias, knownExternalTypeNames, isExternalToPackages, declaredName, getFullNameOrEmpty, isFromEs5Lib } from "./Utils.js";
|
|
5
|
+
import { readPick, readOmit } from "./UtilityType.js";
|
|
6
|
+
import { FSharpSet__Contains } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
|
|
7
|
+
import { GlueTypeReference, GlueType } from "../GlueAST.js";
|
|
8
|
+
import { sanitizeTypeName } from "../Utils/Naming.js";
|
|
9
|
+
import { map, isEmpty, empty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
10
|
+
import { toList } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
11
|
+
|
|
12
|
+
export function readExpressionWithTypeArguments(reader, typeNode) {
|
|
13
|
+
let symbol, symbol_2, symbol_3, symbol_4, matchValue_2, option_4, symbol_6, matchValue_3, ofAlias, matchValue_4, matchValue_5, alias, written, option_6;
|
|
14
|
+
const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
|
|
15
|
+
const expression = typeNode;
|
|
16
|
+
const typ = checker.getTypeFromTypeNode(expression);
|
|
17
|
+
const symbolOpt = orElse(orElse(typ.aliasSymbol, Operators_IsNull(typ.symbol) ? undefined : typ.symbol), checker.getSymbolAtLocation(expression.expression));
|
|
18
|
+
const isFromEs5 = isFromEs5Lib(symbolOpt);
|
|
19
|
+
const matchValue = getFullNameOrEmpty(checker, expression.expression);
|
|
20
|
+
let matchResult;
|
|
21
|
+
if (isFromEs5) {
|
|
22
|
+
switch (matchValue) {
|
|
23
|
+
case "Omit": {
|
|
24
|
+
matchResult = 0;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case "Pick": {
|
|
28
|
+
matchResult = 1;
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
default:
|
|
32
|
+
matchResult = 2;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
matchResult = 2;
|
|
37
|
+
}
|
|
38
|
+
switch (matchResult) {
|
|
39
|
+
case 0:
|
|
40
|
+
return readOmit(reader, expression);
|
|
41
|
+
case 1:
|
|
42
|
+
return readPick(reader, expression);
|
|
43
|
+
default: {
|
|
44
|
+
const isQualified = expression.expression.kind === 212;
|
|
45
|
+
const name = (symbolOpt != null) ? (((symbol = symbolOpt, symbol.name === "default")) ? ((symbol_2 = symbolOpt, defaultArg(declaredName(symbol_2), symbol_2.name))) : ((!isFromEs5) ? ((symbol_3 = symbolOpt, symbol_3.name)) : (isQualified ? expression.expression.name.text : expression.expression.getText()))) : (isQualified ? expression.expression.name.text : expression.expression.getText());
|
|
46
|
+
const isExternal = isExternalToPackages(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), symbolOpt);
|
|
47
|
+
if (((symbolOpt == null) ? false : ((symbol_4 = symbolOpt, (symbol_4.name === "__type") ? true : (symbol_4.name === "__object")))) ? true : ((isExternal && !FSharpSet__Contains(knownExternalTypeNames, name)) && !(isFromEs5 && (name === "Partial")))) {
|
|
48
|
+
return GlueType.Discard;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return new GlueType(/* TypeReference */ 13, [new GlueTypeReference((name.indexOf(".") >= 0) ? name : sanitizeTypeName(name), (matchValue_2 = ((option_4 = symbolOpt, (option_4 != null) ? resolveValueAlias(checker, option_4) : undefined)), (matchValue_2 == null) ? getFullNameOrEmpty(checker, expression.expression) : ((symbol_6 = matchValue_2, checker.getFullyQualifiedName(symbol_6)))), isLibraryName(reader, name) ? empty() : modulePathForSymbol(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), isQualified ? true : crossesNamespace(checker, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), symbolOpt, landingOf(reader, expression)), symbolOpt), (matchValue_3 = readTypeArguments(reader, expression), isEmpty(matchValue_3) ? ((ofAlias = (((matchValue_4 = checker.getSymbolAtLocation(expression.expression), (matchValue_5 = typ.aliasSymbol, (matchValue_4 != null) && ((matchValue_5 != null) && ((alias = matchValue_5, (written = matchValue_4, !(written === alias)))))))) ? defaultArg((option_6 = typ.aliasTypeArguments, (option_6 != null) ? toList(option_6) : undefined), empty()) : empty()), map((argument) => {
|
|
52
|
+
const typNode = checker.typeToTypeNode(argument, undefined, typeNodeBuilderFlags);
|
|
53
|
+
return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](typNode);
|
|
54
|
+
}, isEmpty(ofAlias) ? resolvedBaseTypeArguments(checker, expression) : ofAlias))) : matchValue_3), (isFromEs5 ? true : isExternal) ? true : isLibraryName(reader, name))]);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
@@ -1,38 +1,51 @@
|
|
|
1
1
|
|
|
2
|
-
import { exists } from "../../fable_modules/fable-library-js.5.
|
|
3
|
-
import { tryReadKeyOfConstraint, ModifierUtil_HasModifier_742AC9D } from "./Utils.js";
|
|
4
|
-
import { Exception } from "../../fable_modules/fable-library-js.5.
|
|
2
|
+
import { exists } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
|
|
3
|
+
import { tryReadKeyOfConstraint, isDefaultInExportList, ModifierUtil_HasModifier_742AC9D } from "./Utils.js";
|
|
4
|
+
import { Exception } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
|
|
5
5
|
import { Report_readerError_Z19516DCE } from "./Report.js";
|
|
6
|
-
import { mapIndexed } from "../../fable_modules/fable-library-js.5.
|
|
7
|
-
import { value } from "../../fable_modules/fable-library-js.5.
|
|
6
|
+
import { mapIndexed } from "../../fable_modules/fable-library-js.5.21.0/List.js";
|
|
7
|
+
import { value } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
|
|
8
8
|
import { GlueType, GlueFunctionDeclaration, GlueTypeParameter } from "../GlueAST.js";
|
|
9
9
|
|
|
10
10
|
export function readFunctionDeclaration(reader, declaration) {
|
|
11
11
|
let isDeclared;
|
|
12
12
|
const matchValue = declaration.modifiers;
|
|
13
13
|
isDeclared = ((matchValue == null) ? false : exists((modifier) => (modifier.kind === 138), matchValue));
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
let isDefaultExport;
|
|
15
|
+
if (ModifierUtil_HasModifier_742AC9D(declaration.modifiers, 90)) {
|
|
16
|
+
isDefaultExport = true;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const matchValue_1 = declaration.name;
|
|
20
|
+
if (matchValue_1 == null) {
|
|
21
|
+
isDefaultExport = false;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const name = matchValue_1;
|
|
25
|
+
isDefaultExport = isDefaultInExportList(declaration, name.getText());
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
let name_2;
|
|
29
|
+
const matchValue_2 = declaration.name;
|
|
30
|
+
if (matchValue_2 == null) {
|
|
18
31
|
if (isDefaultExport) {
|
|
19
|
-
|
|
32
|
+
name_2 = "defaultExport";
|
|
20
33
|
}
|
|
21
34
|
else {
|
|
22
|
-
throw new Exception(Report_readerError_Z19516DCE("function declaration", "Missing name", declaration, "/_//src/Glutinum.Converter/Reader/FunctionDeclaration.fs",
|
|
35
|
+
throw new Exception(Report_readerError_Z19516DCE("function declaration", "Missing name", declaration, "/_//src/Glutinum.Converter/Reader/FunctionDeclaration.fs", 34));
|
|
23
36
|
}
|
|
24
37
|
}
|
|
25
38
|
else {
|
|
26
|
-
const
|
|
27
|
-
|
|
39
|
+
const name_1 = matchValue_2;
|
|
40
|
+
name_2 = name_1.getText();
|
|
28
41
|
}
|
|
29
|
-
const functionDeclaration = new GlueFunctionDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromSignature61B89E55"](declaration), isDeclared,
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
42
|
+
const functionDeclaration = new GlueFunctionDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromSignature61B89E55"](declaration), isDeclared, name_2, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNodeZ64B23DD2"](declaration.type), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadParameters716C1F42"](declaration.parameters), mapIndexed((index, typeParameter) => {
|
|
43
|
+
const matchValue_3 = tryReadKeyOfConstraint(reader, value(declaration.typeParameters)[index]);
|
|
44
|
+
if (matchValue_3 == null) {
|
|
32
45
|
return typeParameter;
|
|
33
46
|
}
|
|
34
47
|
else {
|
|
35
|
-
return new GlueTypeParameter(typeParameter.Name,
|
|
48
|
+
return new GlueTypeParameter(typeParameter.Name, matchValue_3, typeParameter.Default);
|
|
36
49
|
}
|
|
37
50
|
}, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"](declaration.typeParameters)));
|
|
38
51
|
if (isDefaultExport) {
|