@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,678 @@
1
+
2
+ import { union_type, record_type, int32_type, array_type, string_type, class_type } from "../../fable_modules/fable-library-js.5.21.0/Reflection.js";
3
+ import { trimStart, join, concat, substring } from "../../fable_modules/fable-library-js.5.21.0/String.js";
4
+ import { comparePrimitives, defaultOf, safeHash, equals, int32ToString } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
5
+ import { isEmpty, empty, singleton, contains, map } from "../../fable_modules/fable-library-js.5.21.0/List.js";
6
+ import { FSharpModule, FSharpTypeAlias, FSharpEnum, FSharpUnion, FSharpDelegate, FSharpClass, FSharpInterface, FSharpAttribute, FSharpMember, FSharpMemberInfo, FSharpType } from "../FsharpAST.js";
7
+ import { Union, FSharpRef, Record } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
8
+ import { create, State_$reflection } from "./Conditionals.js";
9
+ import { create as create_1, State_$reflection as State_$reflection_1 } from "./KeyOfMaps.js";
10
+ import { setItem, item } from "../../fable_modules/fable-library-js.5.21.0/Array.js";
11
+ import { getItemFromDict, tryGetValue } from "../../fable_modules/fable-library-js.5.21.0/MapUtil.js";
12
+ import { collect, append, delay, toList, tryFindIndex } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
13
+ import { unwrap, defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
14
+ import { FSharpMap__TryFind } from "../../fable_modules/fable-library-js.5.21.0/Map.js";
15
+ import { FSharpSet__Contains, empty as empty_1, ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
16
+ import { sanitizeTypeName, sanitizeName } from "../Utils/Naming.js";
17
+
18
+ export class Reporter {
19
+ constructor() {
20
+ this["Warnings@"] = [];
21
+ this["Errors@"] = [];
22
+ this["HasRegEpx@"] = false;
23
+ this["HasReadonlyArray@"] = false;
24
+ this["HasIterable@"] = false;
25
+ }
26
+ }
27
+
28
+ export function Reporter_$reflection() {
29
+ return class_type("Glutinum.Converter.Transformer.Context.Reporter", undefined, Reporter);
30
+ }
31
+
32
+ export function Reporter_$ctor() {
33
+ return new Reporter();
34
+ }
35
+
36
+ export function Reporter__get_Warnings(__) {
37
+ return __["Warnings@"];
38
+ }
39
+
40
+ export function Reporter__get_Errors(__) {
41
+ return __["Errors@"];
42
+ }
43
+
44
+ export function Reporter__get_HasRegEpx(__) {
45
+ return __["HasRegEpx@"];
46
+ }
47
+
48
+ export function Reporter__set_HasRegEpx_Z1FBCCD16(__, v) {
49
+ __["HasRegEpx@"] = v;
50
+ }
51
+
52
+ export function Reporter__get_HasReadonlyArray(__) {
53
+ return __["HasReadonlyArray@"];
54
+ }
55
+
56
+ export function Reporter__set_HasReadonlyArray_Z1FBCCD16(__, v) {
57
+ __["HasReadonlyArray@"] = v;
58
+ }
59
+
60
+ export function Reporter__get_HasIterable(__) {
61
+ return __["HasIterable@"];
62
+ }
63
+
64
+ export function Reporter__set_HasIterable_Z1FBCCD16(__, v) {
65
+ __["HasIterable@"] = v;
66
+ }
67
+
68
+ /**
69
+ * `` ``use``_1 `` is not a name, the suffix goes inside the backticks
70
+ */
71
+ export function withCountSuffix(name, count) {
72
+ if (name.endsWith("``")) {
73
+ return ((substring(name, 0, name.length - 2) + "_") + int32ToString(count)) + "``";
74
+ }
75
+ else {
76
+ return (name + "_") + int32ToString(count);
77
+ }
78
+ }
79
+
80
+ /**
81
+ * A `Create` returns the type it builds, so its name is not part of the shape
82
+ */
83
+ export function withoutSelfReference(members) {
84
+ return map((_arg) => {
85
+ let matchResult, method_1, member_;
86
+ if (_arg.tag === 0) {
87
+ if (contains(FSharpAttribute.ParamObject, _arg.fields[0].Attributes, {
88
+ Equals: equals,
89
+ GetHashCode: (x) => (safeHash(x) | 0),
90
+ })) {
91
+ matchResult = 0;
92
+ method_1 = _arg.fields[0];
93
+ }
94
+ else {
95
+ matchResult = 1;
96
+ member_ = _arg;
97
+ }
98
+ }
99
+ else {
100
+ matchResult = 1;
101
+ member_ = _arg;
102
+ }
103
+ switch (matchResult) {
104
+ case 0:
105
+ return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(method_1.Attributes, method_1.Name, method_1.OriginalName, method_1.TypeParameters, method_1.Parameters, FSharpType.Discard, method_1.IsOptional, method_1.IsStatic, method_1.Accessor, method_1.Accessibility, method_1.XmlDoc, method_1.Body)]);
106
+ default:
107
+ return member_;
108
+ }
109
+ }, members);
110
+ }
111
+
112
+ /**
113
+ * The anonymous type as it is compared to the ones already exposed under the same name
114
+ */
115
+ export function withoutName(typ) {
116
+ switch (typ.tag) {
117
+ case 5: {
118
+ const info = typ.fields[0];
119
+ return new FSharpType(/* Interface */ 5, [new FSharpInterface(info.Attributes, "", info.XmlDoc, info.OriginalName, info.TypeParameters, withoutSelfReference(info.Members), info.Inheritance)]);
120
+ }
121
+ case 17: {
122
+ const info_1 = typ.fields[0];
123
+ return new FSharpType(/* Class */ 17, [new FSharpClass(info_1.Attributes, info_1.XmlDoc, "", info_1.TypeParameters, info_1.PrimaryConstructor, info_1.SecondaryConstructors, info_1.ExplicitFields)]);
124
+ }
125
+ case 20: {
126
+ const info_2 = typ.fields[0];
127
+ return new FSharpType(/* Delegate */ 20, [new FSharpDelegate(info_2.XmlDoc, "", info_2.TypeParameters, info_2.Parameters, info_2.ReturnType)]);
128
+ }
129
+ case 1: {
130
+ const info_3 = typ.fields[0];
131
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(info_3.Attributes, "", info_3.Cases, info_3.IsOptional, info_3.TypeParameters, info_3.Constants)]);
132
+ }
133
+ case 0:
134
+ return new FSharpType(/* Enum */ 0, [new FSharpEnum("", typ.fields[0].Cases)]);
135
+ case 9: {
136
+ const info_5 = typ.fields[0];
137
+ return new FSharpType(/* TypeAlias */ 9, [new FSharpTypeAlias(info_5.Attributes, "", info_5.XmlDoc, info_5.Type, info_5.TypeParameters)]);
138
+ }
139
+ default:
140
+ return typ;
141
+ }
142
+ }
143
+
144
+ export function typeName(typ) {
145
+ switch (typ.tag) {
146
+ case 5:
147
+ return typ.fields[0].Name;
148
+ case 17:
149
+ return typ.fields[0].Name;
150
+ case 20:
151
+ return typ.fields[0].Name;
152
+ case 1:
153
+ return typ.fields[0].Name;
154
+ case 0:
155
+ return typ.fields[0].Name;
156
+ case 9:
157
+ return typ.fields[0].Name;
158
+ default:
159
+ return undefined;
160
+ }
161
+ }
162
+
163
+ /**
164
+ * The indexes of the run over the type memory, and the declarations being expanded
165
+ */
166
+ export class TransformState extends Record {
167
+ constructor(Conditionals, KeyOfMaps, PartialHeritageBeingExpanded, UnionAliasesBeingExpanded, MaxOverloads) {
168
+ super();
169
+ this.Conditionals = Conditionals;
170
+ this.KeyOfMaps = KeyOfMaps;
171
+ this.PartialHeritageBeingExpanded = PartialHeritageBeingExpanded;
172
+ this.UnionAliasesBeingExpanded = UnionAliasesBeingExpanded;
173
+ this.MaxOverloads = (MaxOverloads | 0);
174
+ }
175
+ }
176
+
177
+ export function TransformState_$reflection() {
178
+ return record_type("Glutinum.Converter.Transformer.Context.TransformState", [], TransformState, () => [["Conditionals", State_$reflection()], ["KeyOfMaps", State_$reflection_1()], ["PartialHeritageBeingExpanded", array_type(string_type)], ["UnionAliasesBeingExpanded", array_type(string_type)], ["MaxOverloads", int32_type]]);
179
+ }
180
+
181
+ export function TransformState_Create_Z68CEF8E2(typeMemory, maxOverloads) {
182
+ return new TransformState(create(typeMemory), create_1(typeMemory), [], [], maxOverloads);
183
+ }
184
+
185
+ /**
186
+ * The names of the anonymous types of a scope (`Exports.exec.callback`) of an F# module: a
187
+ * type identical to an already exposed one takes its name instead of the next count suffix
188
+ */
189
+ export class TypeLiteralsMemory {
190
+ constructor() {
191
+ this.exposed = (new Map([]));
192
+ this.assigned = (new Map([]));
193
+ this.pending = (new Map([]));
194
+ this.byDeclaration = (new Map([]));
195
+ this.modulePath = [];
196
+ this.rootIsFileModule = false;
197
+ }
198
+ }
199
+
200
+ export function TypeLiteralsMemory_$reflection() {
201
+ return class_type("Glutinum.Converter.Transformer.Context.TypeLiteralsMemory", undefined, TypeLiteralsMemory);
202
+ }
203
+
204
+ export function TypeLiteralsMemory_$ctor() {
205
+ return new TypeLiteralsMemory();
206
+ }
207
+
208
+ export function TypeLiteralsMemory__EnterModule_Z721C83C5(_, name) {
209
+ void (_.modulePath.push(name));
210
+ }
211
+
212
+ export function TypeLiteralsMemory__EnterFileModule_Z721C83C5(_, name) {
213
+ _.rootIsFileModule = (_.modulePath.length === 0);
214
+ void (_.modulePath.push(name));
215
+ }
216
+
217
+ export function TypeLiteralsMemory__get_RootModuleName(_) {
218
+ if (_.modulePath.length === 0) {
219
+ return undefined;
220
+ }
221
+ else {
222
+ return item(0, _.modulePath);
223
+ }
224
+ }
225
+
226
+ export function TypeLiteralsMemory__LeaveModule(_) {
227
+ _.modulePath.splice(_.modulePath.length - 1, 1);
228
+ }
229
+
230
+ export function TypeLiteralsMemory__GetTypeName_Z384F8060(_, fullName, currentScopeName) {
231
+ const key = concat(TypeLiteralsMemory__moduleKey(_), "|", fullName);
232
+ let types_2;
233
+ let matchValue;
234
+ let outArg = defaultOf();
235
+ matchValue = [tryGetValue(_.exposed, key, new FSharpRef(() => outArg, (v) => {
236
+ outArg = v;
237
+ })), outArg];
238
+ if (matchValue[0]) {
239
+ types_2 = matchValue[1];
240
+ }
241
+ else {
242
+ const types_1 = [];
243
+ _.exposed.set(key, types_1);
244
+ types_2 = types_1;
245
+ }
246
+ const index = types_2.length | 0;
247
+ void (types_2.push(undefined));
248
+ const name = (index === 0) ? currentScopeName : withCountSuffix(currentScopeName, index);
249
+ _.assigned.set(concat(key, "/", name), [fullName, index]);
250
+ _.pending.set(concat(TypeLiteralsMemory__moduleKey(_), "|", name), key);
251
+ return name;
252
+ }
253
+
254
+ /**
255
+ * `true` when an identical type is already exposed to the module, the references use its name
256
+ */
257
+ export function TypeLiteralsMemory__IsDuplicate_Z4A63A91E(_, typ, root, modulePath) {
258
+ const matchValue = typeName(typ);
259
+ if (matchValue != null) {
260
+ const name = matchValue;
261
+ const pendingKey = concat(TypeLiteralsMemory__moduleKey(_), "|", name);
262
+ let matchValue_1;
263
+ let outArg = defaultOf();
264
+ matchValue_1 = [tryGetValue(_.pending, pendingKey, new FSharpRef(() => outArg, (v) => {
265
+ outArg = v;
266
+ })), outArg];
267
+ if (matchValue_1[0]) {
268
+ const key = matchValue_1[1];
269
+ _.pending.delete(pendingKey);
270
+ const types = getItemFromDict(_.exposed, key);
271
+ const signature = withoutName(typ);
272
+ const last = (types.length - 1) | 0;
273
+ const existing = tryFindIndex((_arg) => {
274
+ if (_arg == null) {
275
+ return false;
276
+ }
277
+ else {
278
+ const candidateModulePath = _arg[2];
279
+ const candidate = _arg[0];
280
+ if ((_arg[1] === root) && (candidateModulePath === modulePath)) {
281
+ return equals(candidate, signature);
282
+ }
283
+ else {
284
+ return false;
285
+ }
286
+ }
287
+ }, types);
288
+ let matchResult, index_1;
289
+ if (existing != null) {
290
+ if (existing < last) {
291
+ matchResult = 0;
292
+ index_1 = existing;
293
+ }
294
+ else {
295
+ matchResult = 1;
296
+ }
297
+ }
298
+ else {
299
+ matchResult = 1;
300
+ }
301
+ switch (matchResult) {
302
+ case 0: {
303
+ types.splice(last, 1);
304
+ const patternInput = getItemFromDict(_.assigned, concat(key, "/", name));
305
+ _.assigned.set(concat(key, "/", name), [patternInput[0], index_1]);
306
+ return true;
307
+ }
308
+ default: {
309
+ setItem(types, last, [signature, root, modulePath]);
310
+ return false;
311
+ }
312
+ }
313
+ }
314
+ else {
315
+ return false;
316
+ }
317
+ }
318
+ else {
319
+ return false;
320
+ }
321
+ }
322
+
323
+ /**
324
+ * The name already given to the anonymous type declared by `id`, when the name is
325
+ * reachable from `root`: it qualifies the type inside one generated module only
326
+ */
327
+ export function TypeLiteralsMemory__TryReference_433E080(_, id, root) {
328
+ let matchValue;
329
+ let outArg = defaultOf();
330
+ matchValue = [tryGetValue(_.byDeclaration, id, new FSharpRef(() => outArg, (v) => {
331
+ outArg = v;
332
+ })), outArg];
333
+ let matchResult;
334
+ if (matchValue[0]) {
335
+ if (matchValue[1][0] === root) {
336
+ matchResult = 0;
337
+ }
338
+ else {
339
+ matchResult = 1;
340
+ }
341
+ }
342
+ else {
343
+ matchResult = 1;
344
+ }
345
+ switch (matchResult) {
346
+ case 0:
347
+ return matchValue[1][1];
348
+ default:
349
+ return undefined;
350
+ }
351
+ }
352
+
353
+ export function TypeLiteralsMemory__Remember_74C8CBB(_, id, root, name) {
354
+ _.byDeclaration.set(id, [root, name]);
355
+ }
356
+
357
+ /**
358
+ * The qualified name to reference the type named `name` by `GetTypeName` in `fullName`
359
+ */
360
+ export function TypeLiteralsMemory__ReferenceName_Z384F8060(_, fullName, name) {
361
+ let qualified;
362
+ let matchValue;
363
+ let outArg = defaultOf();
364
+ matchValue = [tryGetValue(_.assigned, `${TypeLiteralsMemory__moduleKey(_)}|${fullName}/${name}`, new FSharpRef(() => outArg, (v) => {
365
+ outArg = v;
366
+ })), outArg];
367
+ qualified = (matchValue[0] ? ((matchValue[1][1] === 0) ? matchValue[1][0] : withCountSuffix(matchValue[1][0], matchValue[1][1])) : fullName);
368
+ const rootDepth = (_.rootIsFileModule ? 1 : 0) | 0;
369
+ if (_.modulePath.length <= rootDepth) {
370
+ return qualified;
371
+ }
372
+ else {
373
+ return concat(TypeLiteralsMemory__moduleKey(_), ".", qualified);
374
+ }
375
+ }
376
+
377
+ export function TypeLiteralsMemory__moduleKey(this$) {
378
+ return join(".", this$.modulePath);
379
+ }
380
+
381
+ /**
382
+ * Where the top-level declarations come from at runtime
383
+ */
384
+ export class ImportSource extends Union {
385
+ constructor(tag, fields) {
386
+ super();
387
+ this.tag = tag;
388
+ this.fields = fields;
389
+ }
390
+ cases() {
391
+ return ["Module", "Global", "NoRuntime"];
392
+ }
393
+ static Global = new ImportSource(1, []);
394
+ static NoRuntime = new ImportSource(2, []);
395
+ }
396
+
397
+ export function ImportSource_$reflection() {
398
+ return union_type("Glutinum.Converter.Transformer.Context.ImportSource", [], ImportSource, () => [[["specifier", string_type], ["symbolSpecifiers", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, string_type])]], [], []]);
399
+ }
400
+
401
+ export function specifierOf(name, specifier, symbolSpecifiers) {
402
+ return defaultArg(FSharpMap__TryFind(symbolSpecifiers, name), specifier);
403
+ }
404
+
405
+ export function importAttribute(name, source) {
406
+ switch (source.tag) {
407
+ case 1:
408
+ return singleton(new FSharpAttribute(/* Global */ 21, [name]));
409
+ case 2:
410
+ return empty();
411
+ default:
412
+ return singleton(new FSharpAttribute(/* Import */ 3, [name, specifierOf(name, source.fields[0], source.fields[1])]));
413
+ }
414
+ }
415
+
416
+ export function importAllAttribute(name, source) {
417
+ switch (source.tag) {
418
+ case 1:
419
+ return singleton(new FSharpAttribute(/* Global */ 21, [name]));
420
+ case 2:
421
+ return empty();
422
+ default:
423
+ return singleton(new FSharpAttribute(/* ImportAll */ 4, [specifierOf(name, source.fields[0], source.fields[1])]));
424
+ }
425
+ }
426
+
427
+ export function importDefaultAttribute(name, source) {
428
+ switch (source.tag) {
429
+ case 1:
430
+ return singleton(new FSharpAttribute(/* Global */ 21, [name]));
431
+ case 2:
432
+ return empty();
433
+ default:
434
+ return singleton(new FSharpAttribute(/* ImportDefault */ 5, [specifierOf(name, source.fields[0], source.fields[1])]));
435
+ }
436
+ }
437
+
438
+ export const glutinumTypesNames = ofSeq(["ReadonlyArray", "ConcatArray", "ArrayLike", "ReadonlyMap", "ReadonlySet", "PromiseLike", "TemplateStringsArray", "Iterator", "IteratorResult", "IteratorYieldResult", "IteratorReturnResult", "IterableIterator", "Generator", "ArrayBufferLike", "ArrayBufferTypes", "SharedArrayBuffer", "SharedArrayBufferConstructor", "ErrorOptions", "PropertyKey", "PropertyDescriptor", "TypedPropertyDescriptor", "PropertyDescriptorMap", "ProxyHandler", "ProxyConstructor", "BooleanConstructor", "Date", "DateConstructor", "NumberConstructor", "StringConstructor", "ObjectConstructor", "SymbolConstructor"], {
439
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
440
+ });
441
+
442
+ export class TransformContext {
443
+ constructor(reporter, currentScopeName, typeMemory, state, typeLiteralsMemory, importSource, parent, originalScopeName) {
444
+ let matchValue;
445
+ this.reporter = reporter;
446
+ this.currentScopeName = currentScopeName;
447
+ this.typeMemory = typeMemory;
448
+ this.state = state;
449
+ this.typeLiteralsMemory = typeLiteralsMemory;
450
+ this.importSource = importSource;
451
+ this.parent = parent;
452
+ this.types = [];
453
+ this.modules = [];
454
+ this["FullName@"] = ((matchValue = this.parent, (matchValue != null) ? trimStart((TransformContext__get_FullName(matchValue) + ".") + this.currentScopeName, ".") : ""));
455
+ this["CurrentScopeName@"] = this.currentScopeName;
456
+ this["OriginalScopeName@"] = defaultArg(originalScopeName, this.currentScopeName);
457
+ this["TypeMemory@"] = this.typeMemory;
458
+ this["State@"] = this.state;
459
+ this["TypeLiteralsMemory@"] = this.typeLiteralsMemory;
460
+ this["ImportSource@"] = this.importSource;
461
+ this["_types@"] = this.types;
462
+ this["_Reporter@"] = this.reporter;
463
+ this["SiblingTypeNames@"] = empty_1({
464
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
465
+ });
466
+ }
467
+ }
468
+
469
+ export function TransformContext_$reflection() {
470
+ return class_type("Glutinum.Converter.Transformer.Context.TransformContext", undefined, TransformContext);
471
+ }
472
+
473
+ export function TransformContext_$ctor_Z1635F75A(reporter, currentScopeName, typeMemory, state, typeLiteralsMemory, importSource, parent, originalScopeName) {
474
+ return new TransformContext(reporter, currentScopeName, typeMemory, state, typeLiteralsMemory, importSource, parent, originalScopeName);
475
+ }
476
+
477
+ export function TransformContext__get_FullName(__) {
478
+ return __["FullName@"];
479
+ }
480
+
481
+ export function TransformContext__get_CurrentScopeName(__) {
482
+ return __["CurrentScopeName@"];
483
+ }
484
+
485
+ /**
486
+ * The name the scope had before it was renamed to stay out of the way of a member
487
+ */
488
+ export function TransformContext__get_OriginalScopeName(__) {
489
+ return __["OriginalScopeName@"];
490
+ }
491
+
492
+ export function TransformContext__get_TypeMemory(__) {
493
+ return __["TypeMemory@"];
494
+ }
495
+
496
+ export function TransformContext__get_State(__) {
497
+ return __["State@"];
498
+ }
499
+
500
+ export function TransformContext__get_TypeLiteralsMemory(__) {
501
+ return __["TypeLiteralsMemory@"];
502
+ }
503
+
504
+ export function TransformContext__get_ImportSource(__) {
505
+ return __["ImportSource@"];
506
+ }
507
+
508
+ /**
509
+ * We need to expose the types for the children to be able to access
510
+ * push to them.
511
+ * This variable should not be accessed directly, but through the ExposeType method
512
+ * that's why we decorate it with the _ prefix
513
+ */
514
+ export function TransformContext__get__types(__) {
515
+ return __["_types@"];
516
+ }
517
+
518
+ /**
519
+ * We expose an access to the reporter so we can propagate its instance
520
+ * when needed
521
+ * You should not use this directly, but instead use the AddWarning and AddError methods
522
+ */
523
+ export function TransformContext__get__Reporter(__) {
524
+ return __["_Reporter@"];
525
+ }
526
+
527
+ export function TransformContext__ExposeRegExp(_) {
528
+ Reporter__set_HasRegEpx_Z1FBCCD16(_.reporter, true);
529
+ }
530
+
531
+ export function TransformContext__ExposeReadonlyArray(_) {
532
+ Reporter__set_HasReadonlyArray_Z1FBCCD16(_.reporter, true);
533
+ }
534
+
535
+ export function TransformContext__ExposeIterable(_) {
536
+ Reporter__set_HasIterable_Z1FBCCD16(_.reporter, true);
537
+ }
538
+
539
+ export function TransformContext__ExposeType_Z1D58A540(this$, typ) {
540
+ let patternInput;
541
+ const matchValue = this$.parent;
542
+ if (matchValue != null) {
543
+ const parent = matchValue;
544
+ patternInput = [TransformContext__get__types(parent), TransformContext__get_FullName(parent)];
545
+ }
546
+ else {
547
+ patternInput = [this$.types, ""];
548
+ }
549
+ if (!TypeLiteralsMemory__IsDuplicate_Z4A63A91E(this$.typeLiteralsMemory, typ, TransformContext__get__types(TransformContext__get_Root(this$)), patternInput[1])) {
550
+ void (patternInput[0].push(typ));
551
+ }
552
+ }
553
+
554
+ export function TransformContext__get_Root(this$) {
555
+ const matchValue = this$.parent;
556
+ if (matchValue != null) {
557
+ return TransformContext__get_Root(matchValue);
558
+ }
559
+ else {
560
+ return this$;
561
+ }
562
+ }
563
+
564
+ /**
565
+ * The name of the next anonymous type of the scope
566
+ */
567
+ export function TransformContext__NewTypeName(this$) {
568
+ return TypeLiteralsMemory__GetTypeName_Z384F8060(this$.typeLiteralsMemory, TransformContext__get_FullName(this$), this$.currentScopeName);
569
+ }
570
+
571
+ /**
572
+ * The name an anonymous type of the scope is referenced by
573
+ */
574
+ export function TransformContext__ReferenceName_Z721C83C5(this$, name) {
575
+ return TypeLiteralsMemory__ReferenceName_Z384F8060(this$.typeLiteralsMemory, TransformContext__get_FullName(this$), name);
576
+ }
577
+
578
+ /**
579
+ * The types declared beside each other in the scope, set by the transform of the scope
580
+ */
581
+ export function TransformContext__get_SiblingTypeNames(__) {
582
+ return __["SiblingTypeNames@"];
583
+ }
584
+
585
+ /**
586
+ * The types declared beside each other in the scope, set by the transform of the scope
587
+ */
588
+ export function TransformContext__set_SiblingTypeNames_2FCB1351(__, v) {
589
+ __["SiblingTypeNames@"] = v;
590
+ }
591
+
592
+ export function TransformContext__PushScope_27AED5E3(this$, scopeName, originalScopeName) {
593
+ let option_1;
594
+ const childContext = TransformContext_$ctor_Z1635F75A(this$.reporter, sanitizeName(FSharpSet__Contains(TransformContext__get_SiblingTypeNames(this$), scopeName + "Module") ? (scopeName + "_") : (equals(TypeLiteralsMemory__get_RootModuleName(this$.typeLiteralsMemory), sanitizeTypeName(scopeName)) ? (scopeName + "_") : scopeName)), this$.typeMemory, this$.state, this$.typeLiteralsMemory, this$.importSource, this$, unwrap((option_1 = originalScopeName, (option_1 != null) ? sanitizeName(option_1) : undefined)));
595
+ void (this$.modules.push(childContext));
596
+ return childContext;
597
+ }
598
+
599
+ /**
600
+ * The types of the scope, the ones of a child scope in its module, an empty module erased
601
+ */
602
+ export function TransformContext__ToList(_) {
603
+ const types = toList(delay(() => append(toList(_.types), delay(() => collect(TransformContext__ToList, _.modules)))));
604
+ if (_.parent != null) {
605
+ if (isEmpty(types)) {
606
+ return empty();
607
+ }
608
+ else {
609
+ return singleton(new FSharpType(/* Module */ 4, [new FSharpModule(_.currentScopeName, false, undefined, types)]));
610
+ }
611
+ }
612
+ else {
613
+ return types;
614
+ }
615
+ }
616
+
617
+ export function TransformContext__AddWarning_Z721C83C5(_, warning) {
618
+ void (Reporter__get_Warnings(_.reporter).push(warning));
619
+ }
620
+
621
+ export function TransformContext__AddError_Z721C83C5(_, error) {
622
+ void (Reporter__get_Errors(_.reporter).push(error));
623
+ }
624
+
625
+ export function TransformContext__ExposeTypeAlias_Z721C83C5(this$, name) {
626
+ switch (name) {
627
+ case "RegExp": {
628
+ TransformContext__ExposeRegExp(this$);
629
+ break;
630
+ }
631
+ case "Iterable": {
632
+ TransformContext__ExposeIterable(this$);
633
+ break;
634
+ }
635
+ default:
636
+ if (FSharpSet__Contains(glutinumTypesNames, name)) {
637
+ TransformContext__ExposeReadonlyArray(this$);
638
+ }
639
+ }
640
+ }
641
+
642
+ export function TransformContext__ExposeTypeAlias_1CE4A880(this$, typ) {
643
+ if (typ.tag === 13) {
644
+ const typeReference = typ.fields[0];
645
+ if (typeReference.IsStandardLibrary) {
646
+ TransformContext__ExposeTypeAlias_Z721C83C5(this$, typeReference.Name);
647
+ }
648
+ return typ;
649
+ }
650
+ else {
651
+ return typ;
652
+ }
653
+ }
654
+
655
+ export function sanitizeNameAndPushScope(name, context) {
656
+ const context_1 = TransformContext__PushScope_27AED5E3(context, sanitizeTypeName(name));
657
+ return [sanitizeName(name), context_1];
658
+ }
659
+
660
+ /**
661
+ * `Holder.foo` reached through an `open` is the companion module, not the static member:
662
+ * the module of a static member takes a suffix so the member stays reachable
663
+ */
664
+ export function sanitizeMemberNameAndPushScope(isStatic, name, context) {
665
+ if (isStatic) {
666
+ const context_1 = TransformContext__PushScope_27AED5E3(context, sanitizeTypeName(name + "__"), sanitizeTypeName(name));
667
+ return [sanitizeName(name), context_1];
668
+ }
669
+ else {
670
+ return sanitizeNameAndPushScope(name, context);
671
+ }
672
+ }
673
+
674
+ export function sanitizeTypeNameAndPushScope(name, context) {
675
+ const name_1 = sanitizeTypeName(name);
676
+ return [name_1, TransformContext__PushScope_27AED5E3(context, name_1)];
677
+ }
678
+