@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.
Files changed (155) hide show
  1. package/README.md +16 -0
  2. package/dist/Glutinum.Converter/Abbreviations.js +16 -39
  3. package/dist/Glutinum.Converter/DelegateExtensions.js +378 -0
  4. package/dist/Glutinum.Converter/FreeTypeParameters.js +211 -0
  5. package/dist/Glutinum.Converter/FsharpAST.js +117 -66
  6. package/dist/Glutinum.Converter/Generate.js +52 -26
  7. package/dist/Glutinum.Converter/GlueAST.js +85 -46
  8. package/dist/Glutinum.Converter/Hosting.js +148 -174
  9. package/dist/Glutinum.Converter/Merge.js +463 -355
  10. package/dist/Glutinum.Converter/Packages.js +387 -97
  11. package/dist/Glutinum.Converter/Printer.js +439 -400
  12. package/dist/Glutinum.Converter/Read.js +362 -100
  13. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +7 -7
  14. package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
  15. package/dist/Glutinum.Converter/Reader/Declaration.js +13 -19
  16. package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
  17. package/dist/Glutinum.Converter/Reader/Documentation.js +28 -40
  18. package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +2 -2
  19. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +104 -37
  20. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +24 -39
  21. package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
  22. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +30 -17
  23. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +16 -22
  24. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +49 -6
  25. package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
  26. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +4 -4
  27. package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
  28. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +54 -6
  29. package/dist/Glutinum.Converter/Reader/Node.js +11 -14
  30. package/dist/Glutinum.Converter/Reader/Parameters.js +39 -30
  31. package/dist/Glutinum.Converter/Reader/Report.js +4 -4
  32. package/dist/Glutinum.Converter/Reader/TypeNode.js +390 -1584
  33. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +80 -53
  34. package/dist/Glutinum.Converter/Reader/TypeParameters.js +2 -2
  35. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +24 -47
  36. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +24 -6
  37. package/dist/Glutinum.Converter/Reader/Types.js +297 -17
  38. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +16 -30
  39. package/dist/Glutinum.Converter/Reader/UtilityType.js +811 -0
  40. package/dist/Glutinum.Converter/Reader/Utils.js +497 -111
  41. package/dist/Glutinum.Converter/Reader/VariableStatement.js +7 -8
  42. package/dist/Glutinum.Converter/Transform.js +2915 -8180
  43. package/dist/Glutinum.Converter/Transformer/AnyFunctionOverloads.js +116 -0
  44. package/dist/Glutinum.Converter/Transformer/CallableProperties.js +454 -0
  45. package/dist/Glutinum.Converter/Transformer/Comment.js +136 -0
  46. package/dist/Glutinum.Converter/Transformer/Conditionals.js +1087 -0
  47. package/dist/Glutinum.Converter/Transformer/Context.js +678 -0
  48. package/dist/Glutinum.Converter/Transformer/Enum.js +80 -0
  49. package/dist/Glutinum.Converter/Transformer/Exports.js +704 -0
  50. package/dist/Glutinum.Converter/Transformer/Heritage.js +493 -0
  51. package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +488 -0
  52. package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +460 -0
  53. package/dist/Glutinum.Converter/Transformer/TypeParameter.js +219 -0
  54. package/dist/Glutinum.Converter/Transformer/TypeParameters.js +448 -0
  55. package/dist/Glutinum.Converter/Transformer/UnionOverloads.js +338 -0
  56. package/dist/Glutinum.Converter/Transformer/Utils.js +341 -0
  57. package/dist/Glutinum.Converter/TypeScript.Extensions.js +0 -10
  58. package/dist/Glutinum.Converter/Utils/Keywords.js +3 -3
  59. package/dist/Glutinum.Converter/Utils/List.js +2 -2
  60. package/dist/Glutinum.Converter/Utils/Naming.js +6 -6
  61. package/dist/Glutinum.Converter/Utils/String.js +16 -5
  62. package/dist/Program.js +104 -241
  63. package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs.js +2 -2
  64. package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs.js +4 -4
  65. package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs.js +2 -2
  66. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +5 -5
  67. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs.js +4 -4
  68. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs.js +3 -3
  69. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs.js +1 -1
  70. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +3 -3
  71. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs.js +1 -1
  72. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs.js +1 -1
  73. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs.js +4 -4
  74. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +1 -1
  75. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +3 -3
  76. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +1 -1
  77. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +1 -1
  78. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs.js +1 -1
  79. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs.js +2 -2
  80. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs.js +2 -2
  81. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs.js +1 -1
  82. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +7 -7
  83. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs.js +1 -1
  84. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Async.js +21 -7
  85. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/AsyncBuilder.js +51 -6
  86. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/CHANGELOG.md +23 -1
  87. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/CollectionUtil.js +10 -16
  88. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MailboxProcessor.js +19 -3
  89. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MutableMap.js +5 -1
  90. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MutableSet.js +5 -1
  91. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Util.js +15 -3
  92. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/package.json +1 -1
  93. package/package.json +3 -2
  94. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Array.js +0 -0
  95. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/BigInt.js +0 -0
  96. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/BitConverter.js +0 -0
  97. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Boolean.js +0 -0
  98. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Char.js +0 -0
  99. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Choice.js +0 -0
  100. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/ConditionalWeakTable.js +0 -0
  101. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Date.js +0 -0
  102. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOffset.js +0 -0
  103. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOnly.js +0 -0
  104. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOnlyTemporal.js +0 -0
  105. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeFormat.js +0 -0
  106. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeOffsetTemporal.js +0 -0
  107. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeTemporal.js +0 -0
  108. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Decimal.js +0 -0
  109. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Directory.js +0 -0
  110. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Double.js +0 -0
  111. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Encoding.js +0 -0
  112. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Environment.js +0 -0
  113. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Event.js +0 -0
  114. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Collections.js +0 -0
  115. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Core.CompilerServices.js +0 -0
  116. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Core.js +0 -0
  117. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/File.js +0 -0
  118. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Global.js +0 -0
  119. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Guid.js +0 -0
  120. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Int32.js +0 -0
  121. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/List.js +0 -0
  122. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Long.js +0 -0
  123. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Map.js +0 -0
  124. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MapUtil.js +0 -0
  125. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Native.js +0 -0
  126. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Numeric.js +0 -0
  127. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Observable.js +0 -0
  128. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Option.js +0 -0
  129. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Path.js +0 -0
  130. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/README.md +0 -0
  131. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Random.js +0 -0
  132. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Range.js +0 -0
  133. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Reflection.js +0 -0
  134. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/RegExp.js +0 -0
  135. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Result.js +0 -0
  136. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Seq.js +0 -0
  137. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Seq2.js +0 -0
  138. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Set.js +0 -0
  139. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/String.js +0 -0
  140. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.Collections.Generic.js +0 -0
  141. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.Text.js +0 -0
  142. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.js +0 -0
  143. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Task.js +0 -0
  144. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TaskBuilder.js +0 -0
  145. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeOnly.js +0 -0
  146. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeOnlyTemporal.js +0 -0
  147. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeSpan.js +0 -0
  148. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeSpanTemporal.js +0 -0
  149. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Timer.js +0 -0
  150. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Types.js +0 -0
  151. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Unicode.13.0.0.js +0 -0
  152. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Uri.js +0 -0
  153. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/big.d.ts +0 -0
  154. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/lib/big.js +0 -0
  155. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/quotation.js +0 -0
@@ -0,0 +1,211 @@
1
+
2
+ import { empty, union, FSharpSet__Contains, ofList } from "../fable_modules/fable-library-js.5.21.0/Set.js";
3
+ import { isEmpty, map, choose } from "../fable_modules/fable-library-js.5.21.0/List.js";
4
+ import { comparePrimitives } from "../fable_modules/fable-library-js.5.21.0/Util.js";
5
+ import { FSharpModule, FSharpTypeAlias, FSharpDelegate, FSharpInterface, FSharpStaticMemberInfo, FSharpMember, FSharpMemberInfo, FSharpFunctionType, FSharpParameter, FSharpUnion, FSharpUnionCase, FSharpJSApi, FSharpThisType, FSharpTypeReference, FSharpMapped, FSharpTypeParameter, FSharpType } from "./FsharpAST.js";
6
+ import { substring } from "../fable_modules/fable-library-js.5.21.0/String.js";
7
+
8
+ function declaredNames(typeParameters) {
9
+ return ofList(choose((_arg) => {
10
+ if (_arg.tag === 0) {
11
+ return undefined;
12
+ }
13
+ else {
14
+ return _arg.fields[0].Name;
15
+ }
16
+ }, typeParameters), {
17
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
18
+ });
19
+ }
20
+
21
+ function eraseType(bound, typ) {
22
+ let info_1;
23
+ const erase = (typ_1) => eraseType(bound, typ_1);
24
+ const eraseTypeParameters = (typeParameters) => map((_arg) => {
25
+ if (_arg.tag === 1) {
26
+ if (FSharpSet__Contains(bound, _arg.fields[0].Name)) {
27
+ return _arg;
28
+ }
29
+ else {
30
+ return new FSharpTypeParameter(/* FSharpType */ 0, [FSharpType.Object$]);
31
+ }
32
+ }
33
+ else {
34
+ return new FSharpTypeParameter(/* FSharpType */ 0, [erase(_arg.fields[0])]);
35
+ }
36
+ }, typeParameters);
37
+ let matchResult, name_1, info_2, info_3, typeReference, thisType, typ_3, typ_4, typ_5, types, unionInfo, functionType, typ_10;
38
+ switch (typ.tag) {
39
+ case 13: {
40
+ if (!FSharpSet__Contains(bound, typ.fields[0])) {
41
+ matchResult = 0;
42
+ name_1 = typ.fields[0];
43
+ }
44
+ else {
45
+ matchResult = 11;
46
+ typ_10 = typ;
47
+ }
48
+ break;
49
+ }
50
+ case 7: {
51
+ if ((info_1 = typ.fields[0], info_1.Name.startsWith("\'") && !FSharpSet__Contains(bound, substring(info_1.Name, 1)))) {
52
+ matchResult = 1;
53
+ info_2 = typ.fields[0];
54
+ }
55
+ else {
56
+ matchResult = 2;
57
+ info_3 = typ.fields[0];
58
+ }
59
+ break;
60
+ }
61
+ case 11: {
62
+ matchResult = 3;
63
+ typeReference = typ.fields[0];
64
+ break;
65
+ }
66
+ case 15: {
67
+ matchResult = 4;
68
+ thisType = typ.fields[0];
69
+ break;
70
+ }
71
+ case 3: {
72
+ matchResult = 5;
73
+ typ_3 = typ.fields[0];
74
+ break;
75
+ }
76
+ case 14: {
77
+ matchResult = 6;
78
+ typ_4 = typ.fields[0];
79
+ break;
80
+ }
81
+ case 19: {
82
+ matchResult = 7;
83
+ typ_5 = typ.fields[0].fields[0];
84
+ break;
85
+ }
86
+ case 12: {
87
+ matchResult = 8;
88
+ types = typ.fields[0];
89
+ break;
90
+ }
91
+ case 1: {
92
+ matchResult = 9;
93
+ unionInfo = typ.fields[0];
94
+ break;
95
+ }
96
+ case 16: {
97
+ matchResult = 10;
98
+ functionType = typ.fields[0];
99
+ break;
100
+ }
101
+ default: {
102
+ matchResult = 11;
103
+ typ_10 = typ;
104
+ }
105
+ }
106
+ switch (matchResult) {
107
+ case 0:
108
+ return FSharpType.Object$;
109
+ case 1:
110
+ return FSharpType.Object$;
111
+ case 2:
112
+ return new FSharpType(/* Mapped */ 7, [new FSharpMapped(info_3.Name, eraseTypeParameters(info_3.TypeParameters))]);
113
+ case 3:
114
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(typeReference.Name, typeReference.FullName, typeReference.ModulePath, map(erase, typeReference.TypeArguments), typeReference.Type)]);
115
+ case 4:
116
+ return new FSharpType(/* ThisType */ 15, [new FSharpThisType(thisType.Name, eraseTypeParameters(thisType.TypeParameters))]);
117
+ case 5:
118
+ return new FSharpType(/* Option */ 3, [erase(typ_3)]);
119
+ case 6:
120
+ return new FSharpType(/* ResizeArray */ 14, [erase(typ_4)]);
121
+ case 7:
122
+ return new FSharpType(/* JSApi */ 19, [new FSharpJSApi(erase(typ_5))]);
123
+ case 8:
124
+ return new FSharpType(/* Tuple */ 12, [map(erase, types)]);
125
+ case 9: {
126
+ const bound_1 = union(bound, declaredNames(unionInfo.TypeParameters));
127
+ const erase_1 = (typ_6) => eraseType(bound_1, typ_6);
128
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, map((_arg_1) => {
129
+ switch (_arg_1.tag) {
130
+ case 1:
131
+ return new FSharpUnionCase(/* Typed */ 1, [erase_1(_arg_1.fields[0])]);
132
+ case 2:
133
+ return new FSharpUnionCase(/* Field */ 2, [_arg_1.fields[0], erase_1(_arg_1.fields[1])]);
134
+ case 3:
135
+ return new FSharpUnionCase(/* NamedFields */ 3, [_arg_1.fields[0], map((tupledArg) => [tupledArg[0], erase_1(tupledArg[1])], _arg_1.fields[1])]);
136
+ default:
137
+ return _arg_1;
138
+ }
139
+ }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
140
+ }
141
+ case 10:
142
+ return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, erase(parameter.Type), parameter.OriginalGlueMember)), functionType.Parameters), erase(functionType.ReturnType))]);
143
+ default:
144
+ return typ_10;
145
+ }
146
+ }
147
+
148
+ function eraseParameters(bound, parameters) {
149
+ return map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, eraseType(bound, parameter.Type), parameter.OriginalGlueMember)), parameters);
150
+ }
151
+
152
+ function eraseMember(bound, fsharpMember) {
153
+ const erase = (isProperty, typeParameters, parameters, typ) => {
154
+ if (isEmpty(typeParameters) && !isProperty) {
155
+ return [parameters, typ];
156
+ }
157
+ else {
158
+ const bound_1 = union(bound, declaredNames(typeParameters));
159
+ return [eraseParameters(bound_1, parameters), eraseType(bound_1, typ)];
160
+ }
161
+ };
162
+ switch (fsharpMember.tag) {
163
+ case 1: {
164
+ const info_1 = fsharpMember.fields[0];
165
+ const patternInput_1 = erase(true, info_1.TypeParameters, info_1.Parameters, info_1.Type);
166
+ return new FSharpMember(/* Property */ 1, [new FSharpMemberInfo(info_1.Attributes, info_1.Name, info_1.OriginalName, info_1.TypeParameters, patternInput_1[0], patternInput_1[1], info_1.IsOptional, info_1.IsStatic, info_1.Accessor, info_1.Accessibility, info_1.XmlDoc, info_1.Body)]);
167
+ }
168
+ case 2: {
169
+ const info_2 = fsharpMember.fields[0];
170
+ const patternInput_2 = erase(info_2.Accessor != null, info_2.TypeParameters, info_2.Parameters, info_2.Type);
171
+ return new FSharpMember(/* StaticMember */ 2, [new FSharpStaticMemberInfo(info_2.Attributes, info_2.Name, info_2.OriginalName, info_2.TypeParameters, patternInput_2[0], patternInput_2[1], info_2.IsOptional, info_2.Accessor, info_2.Accessibility, info_2.XmlDoc)]);
172
+ }
173
+ default: {
174
+ const info = fsharpMember.fields[0];
175
+ const patternInput = erase(info.Accessor != null, info.TypeParameters, info.Parameters, info.Type);
176
+ return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(info.Attributes, info.Name, info.OriginalName, info.TypeParameters, patternInput[0], patternInput[1], info.IsOptional, info.IsStatic, info.Accessor, info.Accessibility, info.XmlDoc, info.Body)]);
177
+ }
178
+ }
179
+ }
180
+
181
+ export function apply(types) {
182
+ return map((_arg) => {
183
+ switch (_arg.tag) {
184
+ case 5: {
185
+ const interfaceInfo = _arg.fields[0];
186
+ const bound = declaredNames(interfaceInfo.TypeParameters);
187
+ return new FSharpType(/* Interface */ 5, [new FSharpInterface(interfaceInfo.Attributes, interfaceInfo.Name, interfaceInfo.XmlDoc, interfaceInfo.OriginalName, interfaceInfo.TypeParameters, map((fsharpMember) => eraseMember(bound, fsharpMember), interfaceInfo.Members), interfaceInfo.Inheritance)]);
188
+ }
189
+ case 20: {
190
+ const delegateInfo = _arg.fields[0];
191
+ const bound_1 = declaredNames(delegateInfo.TypeParameters);
192
+ return new FSharpType(/* Delegate */ 20, [new FSharpDelegate(delegateInfo.XmlDoc, delegateInfo.Name, delegateInfo.TypeParameters, eraseParameters(bound_1, delegateInfo.Parameters), eraseType(bound_1, delegateInfo.ReturnType))]);
193
+ }
194
+ case 1:
195
+ return eraseType(empty({
196
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
197
+ }), _arg);
198
+ case 9: {
199
+ const aliasInfo = _arg.fields[0];
200
+ return new FSharpType(/* TypeAlias */ 9, [new FSharpTypeAlias(aliasInfo.Attributes, aliasInfo.Name, aliasInfo.XmlDoc, eraseType(declaredNames(aliasInfo.TypeParameters), aliasInfo.Type), aliasInfo.TypeParameters)]);
201
+ }
202
+ case 4: {
203
+ const moduleInfo = _arg.fields[0];
204
+ return new FSharpType(/* Module */ 4, [new FSharpModule(moduleInfo.Name, moduleInfo.IsRecursive, moduleInfo.ImportSpecifier, apply(moduleInfo.Types))]);
205
+ }
206
+ default:
207
+ return _arg;
208
+ }
209
+ }, types);
210
+ }
211
+
@@ -1,9 +1,8 @@
1
1
 
2
- import { toString, Union, Record } from "../fable_modules/fable-library-js.5.17.2/Types.js";
3
- import { enum_type, option_type, tuple_type, bool_type, float64_type, int32_type, union_type, list_type, record_type, string_type } from "../fable_modules/fable-library-js.5.17.2/Reflection.js";
2
+ import { Union, Record } from "../fable_modules/fable-library-js.5.21.0/Types.js";
3
+ import { enum_type, option_type, tuple_type, bool_type, float64_type, int32_type, union_type, list_type, record_type, string_type } from "../fable_modules/fable-library-js.5.21.0/Reflection.js";
4
4
  import { GlueMember_$reflection } from "./GlueAST.js";
5
- import { int32ToString } from "../fable_modules/fable-library-js.5.17.2/Util.js";
6
- import { empty, forAll } from "../fable_modules/fable-library-js.5.17.2/List.js";
5
+ import { empty, cons, choose, singleton, map, forAll } from "../fable_modules/fable-library-js.5.21.0/List.js";
7
6
 
8
7
  export class FSharpCommentParam extends Record {
9
8
  constructor(Name, Content) {
@@ -129,24 +128,6 @@ export function FSharpUnionCase_$reflection() {
129
128
  return union_type("Glutinum.Converter.FSharpAST.FSharpUnionCase", [], FSharpUnionCase, () => [[["Item", FSharpUnionCaseNamed_$reflection()]], [["Item", FSharpType_$reflection()]], [["name", string_type], ["typ", FSharpType_$reflection()]], [["info", FSharpUnionCaseNamed_$reflection()], ["fields", list_type(tuple_type(string_type, FSharpType_$reflection()))]]]);
130
129
  }
131
130
 
132
- export class FSharpUnionType extends Union {
133
- constructor(tag, fields) {
134
- super();
135
- this.tag = tag;
136
- this.fields = fields;
137
- }
138
- cases() {
139
- return ["String", "Numeric", "Unknown"];
140
- }
141
- static String$ = new FSharpUnionType(0, []);
142
- static Numeric = new FSharpUnionType(1, []);
143
- static Unknown = new FSharpUnionType(2, []);
144
- }
145
-
146
- export function FSharpUnionType_$reflection() {
147
- return union_type("Glutinum.Converter.FSharpAST.FSharpUnionType", [], FSharpUnionType, () => [[], [], []]);
148
- }
149
-
150
131
  /**
151
132
  * `static member inline A: Mixed = Mixed.String "a"`
152
133
  */
@@ -617,33 +598,6 @@ export function FSharpType_$reflection() {
617
598
  return union_type("Glutinum.Converter.FSharpAST.FSharpType", [], FSharpType, () => [[["Item", FSharpEnum_$reflection()]], [["Item", FSharpUnion_$reflection()]], [["Item", FSharpSingleErasedCaseUnion_$reflection()]], [["Item", FSharpType_$reflection()]], [["Item", FSharpModule_$reflection()]], [["Item", FSharpInterface_$reflection()]], [["Item", enum_type("TypeScript.Ts.SyntaxKind", int32_type, [["Unknown", 0], ["EndOfFileToken", 1], ["SingleLineCommentTrivia", 2], ["MultiLineCommentTrivia", 3], ["NewLineTrivia", 4], ["WhitespaceTrivia", 5], ["ShebangTrivia", 6], ["ConflictMarkerTrivia", 7], ["NonTextFileMarkerTrivia", 8], ["NumericLiteral", 9], ["BigIntLiteral", 10], ["StringLiteral", 11], ["JsxText", 12], ["JsxTextAllWhiteSpaces", 13], ["RegularExpressionLiteral", 14], ["NoSubstitutionTemplateLiteral", 15], ["TemplateHead", 16], ["TemplateMiddle", 17], ["TemplateTail", 18], ["OpenBraceToken", 19], ["CloseBraceToken", 20], ["OpenParenToken", 21], ["CloseParenToken", 22], ["OpenBracketToken", 23], ["CloseBracketToken", 24], ["DotToken", 25], ["DotDotDotToken", 26], ["SemicolonToken", 27], ["CommaToken", 28], ["QuestionDotToken", 29], ["LessThanToken", 30], ["LessThanSlashToken", 31], ["GreaterThanToken", 32], ["LessThanEqualsToken", 33], ["GreaterThanEqualsToken", 34], ["EqualsEqualsToken", 35], ["ExclamationEqualsToken", 36], ["EqualsEqualsEqualsToken", 37], ["ExclamationEqualsEqualsToken", 38], ["EqualsGreaterThanToken", 39], ["PlusToken", 40], ["MinusToken", 41], ["AsteriskToken", 42], ["AsteriskAsteriskToken", 43], ["SlashToken", 44], ["PercentToken", 45], ["PlusPlusToken", 46], ["MinusMinusToken", 47], ["LessThanLessThanToken", 48], ["GreaterThanGreaterThanToken", 49], ["GreaterThanGreaterThanGreaterThanToken", 50], ["AmpersandToken", 51], ["BarToken", 52], ["CaretToken", 53], ["ExclamationToken", 54], ["TildeToken", 55], ["AmpersandAmpersandToken", 56], ["BarBarToken", 57], ["QuestionToken", 58], ["ColonToken", 59], ["AtToken", 60], ["QuestionQuestionToken", 61], ["BacktickToken", 62], ["HashToken", 63], ["EqualsToken", 64], ["PlusEqualsToken", 65], ["MinusEqualsToken", 66], ["AsteriskEqualsToken", 67], ["AsteriskAsteriskEqualsToken", 68], ["SlashEqualsToken", 69], ["PercentEqualsToken", 70], ["LessThanLessThanEqualsToken", 71], ["GreaterThanGreaterThanEqualsToken", 72], ["GreaterThanGreaterThanGreaterThanEqualsToken", 73], ["AmpersandEqualsToken", 74], ["BarEqualsToken", 75], ["BarBarEqualsToken", 76], ["AmpersandAmpersandEqualsToken", 77], ["QuestionQuestionEqualsToken", 78], ["CaretEqualsToken", 79], ["Identifier", 80], ["PrivateIdentifier", 81], ["BreakKeyword", 83], ["CaseKeyword", 84], ["CatchKeyword", 85], ["ClassKeyword", 86], ["ConstKeyword", 87], ["ContinueKeyword", 88], ["DebuggerKeyword", 89], ["DefaultKeyword", 90], ["DeleteKeyword", 91], ["DoKeyword", 92], ["ElseKeyword", 93], ["EnumKeyword", 94], ["ExportKeyword", 95], ["ExtendsKeyword", 96], ["FalseKeyword", 97], ["FinallyKeyword", 98], ["ForKeyword", 99], ["FunctionKeyword", 100], ["IfKeyword", 101], ["ImportKeyword", 102], ["InKeyword", 103], ["InstanceOfKeyword", 104], ["NewKeyword", 105], ["NullKeyword", 106], ["ReturnKeyword", 107], ["SuperKeyword", 108], ["SwitchKeyword", 109], ["ThisKeyword", 110], ["ThrowKeyword", 111], ["TrueKeyword", 112], ["TryKeyword", 113], ["TypeOfKeyword", 114], ["VarKeyword", 115], ["VoidKeyword", 116], ["WhileKeyword", 117], ["WithKeyword", 118], ["ImplementsKeyword", 119], ["InterfaceKeyword", 120], ["LetKeyword", 121], ["PackageKeyword", 122], ["PrivateKeyword", 123], ["ProtectedKeyword", 124], ["PublicKeyword", 125], ["StaticKeyword", 126], ["YieldKeyword", 127], ["AbstractKeyword", 128], ["AccessorKeyword", 129], ["AsKeyword", 130], ["AssertsKeyword", 131], ["AssertKeyword", 132], ["AnyKeyword", 133], ["AsyncKeyword", 134], ["AwaitKeyword", 135], ["BooleanKeyword", 136], ["ConstructorKeyword", 137], ["DeclareKeyword", 138], ["GetKeyword", 139], ["InferKeyword", 140], ["IntrinsicKeyword", 141], ["IsKeyword", 142], ["KeyOfKeyword", 143], ["ModuleKeyword", 144], ["NamespaceKeyword", 145], ["NeverKeyword", 146], ["OutKeyword", 147], ["ReadonlyKeyword", 148], ["RequireKeyword", 149], ["NumberKeyword", 150], ["ObjectKeyword", 151], ["SatisfiesKeyword", 152], ["SetKeyword", 153], ["StringKeyword", 154], ["SymbolKeyword", 155], ["TypeKeyword", 156], ["UndefinedKeyword", 157], ["UniqueKeyword", 158], ["UnknownKeyword", 159], ["UsingKeyword", 160], ["FromKeyword", 161], ["GlobalKeyword", 162], ["BigIntKeyword", 163], ["OverrideKeyword", 164], ["OfKeyword", 165], ["DeferKeyword", 166], ["QualifiedName", 167], ["ComputedPropertyName", 168], ["TypeParameter", 169], ["Parameter", 170], ["Decorator", 171], ["PropertySignature", 172], ["PropertyDeclaration", 173], ["MethodSignature", 174], ["MethodDeclaration", 175], ["ClassStaticBlockDeclaration", 176], ["Constructor", 177], ["GetAccessor", 178], ["SetAccessor", 179], ["CallSignature", 180], ["ConstructSignature", 181], ["IndexSignature", 182], ["TypePredicate", 183], ["TypeReference", 184], ["FunctionType", 185], ["ConstructorType", 186], ["TypeQuery", 187], ["TypeLiteral", 188], ["ArrayType", 189], ["TupleType", 190], ["OptionalType", 191], ["RestType", 192], ["UnionType", 193], ["IntersectionType", 194], ["ConditionalType", 195], ["InferType", 196], ["ParenthesizedType", 197], ["ThisType", 198], ["TypeOperator", 199], ["IndexedAccessType", 200], ["MappedType", 201], ["LiteralType", 202], ["NamedTupleMember", 203], ["TemplateLiteralType", 204], ["TemplateLiteralTypeSpan", 205], ["ImportType", 206], ["ObjectBindingPattern", 207], ["ArrayBindingPattern", 208], ["BindingElement", 209], ["ArrayLiteralExpression", 210], ["ObjectLiteralExpression", 211], ["PropertyAccessExpression", 212], ["ElementAccessExpression", 213], ["CallExpression", 214], ["NewExpression", 215], ["TaggedTemplateExpression", 216], ["TypeAssertionExpression", 217], ["ParenthesizedExpression", 218], ["FunctionExpression", 219], ["ArrowFunction", 220], ["DeleteExpression", 221], ["TypeOfExpression", 222], ["VoidExpression", 223], ["AwaitExpression", 224], ["PrefixUnaryExpression", 225], ["PostfixUnaryExpression", 226], ["BinaryExpression", 227], ["ConditionalExpression", 228], ["TemplateExpression", 229], ["YieldExpression", 230], ["SpreadElement", 231], ["ClassExpression", 232], ["OmittedExpression", 233], ["ExpressionWithTypeArguments", 234], ["AsExpression", 235], ["NonNullExpression", 236], ["MetaProperty", 237], ["SyntheticExpression", 238], ["SatisfiesExpression", 239], ["TemplateSpan", 240], ["SemicolonClassElement", 241], ["Block", 242], ["EmptyStatement", 243], ["VariableStatement", 244], ["ExpressionStatement", 245], ["IfStatement", 246], ["DoStatement", 247], ["WhileStatement", 248], ["ForStatement", 249], ["ForInStatement", 250], ["ForOfStatement", 251], ["ContinueStatement", 252], ["BreakStatement", 253], ["ReturnStatement", 254], ["WithStatement", 255], ["SwitchStatement", 256], ["LabeledStatement", 257], ["ThrowStatement", 258], ["TryStatement", 259], ["DebuggerStatement", 260], ["VariableDeclaration", 261], ["VariableDeclarationList", 262], ["FunctionDeclaration", 263], ["ClassDeclaration", 264], ["InterfaceDeclaration", 265], ["TypeAliasDeclaration", 266], ["EnumDeclaration", 267], ["ModuleDeclaration", 268], ["ModuleBlock", 269], ["CaseBlock", 270], ["NamespaceExportDeclaration", 271], ["ImportEqualsDeclaration", 272], ["ImportDeclaration", 273], ["ImportClause", 274], ["NamespaceImport", 275], ["NamedImports", 276], ["ImportSpecifier", 277], ["ExportAssignment", 278], ["ExportDeclaration", 279], ["NamedExports", 280], ["NamespaceExport", 281], ["ExportSpecifier", 282], ["MissingDeclaration", 283], ["ExternalModuleReference", 284], ["JsxElement", 285], ["JsxSelfClosingElement", 286], ["JsxOpeningElement", 287], ["JsxClosingElement", 288], ["JsxFragment", 289], ["JsxOpeningFragment", 290], ["JsxClosingFragment", 291], ["JsxAttribute", 292], ["JsxAttributes", 293], ["JsxSpreadAttribute", 294], ["JsxExpression", 295], ["JsxNamespacedName", 296], ["CaseClause", 297], ["DefaultClause", 298], ["HeritageClause", 299], ["CatchClause", 300], ["ImportAttributes", 301], ["ImportAttribute", 302], ["AssertClause", 301], ["AssertEntry", 302], ["ImportTypeAssertionContainer", 303], ["PropertyAssignment", 304], ["ShorthandPropertyAssignment", 305], ["SpreadAssignment", 306], ["EnumMember", 307], ["SourceFile", 308], ["Bundle", 309], ["JSDocTypeExpression", 310], ["JSDocNameReference", 311], ["JSDocMemberName", 312], ["JSDocAllType", 313], ["JSDocUnknownType", 314], ["JSDocNullableType", 315], ["JSDocNonNullableType", 316], ["JSDocOptionalType", 317], ["JSDocFunctionType", 318], ["JSDocVariadicType", 319], ["JSDocNamepathType", 320], ["JSDoc", 321], ["JSDocComment", 321], ["JSDocText", 322], ["JSDocTypeLiteral", 323], ["JSDocSignature", 324], ["JSDocLink", 325], ["JSDocLinkCode", 326], ["JSDocLinkPlain", 327], ["JSDocTag", 328], ["JSDocAugmentsTag", 329], ["JSDocImplementsTag", 330], ["JSDocAuthorTag", 331], ["JSDocDeprecatedTag", 332], ["JSDocClassTag", 333], ["JSDocPublicTag", 334], ["JSDocPrivateTag", 335], ["JSDocProtectedTag", 336], ["JSDocReadonlyTag", 337], ["JSDocOverrideTag", 338], ["JSDocCallbackTag", 339], ["JSDocOverloadTag", 340], ["JSDocEnumTag", 341], ["JSDocParameterTag", 342], ["JSDocReturnTag", 343], ["JSDocThisTag", 344], ["JSDocTypeTag", 345], ["JSDocTemplateTag", 346], ["JSDocTypedefTag", 347], ["JSDocSeeTag", 348], ["JSDocPropertyTag", 349], ["JSDocThrowsTag", 350], ["JSDocSatisfiesTag", 351], ["JSDocImportTag", 352], ["SyntaxList", 353], ["NotEmittedStatement", 354], ["NotEmittedTypeElement", 355], ["PartiallyEmittedExpression", 356], ["CommaListExpression", 357], ["SyntheticReferenceExpression", 358], ["Count", 359], ["FirstAssignment", 64], ["LastAssignment", 79], ["FirstCompoundAssignment", 65], ["LastCompoundAssignment", 79], ["FirstReservedWord", 83], ["LastReservedWord", 118], ["FirstKeyword", 83], ["LastKeyword", 166], ["FirstFutureReservedWord", 119], ["LastFutureReservedWord", 127], ["FirstTypeNode", 183], ["LastTypeNode", 206], ["FirstPunctuation", 19], ["LastPunctuation", 79], ["FirstToken", 0], ["LastToken", 166], ["FirstTriviaToken", 2], ["LastTriviaToken", 7], ["FirstLiteralToken", 9], ["LastLiteralToken", 15], ["FirstTemplateToken", 15], ["LastTemplateToken", 18], ["FirstBinaryOperator", 30], ["LastBinaryOperator", 79], ["FirstStatement", 244], ["LastStatement", 260], ["FirstNode", 167], ["FirstJSDocNode", 310], ["LastJSDocNode", 352], ["FirstJSDocTagNode", 328], ["LastJSDocTagNode", 352]])]], [["Item", FSharpMapped_$reflection()]], [["Item", FSharpPrimitive_$reflection()]], [["Item", FSharpTypeAlias_$reflection()]], [], [["Item", FSharpTypeReference_$reflection()]], [["Item", list_type(FSharpType_$reflection())]], [["Item", string_type]], [["Item", FSharpType_$reflection()]], [["Item", FSharpThisType_$reflection()]], [["Item", FSharpFunctionType_$reflection()]], [["Item", FSharpClass_$reflection()]], [], [["Item", FSharpJSApi_$reflection()]], [["Item", FSharpDelegate_$reflection()]], [["Item", FSharpTypeExtension_$reflection()]]]);
618
599
  }
619
600
 
620
- export class FSharpOutFile extends Record {
621
- constructor(Name, Opens) {
622
- super();
623
- this.Name = Name;
624
- this.Opens = Opens;
625
- }
626
- }
627
-
628
- export function FSharpOutFile_$reflection() {
629
- return record_type("Glutinum.Converter.FSharpAST.FSharpOutFile", [], FSharpOutFile, () => [["Name", string_type], ["Opens", list_type(string_type)]]);
630
- }
631
-
632
- export function FSharpLiteral__ToText(this$) {
633
- switch (this$.tag) {
634
- case 1:
635
- return int32ToString(this$.fields[0]);
636
- case 2:
637
- return this$.fields[0].toString();
638
- case 3:
639
- return toString(this$.fields[0]);
640
- case 4:
641
- return "null";
642
- default:
643
- return this$.fields[0];
644
- }
645
- }
646
-
647
601
  export function FSharpEnum__get_Type(this$) {
648
602
  const isString = forAll((c) => {
649
603
  const matchValue = c.Value;
@@ -678,26 +632,123 @@ export function FSharpEnum__get_Type(this$) {
678
632
  }
679
633
  }
680
634
 
681
- export function FSharpAccessibility__get_Text(this$) {
682
- switch (this$.tag) {
683
- case 1:
684
- return "private";
685
- case 2:
686
- return "protected";
687
- default:
688
- return "public";
689
- }
690
- }
691
-
692
- export function FSharpConstructor_get_EmptyPublic() {
693
- return new FSharpConstructor(empty(), empty(), FSharpAccessibility.Public);
635
+ export function FSharpTypeParameterInfo_Create_Z6CFD3565(name, constraint_, default_) {
636
+ return new FSharpTypeParameterInfo(name, constraint_, default_);
694
637
  }
695
638
 
696
- export function FSharpConstructor_get_EmptyPrivate() {
697
- return new FSharpConstructor(empty(), empty(), FSharpAccessibility.Private);
639
+ export function FSharpTypeModule_mapChildren(f, typ) {
640
+ switch (typ.tag) {
641
+ case 11: {
642
+ const typeReference = typ.fields[0];
643
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(typeReference.Name, typeReference.FullName, typeReference.ModulePath, map(f, typeReference.TypeArguments), typeReference.Type)]);
644
+ }
645
+ case 3:
646
+ return new FSharpType(/* Option */ 3, [f(typ.fields[0])]);
647
+ case 14:
648
+ return new FSharpType(/* ResizeArray */ 14, [f(typ.fields[0])]);
649
+ case 19:
650
+ return new FSharpType(/* JSApi */ 19, [new FSharpJSApi(f(typ.fields[0].fields[0]))]);
651
+ case 12:
652
+ return new FSharpType(/* Tuple */ 12, [map(f, typ.fields[0])]);
653
+ case 1: {
654
+ const unionInfo = typ.fields[0];
655
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, map((_arg) => {
656
+ switch (_arg.tag) {
657
+ case 1:
658
+ return new FSharpUnionCase(/* Typed */ 1, [f(_arg.fields[0])]);
659
+ case 2:
660
+ return new FSharpUnionCase(/* Field */ 2, [_arg.fields[0], f(_arg.fields[1])]);
661
+ default:
662
+ return _arg;
663
+ }
664
+ }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
665
+ }
666
+ case 16: {
667
+ const functionType = typ.fields[0];
668
+ return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, f(parameter.Type), parameter.OriginalGlueMember)), functionType.Parameters), f(functionType.ReturnType))]);
669
+ }
670
+ default:
671
+ return typ;
672
+ }
698
673
  }
699
674
 
700
- export function FSharpTypeParameterInfo_Create_Z6CFD3565(name, constraint_, default_) {
701
- return new FSharpTypeParameterInfo(name, constraint_, default_);
675
+ /**
676
+ * The return type of a function comes before its parameters
677
+ */
678
+ export function FSharpTypeModule_children(typ) {
679
+ let matchResult, inner;
680
+ switch (typ.tag) {
681
+ case 11: {
682
+ matchResult = 0;
683
+ break;
684
+ }
685
+ case 3: {
686
+ matchResult = 1;
687
+ inner = typ.fields[0];
688
+ break;
689
+ }
690
+ case 14: {
691
+ matchResult = 1;
692
+ inner = typ.fields[0];
693
+ break;
694
+ }
695
+ case 19: {
696
+ matchResult = 1;
697
+ inner = typ.fields[0].fields[0];
698
+ break;
699
+ }
700
+ case 12: {
701
+ matchResult = 2;
702
+ break;
703
+ }
704
+ case 1: {
705
+ matchResult = 3;
706
+ break;
707
+ }
708
+ case 16: {
709
+ matchResult = 4;
710
+ break;
711
+ }
712
+ default:
713
+ matchResult = 5;
714
+ }
715
+ switch (matchResult) {
716
+ case 0:
717
+ return typ.fields[0].TypeArguments;
718
+ case 1:
719
+ return singleton(inner);
720
+ case 2:
721
+ return typ.fields[0];
722
+ case 3:
723
+ return choose((_arg) => {
724
+ let matchResult_1, inner_1;
725
+ switch (_arg.tag) {
726
+ case 1: {
727
+ matchResult_1 = 0;
728
+ inner_1 = _arg.fields[0];
729
+ break;
730
+ }
731
+ case 2: {
732
+ matchResult_1 = 0;
733
+ inner_1 = _arg.fields[1];
734
+ break;
735
+ }
736
+ default:
737
+ matchResult_1 = 1;
738
+ }
739
+ switch (matchResult_1) {
740
+ case 0:
741
+ return inner_1;
742
+ default:
743
+ return undefined;
744
+ }
745
+ }, typ.fields[0].Cases);
746
+ case 4: {
747
+ const functionType = typ.fields[0];
748
+ return cons(functionType.ReturnType, map((_arg_1) => _arg_1.Type, functionType.Parameters));
749
+ }
750
+ default:
751
+ return empty();
752
+ }
702
753
  }
703
754
 
@@ -1,33 +1,30 @@
1
1
 
2
2
  import { createNodeHost, Bootstrap_createProgramForCLI } from "./Hosting.js";
3
- import * as fs from "fs";
4
- import { disposeSafe, getEnumerator, Exception } from "../fable_modules/fable-library-js.5.17.2/Util.js";
5
- import { concat } from "../fable_modules/fable-library-js.5.17.2/String.js";
6
- import { toString } from "../fable_modules/fable-library-js.5.17.2/Types.js";
3
+ import { readFileSync, existsSync } from "fs";
4
+ import { comparePrimitives, disposeSafe, getEnumerator, Exception } from "../fable_modules/fable-library-js.5.21.0/Util.js";
5
+ import { concat } from "../fable_modules/fable-library-js.5.21.0/String.js";
7
6
  import { printFileWith, Printer_$ctor } from "./Printer.js";
8
7
  import { readSourceFile } from "./Read.js";
9
8
  import { error as error_1, warn } from "./Log.js";
10
- import { applyWith } from "./Transform.js";
11
- import { defaultArg } from "../fable_modules/fable-library-js.5.17.2/Option.js";
12
- import { empty } from "../fable_modules/fable-library-js.5.17.2/List.js";
13
- import { generateWith, defaultOptions } from "./Packages.js";
9
+ import { TransformOptions, applyWithOptions } from "./Transform.js";
10
+ import { ImportSource } from "./Transformer/Context.js";
11
+ import { defaultArg } from "../fable_modules/fable-library-js.5.21.0/Option.js";
12
+ import { empty } from "../fable_modules/fable-library-js.5.21.0/Map.js";
13
+ import { ofArray, empty as empty_1 } from "../fable_modules/fable-library-js.5.21.0/List.js";
14
+ import { toString } from "../fable_modules/fable-library-js.5.21.0/Types.js";
15
+ import { defaultMaxOverloads } from "./Transformer/UnionOverloads.js";
16
+ import { defaultOptions, generateWith } from "./Packages.js";
17
+ import { Operators_IsNull } from "../fable_modules/fable-library-js.5.21.0/FSharp.Core.js";
14
18
 
15
19
  export function createProgramForCLI(fileName, source) {
16
20
  return Bootstrap_createProgramForCLI(fileName, source);
17
21
  }
18
22
 
19
- export function generateBindingFile(filePath) {
20
- return generateBindingFileWith("Glutinum", filePath);
21
- }
22
-
23
- /**
24
- * Generate the binding of a single declaration file as the module <c>moduleName</c>
25
- */
26
- export function generateBindingFileWith(moduleName, filePath) {
27
- if (!fs.existsSync(filePath)) {
23
+ function generateFile(moduleName, isGlobal, maxOverloads, filePath) {
24
+ if (!existsSync(filePath)) {
28
25
  throw new Exception(concat("File does not exist: ", filePath));
29
26
  }
30
- const program = createProgramForCLI(filePath, toString(fs.readFileSync(filePath)));
27
+ const program = createProgramForCLI(filePath, readFileSync(filePath, "utf8"));
31
28
  const checker = program.getTypeChecker();
32
29
  const sourceFile = program.getSourceFile(filePath);
33
30
  const printer = Printer_$ctor();
@@ -41,7 +38,9 @@ export function generateBindingFileWith(moduleName, filePath) {
41
38
  finally {
42
39
  disposeSafe(enumerator);
43
40
  }
44
- const transformResult = applyWith(defaultArg(readerResult.ImportSpecifier, "REPLACE_ME_WITH_MODULE_NAME"), readerResult.TypeMemory, readerResult.GlueAST);
41
+ const transformResult = applyWithOptions(new TransformOptions(isGlobal ? ImportSource.Global : (new ImportSource(/* Module */ 0, [defaultArg(readerResult.ImportSpecifier, "REPLACE_ME_WITH_MODULE_NAME"), empty({
42
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
43
+ })])), maxOverloads), readerResult.TypeMemory, readerResult.GlueAST);
45
44
  let enumerator_1 = getEnumerator(transformResult.Warnings);
46
45
  try {
47
46
  while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
@@ -60,16 +59,23 @@ export function generateBindingFileWith(moduleName, filePath) {
60
59
  finally {
61
60
  disposeSafe(enumerator_2);
62
61
  }
63
- printFileWith(moduleName, false, empty(), printer, transformResult);
62
+ printFileWith(moduleName, false, empty_1(), printer, transformResult);
64
63
  return toString(printer);
65
64
  }
66
65
 
66
+ export function generateBindingFileWith(moduleName, filePath) {
67
+ return generateFile(moduleName, false, defaultMaxOverloads, filePath);
68
+ }
69
+
67
70
  /**
68
- * Generate a single binding file for the packages, and the packages they depend on.
69
- * An empty list generates every package installed in the nearest <c>node_modules</c>.
71
+ * `isGlobal`: the file declares the globals of a script, nothing is imported
70
72
  */
71
- export function generatePackagesWith(host, inputs) {
72
- return generatePackagesWithOptions(defaultOptions, host, inputs);
73
+ export function generateBindingFileWithOptions(moduleName, isGlobal, maxOverloads, filePath) {
74
+ return generateFile(moduleName, isGlobal, maxOverloads, filePath);
75
+ }
76
+
77
+ export function generateBindingFile(filePath) {
78
+ return generateBindingFileWith("Glutinum", filePath);
73
79
  }
74
80
 
75
81
  export function generatePackagesWithOptions(options, host, inputs) {
@@ -95,6 +101,18 @@ export function generatePackagesWithOptions(options, host, inputs) {
95
101
  return result.FSharpCode;
96
102
  }
97
103
 
104
+ /**
105
+ * Generate a single binding file for the packages, and the packages they depend on.
106
+ * An empty list generates every package installed in the nearest <c>node_modules</c>.
107
+ */
108
+ export function generatePackagesWith(host, inputs) {
109
+ return generatePackagesWithOptions(defaultOptions, host, inputs);
110
+ }
111
+
112
+ export function generatePackagesFromDisk(options, inputs) {
113
+ return generatePackagesWithOptions(options, createNodeHost(process.cwd()), inputs);
114
+ }
115
+
98
116
  /**
99
117
  * The packages installed on the disk, from the current directory
100
118
  */
@@ -102,7 +120,15 @@ export function generatePackages(inputs) {
102
120
  return generatePackagesFromDisk(defaultOptions, inputs);
103
121
  }
104
122
 
105
- export function generatePackagesFromDisk(options, inputs) {
106
- return generatePackagesWithOptions(options, createNodeHost(process.cwd()), inputs);
123
+ /**
124
+ * The entry of the JavaScript tests, an array stands for the list and `null` for the Node host
125
+ */
126
+ export function generatePackagesOfArray(host, inputs) {
127
+ if (Operators_IsNull(host)) {
128
+ return generatePackages(ofArray(inputs));
129
+ }
130
+ else {
131
+ return generatePackagesWith(host, ofArray(inputs));
132
+ }
107
133
  }
108
134