@glutinum/cli 0.1.0

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 (167) hide show
  1. package/README.md +3 -0
  2. package/cli.js +2 -0
  3. package/dist/Glutinum.Converter/FsharpAST.js +371 -0
  4. package/dist/Glutinum.Converter/FsharpAST.js.map +1 -0
  5. package/dist/Glutinum.Converter/Generate.js +28 -0
  6. package/dist/Glutinum.Converter/Generate.js.map +1 -0
  7. package/dist/Glutinum.Converter/GlueAST.js +403 -0
  8. package/dist/Glutinum.Converter/GlueAST.js.map +1 -0
  9. package/dist/Glutinum.Converter/Log.js +24 -0
  10. package/dist/Glutinum.Converter/Log.js.map +1 -0
  11. package/dist/Glutinum.Converter/Printer.js +452 -0
  12. package/dist/Glutinum.Converter/Printer.js.map +1 -0
  13. package/dist/Glutinum.Converter/Read.js +10 -0
  14. package/dist/Glutinum.Converter/Read.js.map +1 -0
  15. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +28 -0
  16. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js.map +1 -0
  17. package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +72 -0
  18. package/dist/Glutinum.Converter/Reader/EnumDeclaration.js.map +1 -0
  19. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +11 -0
  20. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js.map +1 -0
  21. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +9 -0
  22. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js.map +1 -0
  23. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +10 -0
  24. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js.map +1 -0
  25. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +23 -0
  26. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js.map +1 -0
  27. package/dist/Glutinum.Converter/Reader/NamedDeclaration.js +34 -0
  28. package/dist/Glutinum.Converter/Reader/NamedDeclaration.js.map +1 -0
  29. package/dist/Glutinum.Converter/Reader/Node.js +28 -0
  30. package/dist/Glutinum.Converter/Reader/Node.js.map +1 -0
  31. package/dist/Glutinum.Converter/Reader/Parameters.js +12 -0
  32. package/dist/Glutinum.Converter/Reader/Parameters.js.map +1 -0
  33. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +28 -0
  34. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js.map +1 -0
  35. package/dist/Glutinum.Converter/Reader/TypeNode.js +126 -0
  36. package/dist/Glutinum.Converter/Reader/TypeNode.js.map +1 -0
  37. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +34 -0
  38. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js.map +1 -0
  39. package/dist/Glutinum.Converter/Reader/TypeParameters.js +14 -0
  40. package/dist/Glutinum.Converter/Reader/TypeParameters.js.map +1 -0
  41. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +95 -0
  42. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js.map +1 -0
  43. package/dist/Glutinum.Converter/Reader/Types.js +16 -0
  44. package/dist/Glutinum.Converter/Reader/Types.js.map +1 -0
  45. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +89 -0
  46. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js.map +1 -0
  47. package/dist/Glutinum.Converter/Reader/Utils.js +79 -0
  48. package/dist/Glutinum.Converter/Reader/Utils.js.map +1 -0
  49. package/dist/Glutinum.Converter/Reader/VariableStatement.js +19 -0
  50. package/dist/Glutinum.Converter/Reader/VariableStatement.js.map +1 -0
  51. package/dist/Glutinum.Converter/Transform.js +538 -0
  52. package/dist/Glutinum.Converter/Transform.js.map +1 -0
  53. package/dist/Glutinum.Converter/TypeScript.js +12 -0
  54. package/dist/Glutinum.Converter/TypeScript.js.map +1 -0
  55. package/dist/Glutinum.Converter/Utils/Keywords.js +9 -0
  56. package/dist/Glutinum.Converter/Utils/Keywords.js.map +1 -0
  57. package/dist/Glutinum.Converter/Utils/Naming.js +25 -0
  58. package/dist/Glutinum.Converter/Utils/Naming.js.map +1 -0
  59. package/dist/Glutinum.Converter/Utils/String.js +23 -0
  60. package/dist/Glutinum.Converter/Utils/String.js.map +1 -0
  61. package/dist/Program.js +12 -0
  62. package/dist/Program.js.map +1 -0
  63. package/dist/fable_modules/fable-library.4.5.0/Array.d.ts +120 -0
  64. package/dist/fable_modules/fable-library.4.5.0/Array.js +1204 -0
  65. package/dist/fable_modules/fable-library.4.5.0/Async.d.ts +32 -0
  66. package/dist/fable_modules/fable-library.4.5.0/Async.js +158 -0
  67. package/dist/fable_modules/fable-library.4.5.0/AsyncBuilder.d.ts +59 -0
  68. package/dist/fable_modules/fable-library.4.5.0/AsyncBuilder.js +183 -0
  69. package/dist/fable_modules/fable-library.4.5.0/BigInt.d.ts +115 -0
  70. package/dist/fable_modules/fable-library.4.5.0/BigInt.js +282 -0
  71. package/dist/fable_modules/fable-library.4.5.0/BitConverter.d.ts +27 -0
  72. package/dist/fable_modules/fable-library.4.5.0/BitConverter.js +138 -0
  73. package/dist/fable_modules/fable-library.4.5.0/Boolean.d.ts +3 -0
  74. package/dist/fable_modules/fable-library.4.5.0/Boolean.js +21 -0
  75. package/dist/fable_modules/fable-library.4.5.0/CHANGELOG.md +11 -0
  76. package/dist/fable_modules/fable-library.4.5.0/Char.d.ts +65 -0
  77. package/dist/fable_modules/fable-library.4.5.0/Char.js +169 -0
  78. package/dist/fable_modules/fable-library.4.5.0/Choice.d.ts +138 -0
  79. package/dist/fable_modules/fable-library.4.5.0/Choice.js +227 -0
  80. package/dist/fable_modules/fable-library.4.5.0/Date.d.ts +70 -0
  81. package/dist/fable_modules/fable-library.4.5.0/Date.js +451 -0
  82. package/dist/fable_modules/fable-library.4.5.0/DateOffset.d.ts +63 -0
  83. package/dist/fable_modules/fable-library.4.5.0/DateOffset.js +268 -0
  84. package/dist/fable_modules/fable-library.4.5.0/DateOnly.d.ts +18 -0
  85. package/dist/fable_modules/fable-library.4.5.0/DateOnly.js +124 -0
  86. package/dist/fable_modules/fable-library.4.5.0/Decimal.d.ts +45 -0
  87. package/dist/fable_modules/fable-library.4.5.0/Decimal.js +212 -0
  88. package/dist/fable_modules/fable-library.4.5.0/Double.d.ts +11 -0
  89. package/dist/fable_modules/fable-library.4.5.0/Double.js +46 -0
  90. package/dist/fable_modules/fable-library.4.5.0/Encoding.d.ts +12 -0
  91. package/dist/fable_modules/fable-library.4.5.0/Encoding.js +173 -0
  92. package/dist/fable_modules/fable-library.4.5.0/Event.d.ts +31 -0
  93. package/dist/fable_modules/fable-library.4.5.0/Event.js +93 -0
  94. package/dist/fable_modules/fable-library.4.5.0/FSharp.Collections.d.ts +7 -0
  95. package/dist/fable_modules/fable-library.4.5.0/FSharp.Collections.js +27 -0
  96. package/dist/fable_modules/fable-library.4.5.0/FSharp.Core.d.ts +17 -0
  97. package/dist/fable_modules/fable-library.4.5.0/FSharp.Core.js +69 -0
  98. package/dist/fable_modules/fable-library.4.5.0/Global.d.ts +24 -0
  99. package/dist/fable_modules/fable-library.4.5.0/Global.js +8 -0
  100. package/dist/fable_modules/fable-library.4.5.0/Guid.d.ts +10 -0
  101. package/dist/fable_modules/fable-library.4.5.0/Guid.js +142 -0
  102. package/dist/fable_modules/fable-library.4.5.0/Int32.d.ts +28 -0
  103. package/dist/fable_modules/fable-library.4.5.0/Int32.js +135 -0
  104. package/dist/fable_modules/fable-library.4.5.0/List.d.ts +143 -0
  105. package/dist/fable_modules/fable-library.4.5.0/List.js +1273 -0
  106. package/dist/fable_modules/fable-library.4.5.0/Long.d.ts +3 -0
  107. package/dist/fable_modules/fable-library.4.5.0/Long.js +46 -0
  108. package/dist/fable_modules/fable-library.4.5.0/MailboxProcessor.d.ts +25 -0
  109. package/dist/fable_modules/fable-library.4.5.0/MailboxProcessor.js +93 -0
  110. package/dist/fable_modules/fable-library.4.5.0/Map.d.ts +178 -0
  111. package/dist/fable_modules/fable-library.4.5.0/Map.js +1396 -0
  112. package/dist/fable_modules/fable-library.4.5.0/MapUtil.d.ts +10 -0
  113. package/dist/fable_modules/fable-library.4.5.0/MapUtil.js +112 -0
  114. package/dist/fable_modules/fable-library.4.5.0/MutableMap.d.ts +52 -0
  115. package/dist/fable_modules/fable-library.4.5.0/MutableMap.js +326 -0
  116. package/dist/fable_modules/fable-library.4.5.0/MutableSet.d.ts +39 -0
  117. package/dist/fable_modules/fable-library.4.5.0/MutableSet.js +232 -0
  118. package/dist/fable_modules/fable-library.4.5.0/Native.d.ts +2 -0
  119. package/dist/fable_modules/fable-library.4.5.0/Native.js +8 -0
  120. package/dist/fable_modules/fable-library.4.5.0/Numeric.d.ts +19 -0
  121. package/dist/fable_modules/fable-library.4.5.0/Numeric.js +71 -0
  122. package/dist/fable_modules/fable-library.4.5.0/Observable.d.ts +32 -0
  123. package/dist/fable_modules/fable-library.4.5.0/Observable.js +113 -0
  124. package/dist/fable_modules/fable-library.4.5.0/Option.d.ts +28 -0
  125. package/dist/fable_modules/fable-library.4.5.0/Option.js +96 -0
  126. package/dist/fable_modules/fable-library.4.5.0/README.md +3 -0
  127. package/dist/fable_modules/fable-library.4.5.0/Random.d.ts +37 -0
  128. package/dist/fable_modules/fable-library.4.5.0/Random.js +170 -0
  129. package/dist/fable_modules/fable-library.4.5.0/Range.d.ts +12 -0
  130. package/dist/fable_modules/fable-library.4.5.0/Range.js +45 -0
  131. package/dist/fable_modules/fable-library.4.5.0/Reflection.d.ts +119 -0
  132. package/dist/fable_modules/fable-library.4.5.0/Reflection.js +461 -0
  133. package/dist/fable_modules/fable-library.4.5.0/RegExp.d.ts +10 -0
  134. package/dist/fable_modules/fable-library.4.5.0/RegExp.js +132 -0
  135. package/dist/fable_modules/fable-library.4.5.0/Seq.d.ts +165 -0
  136. package/dist/fable_modules/fable-library.4.5.0/Seq.js +1379 -0
  137. package/dist/fable_modules/fable-library.4.5.0/Seq2.d.ts +18 -0
  138. package/dist/fable_modules/fable-library.4.5.0/Seq2.js +111 -0
  139. package/dist/fable_modules/fable-library.4.5.0/Set.d.ts +190 -0
  140. package/dist/fable_modules/fable-library.4.5.0/Set.js +1789 -0
  141. package/dist/fable_modules/fable-library.4.5.0/String.d.ts +49 -0
  142. package/dist/fable_modules/fable-library.4.5.0/String.js +540 -0
  143. package/dist/fable_modules/fable-library.4.5.0/System.Collections.Generic.d.ts +71 -0
  144. package/dist/fable_modules/fable-library.4.5.0/System.Collections.Generic.js +307 -0
  145. package/dist/fable_modules/fable-library.4.5.0/System.Text.d.ts +30 -0
  146. package/dist/fable_modules/fable-library.4.5.0/System.Text.js +110 -0
  147. package/dist/fable_modules/fable-library.4.5.0/SystemException.d.ts +5 -0
  148. package/dist/fable_modules/fable-library.4.5.0/SystemException.js +5 -0
  149. package/dist/fable_modules/fable-library.4.5.0/TimeOnly.d.ts +15 -0
  150. package/dist/fable_modules/fable-library.4.5.0/TimeOnly.js +122 -0
  151. package/dist/fable_modules/fable-library.4.5.0/TimeSpan.d.ts +34 -0
  152. package/dist/fable_modules/fable-library.4.5.0/TimeSpan.js +177 -0
  153. package/dist/fable_modules/fable-library.4.5.0/Timer.d.ts +19 -0
  154. package/dist/fable_modules/fable-library.4.5.0/Timer.js +67 -0
  155. package/dist/fable_modules/fable-library.4.5.0/Types.d.ts +58 -0
  156. package/dist/fable_modules/fable-library.4.5.0/Types.js +208 -0
  157. package/dist/fable_modules/fable-library.4.5.0/Unicode.13.0.0.d.ts +2 -0
  158. package/dist/fable_modules/fable-library.4.5.0/Unicode.13.0.0.js +4 -0
  159. package/dist/fable_modules/fable-library.4.5.0/Uri.d.ts +29 -0
  160. package/dist/fable_modules/fable-library.4.5.0/Uri.js +142 -0
  161. package/dist/fable_modules/fable-library.4.5.0/Util.d.ts +207 -0
  162. package/dist/fable_modules/fable-library.4.5.0/Util.js +781 -0
  163. package/dist/fable_modules/fable-library.4.5.0/lib/big.d.ts +5 -0
  164. package/dist/fable_modules/fable-library.4.5.0/lib/big.js +826 -0
  165. package/dist/fable_modules/fable-library.4.5.0/package.json +23 -0
  166. package/dist/fable_modules/project_cracked.json +1 -0
  167. package/package.json +37 -0
@@ -0,0 +1,452 @@
1
+ import { toString } from "../fable_modules/fable-library.4.5.0/Types.js";
2
+ import { StringBuilder__AppendLine, StringBuilder__Append_Z721C83C5, StringBuilder_$ctor } from "../fable_modules/fable-library.4.5.0/System.Text.js";
3
+ import { class_type } from "../fable_modules/fable-library.4.5.0/Reflection.js";
4
+ import { max } from "../fable_modules/fable-library.4.5.0/Double.js";
5
+ import { interpolate, toText, printf, toFail, join, isNullOrWhiteSpace, replicate } from "../fable_modules/fable-library.4.5.0/String.js";
6
+ import { tail as tail_1, head, iterateIndexed, isEmpty, map, length, iterate } from "../fable_modules/fable-library.4.5.0/List.js";
7
+ import { isDigit2 } from "../fable_modules/fable-library.4.5.0/Char.js";
8
+ import { replace, removeSingleQuote, removeDoubleQuote, capitalizeFirstLetter } from "./Utils/String.js";
9
+ import { iterate as iterate_1 } from "../fable_modules/fable-library.4.5.0/Seq.js";
10
+ import { map as map_1, toArray } from "../fable_modules/fable-library.4.5.0/Option.js";
11
+ import { success } from "./Log.js";
12
+
13
+ export class Printer {
14
+ constructor() {
15
+ this.buffer = StringBuilder_$ctor();
16
+ this.indentationLevel = 0;
17
+ this.indentationText = " ";
18
+ }
19
+ toString() {
20
+ const __ = this;
21
+ return toString(__.buffer);
22
+ }
23
+ }
24
+
25
+ export function Printer_$reflection() {
26
+ return class_type("Glutinum.Converter.Printer.Printer", void 0, Printer);
27
+ }
28
+
29
+ export function Printer_$ctor() {
30
+ return new Printer();
31
+ }
32
+
33
+ export function Printer__get_Indent(__) {
34
+ __.indentationLevel = ((__.indentationLevel + 1) | 0);
35
+ }
36
+
37
+ export function Printer__get_Unindent(__) {
38
+ __.indentationLevel = (max(__.indentationLevel - 1, 0) | 0);
39
+ }
40
+
41
+ /**
42
+ * Write the provided text prefixed with indentation
43
+ */
44
+ export function Printer__Write_Z721C83C5(__, text) {
45
+ StringBuilder__Append_Z721C83C5(__.buffer, replicate(__.indentationLevel, __.indentationText) + text);
46
+ }
47
+
48
+ /**
49
+ * Write the provided text directly in the buffer
50
+ *
51
+ * Useful when you don't want to prefix the text with indentation
52
+ */
53
+ export function Printer__WriteInline_Z721C83C5(__, text) {
54
+ StringBuilder__Append_Z721C83C5(__.buffer, text);
55
+ }
56
+
57
+ export function Printer__get_NewLine(__) {
58
+ StringBuilder__AppendLine(__.buffer);
59
+ }
60
+
61
+ export function printOutFile(printer, outFile) {
62
+ Printer__Write_Z721C83C5(printer, `module rec ${outFile.Name}`);
63
+ Printer__get_NewLine(printer);
64
+ Printer__get_NewLine(printer);
65
+ iterate((o) => {
66
+ Printer__Write_Z721C83C5(printer, `open ${o}`);
67
+ Printer__get_NewLine(printer);
68
+ }, outFile.Opens);
69
+ }
70
+
71
+ export function Naming_$007CDigit$007C_$007C(digit) {
72
+ if (isNullOrWhiteSpace(digit)) {
73
+ return void 0;
74
+ }
75
+ else if (isDigit2(digit, 0)) {
76
+ return digit;
77
+ }
78
+ else {
79
+ return void 0;
80
+ }
81
+ }
82
+
83
+ function sanitizeEnumCaseName(name) {
84
+ const name_1 = capitalizeFirstLetter(removeDoubleQuote(removeSingleQuote(name)));
85
+ if (Naming_$007CDigit$007C_$007C(name_1) != null) {
86
+ return `\`\`${name_1}\`\``;
87
+ }
88
+ else {
89
+ return name_1;
90
+ }
91
+ }
92
+
93
+ export function attributeToText(fsharpAttribute) {
94
+ switch (fsharpAttribute.tag) {
95
+ case 1:
96
+ return "[<Emit(\"$0($1...)\")>]";
97
+ case 2:
98
+ return `[<Import("${fsharpAttribute.fields[0]}", "${fsharpAttribute.fields[1]}")>]`;
99
+ case 4:
100
+ return "[<Erase>]";
101
+ case 5:
102
+ return "[<AllowNullLiteral>]";
103
+ case 6: {
104
+ const caseRules = fsharpAttribute.fields[0] | 0;
105
+ return `[<StringEnum(${(caseRules === 0) ? "CaseRules.None" : ((caseRules === 1) ? "CaseRules.LowerFirst" : ((caseRules === 2) ? "CaseRules.SnakeCase" : ((caseRules === 3) ? "CaseRules.SnakeCaseAllCaps" : ((caseRules === 4) ? "CaseRules.KebabCase" : (() => {
106
+ throw new Error("Unsupported case rules: %A{caseRules}");
107
+ })()))))})>]`;
108
+ }
109
+ case 7:
110
+ return `[<CompiledName("${fsharpAttribute.fields[0]}")>]`;
111
+ case 8:
112
+ return "[<RequireQualifiedAccess>]";
113
+ case 9:
114
+ return "[<EmitConstructor>]";
115
+ case 10:
116
+ return `[<Emit("new $0.${fsharpAttribute.fields[0]}($1...)")>]`;
117
+ case 3:
118
+ return `[<ImportAll("${fsharpAttribute.fields[0]}")>]`;
119
+ case 11:
120
+ return "[<EmitIndexer>]";
121
+ default:
122
+ return fsharpAttribute.fields[0];
123
+ }
124
+ }
125
+
126
+ function printInlineAttribute(printer, fsharpAttribute) {
127
+ Printer__WriteInline_Z721C83C5(printer, attributeToText(fsharpAttribute));
128
+ Printer__WriteInline_Z721C83C5(printer, " ");
129
+ }
130
+
131
+ function printInlineAttributes(printer, fsharpAttributes) {
132
+ if (length(fsharpAttributes) > 0) {
133
+ Printer__WriteInline_Z721C83C5(printer, replace(">][<", "; ", join("", map(attributeToText, fsharpAttributes))));
134
+ Printer__WriteInline_Z721C83C5(printer, " ");
135
+ }
136
+ }
137
+
138
+ function printCompactAttributesAndNewLine(printer, fsharpAttributes) {
139
+ if (length(fsharpAttributes) > 0) {
140
+ Printer__Write_Z721C83C5(printer, replace(">][<", "; ", join("", map(attributeToText, fsharpAttributes))));
141
+ Printer__get_NewLine(printer);
142
+ }
143
+ }
144
+
145
+ export function printAttributes(printer, fsharpAttributes) {
146
+ iterate((fsharpAttribute) => {
147
+ Printer__Write_Z721C83C5(printer, attributeToText(fsharpAttribute));
148
+ Printer__get_NewLine(printer);
149
+ }, fsharpAttributes);
150
+ }
151
+
152
+ function printType(fsharpType) {
153
+ switch (fsharpType.tag) {
154
+ case 1: {
155
+ const info_1 = fsharpType.fields[0];
156
+ return `${info_1.Name}<${join(", ", map((c) => c.Name, info_1.Cases))}>${info_1.IsOptional ? " option" : ""}`;
157
+ }
158
+ case 0:
159
+ return fsharpType.fields[0].Name;
160
+ case 7: {
161
+ const info_3 = fsharpType.fields[0];
162
+ switch (info_3.tag) {
163
+ case 1:
164
+ return "int";
165
+ case 2:
166
+ return "float";
167
+ case 3:
168
+ return "bool";
169
+ case 4:
170
+ return "unit";
171
+ case 5:
172
+ return "float";
173
+ case 6:
174
+ return "obj";
175
+ default:
176
+ return "string";
177
+ }
178
+ }
179
+ case 10:
180
+ return fsharpType.fields[0].Name;
181
+ case 11:
182
+ return `'${fsharpType.fields[0]}`;
183
+ case 2:
184
+ return printType(fsharpType.fields[0]) + " option";
185
+ case 12:
186
+ return `ResizeArray<${printType(fsharpType.fields[0])}>`;
187
+ case 3:
188
+ case 4:
189
+ case 5:
190
+ case 8:
191
+ case 9:
192
+ return "obj";
193
+ default:
194
+ return fsharpType.fields[0].Name;
195
+ }
196
+ }
197
+
198
+ function printTypeParameters(printer, typeParameters) {
199
+ if (!isEmpty(typeParameters)) {
200
+ Printer__WriteInline_Z721C83C5(printer, "<");
201
+ iterateIndexed((index, typeParameter) => {
202
+ if (index !== 0) {
203
+ Printer__WriteInline_Z721C83C5(printer, ", ");
204
+ }
205
+ Printer__WriteInline_Z721C83C5(printer, "\'");
206
+ Printer__WriteInline_Z721C83C5(printer, typeParameter.Name);
207
+ }, typeParameters);
208
+ Printer__WriteInline_Z721C83C5(printer, ">");
209
+ }
210
+ }
211
+
212
+ function printInterface(printer, interfaceInfo) {
213
+ printAttributes(printer, interfaceInfo.Attributes);
214
+ Printer__Write_Z721C83C5(printer, `type ${interfaceInfo.Name}`);
215
+ printTypeParameters(printer, interfaceInfo.TypeParameters);
216
+ Printer__WriteInline_Z721C83C5(printer, " =");
217
+ Printer__get_NewLine(printer);
218
+ Printer__get_Indent(printer);
219
+ iterate((_arg) => {
220
+ if (_arg.tag === 1) {
221
+ const propertyInfo = _arg.fields[0];
222
+ printAttributes(printer, propertyInfo.Attributes);
223
+ if (propertyInfo.IsStatic) {
224
+ Printer__Write_Z721C83C5(printer, "static ");
225
+ }
226
+ else {
227
+ Printer__Write_Z721C83C5(printer, "abstract ");
228
+ }
229
+ Printer__WriteInline_Z721C83C5(printer, `member ${propertyInfo.Name}`);
230
+ if (propertyInfo.IsStatic) {
231
+ iterate_1((text) => {
232
+ Printer__WriteInline_Z721C83C5(printer, text);
233
+ }, toArray(map_1((_arg_1) => {
234
+ switch (_arg_1.tag) {
235
+ case 1:
236
+ return toFail(printf(" with set "));
237
+ case 2:
238
+ return toFail(printf(" with get, set "));
239
+ default:
240
+ return " with get () ";
241
+ }
242
+ }, propertyInfo.Accessor)));
243
+ Printer__WriteInline_Z721C83C5(printer, `: ${printType(propertyInfo.Type)}`);
244
+ Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
245
+ }
246
+ else {
247
+ iterateIndexed((index_2, p_2) => {
248
+ if (index_2 === 0) {
249
+ Printer__WriteInline_Z721C83C5(printer, ": ");
250
+ }
251
+ else {
252
+ Printer__WriteInline_Z721C83C5(printer, " -> ");
253
+ }
254
+ const option_3 = p_2.IsOptional ? " option" : "";
255
+ Printer__WriteInline_Z721C83C5(printer, `${p_2.Name}: ${printType(p_2.Type)}${option_3}`);
256
+ }, propertyInfo.Parameters);
257
+ if (length(propertyInfo.Parameters) > 0) {
258
+ Printer__WriteInline_Z721C83C5(printer, " -> ");
259
+ }
260
+ else {
261
+ Printer__WriteInline_Z721C83C5(printer, ": ");
262
+ }
263
+ Printer__WriteInline_Z721C83C5(printer, `${printType(propertyInfo.Type)}`);
264
+ if (propertyInfo.IsOptional) {
265
+ Printer__WriteInline_Z721C83C5(printer, " option");
266
+ }
267
+ iterate_1((text_1) => {
268
+ Printer__WriteInline_Z721C83C5(printer, text_1);
269
+ }, toArray(map_1((_arg_2) => {
270
+ switch (_arg_2.tag) {
271
+ case 1:
272
+ return " with set";
273
+ case 2:
274
+ return " with get, set";
275
+ default:
276
+ return " with get";
277
+ }
278
+ }, propertyInfo.Accessor)));
279
+ }
280
+ Printer__get_NewLine(printer);
281
+ }
282
+ else {
283
+ const methodInfo = _arg.fields[0];
284
+ printCompactAttributesAndNewLine(printer, methodInfo.Attributes);
285
+ if (methodInfo.IsStatic) {
286
+ Printer__Write_Z721C83C5(printer, "static ");
287
+ }
288
+ else {
289
+ Printer__Write_Z721C83C5(printer, "abstract ");
290
+ }
291
+ Printer__WriteInline_Z721C83C5(printer, `member ${methodInfo.Name}`);
292
+ if (methodInfo.IsStatic) {
293
+ Printer__WriteInline_Z721C83C5(printer, " ");
294
+ if (length(methodInfo.Parameters) === 0) {
295
+ Printer__WriteInline_Z721C83C5(printer, "()");
296
+ }
297
+ else {
298
+ Printer__WriteInline_Z721C83C5(printer, "(");
299
+ iterateIndexed((index, p) => {
300
+ if (index !== 0) {
301
+ Printer__WriteInline_Z721C83C5(printer, ", ");
302
+ }
303
+ if (p.IsOptional) {
304
+ Printer__WriteInline_Z721C83C5(printer, "?");
305
+ }
306
+ Printer__WriteInline_Z721C83C5(printer, `${p.Name}: ${printType(p.Type)}`);
307
+ }, methodInfo.Parameters);
308
+ Printer__WriteInline_Z721C83C5(printer, ")");
309
+ }
310
+ }
311
+ else {
312
+ Printer__WriteInline_Z721C83C5(printer, ": ");
313
+ if (length(methodInfo.Parameters) === 0) {
314
+ Printer__WriteInline_Z721C83C5(printer, "unit");
315
+ }
316
+ else {
317
+ iterateIndexed((index_1, p_1) => {
318
+ if (index_1 !== 0) {
319
+ Printer__WriteInline_Z721C83C5(printer, " * ");
320
+ }
321
+ const option = p_1.IsOptional ? " option" : "";
322
+ Printer__WriteInline_Z721C83C5(printer, `${p_1.Name}: ${printType(p_1.Type)}${option}`);
323
+ }, methodInfo.Parameters);
324
+ }
325
+ }
326
+ if (methodInfo.IsStatic) {
327
+ Printer__WriteInline_Z721C83C5(printer, " : ");
328
+ }
329
+ else {
330
+ Printer__WriteInline_Z721C83C5(printer, " -> ");
331
+ }
332
+ Printer__WriteInline_Z721C83C5(printer, printType(methodInfo.Type));
333
+ if (methodInfo.IsStatic) {
334
+ Printer__WriteInline_Z721C83C5(printer, " = nativeOnly");
335
+ }
336
+ Printer__get_NewLine(printer);
337
+ }
338
+ }, interfaceInfo.Members);
339
+ if (length(interfaceInfo.Members) === 0) {
340
+ Printer__Write_Z721C83C5(printer, "interface end");
341
+ Printer__get_NewLine(printer);
342
+ }
343
+ Printer__get_Unindent(printer);
344
+ }
345
+
346
+ function printEnum(printer, enumInfo) {
347
+ Printer__Write_Z721C83C5(printer, "[<RequireQualifiedAccess>]");
348
+ Printer__get_NewLine(printer);
349
+ Printer__Write_Z721C83C5(printer, `type ${enumInfo.Name} =`);
350
+ Printer__get_NewLine(printer);
351
+ Printer__get_Indent(printer);
352
+ iterate((enumCaseInfo) => {
353
+ const enumCaseName = sanitizeEnumCaseName(enumCaseInfo.Name);
354
+ const matchValue = enumCaseInfo.Value;
355
+ switch (matchValue.tag) {
356
+ case 3:
357
+ case 0:
358
+ case 2: {
359
+ break;
360
+ }
361
+ default:
362
+ Printer__Write_Z721C83C5(printer, `| ${enumCaseName} = ${matchValue.fields[0]}`);
363
+ }
364
+ Printer__get_NewLine(printer);
365
+ }, enumInfo.Cases);
366
+ Printer__get_Unindent(printer);
367
+ }
368
+
369
+ function printTypeAlias(printer, aliasInfo) {
370
+ Printer__Write_Z721C83C5(printer, `type ${aliasInfo.Name}`);
371
+ printTypeParameters(printer, aliasInfo.TypeParameters);
372
+ Printer__WriteInline_Z721C83C5(printer, " =");
373
+ Printer__get_NewLine(printer);
374
+ Printer__get_Indent(printer);
375
+ Printer__Write_Z721C83C5(printer, printType(aliasInfo.Type));
376
+ Printer__get_NewLine(printer);
377
+ Printer__get_Unindent(printer);
378
+ }
379
+
380
+ export function print(printer_mut, fsharpTypes_mut) {
381
+ print:
382
+ while (true) {
383
+ const printer = printer_mut, fsharpTypes = fsharpTypes_mut;
384
+ if (isEmpty(fsharpTypes)) {
385
+ success("Done");
386
+ }
387
+ else {
388
+ const fsharpType = head(fsharpTypes);
389
+ Printer__get_NewLine(printer);
390
+ switch (fsharpType.tag) {
391
+ case 0: {
392
+ printEnum(printer, fsharpType.fields[0]);
393
+ break;
394
+ }
395
+ case 4: {
396
+ printInterface(printer, fsharpType.fields[0]);
397
+ break;
398
+ }
399
+ case 5: {
400
+ Printer__Write_Z721C83C5(printer, toText(interpolate("obj // Unsupported syntax kind: %A%P()", [fsharpType.fields[0]])));
401
+ Printer__get_NewLine(printer);
402
+ break;
403
+ }
404
+ case 3: {
405
+ const moduleInfo = fsharpType.fields[0];
406
+ Printer__Write_Z721C83C5(printer, "module ");
407
+ if (moduleInfo.IsRecursive) {
408
+ Printer__Write_Z721C83C5(printer, "rec ");
409
+ }
410
+ Printer__Write_Z721C83C5(printer, `${moduleInfo.Name} =`);
411
+ Printer__get_NewLine(printer);
412
+ Printer__get_Indent(printer);
413
+ print(printer, moduleInfo.Types);
414
+ break;
415
+ }
416
+ case 8: {
417
+ printTypeAlias(printer, fsharpType.fields[0]);
418
+ break;
419
+ }
420
+ case 6:
421
+ case 7:
422
+ case 10:
423
+ case 2:
424
+ case 12:
425
+ case 11:
426
+ case 9: {
427
+ break;
428
+ }
429
+ default: {
430
+ const unionInfo = fsharpType.fields[0];
431
+ printAttributes(printer, unionInfo.Attributes);
432
+ Printer__Write_Z721C83C5(printer, `type ${unionInfo.Name} =`);
433
+ Printer__get_NewLine(printer);
434
+ Printer__get_Indent(printer);
435
+ iterate((enumCaseInfo) => {
436
+ Printer__Write_Z721C83C5(printer, "| ");
437
+ printInlineAttributes(printer, enumCaseInfo.Attributes);
438
+ Printer__WriteInline_Z721C83C5(printer, enumCaseInfo.Name);
439
+ Printer__get_NewLine(printer);
440
+ }, unionInfo.Cases);
441
+ Printer__get_Unindent(printer);
442
+ }
443
+ }
444
+ printer_mut = printer;
445
+ fsharpTypes_mut = tail_1(fsharpTypes);
446
+ continue print;
447
+ }
448
+ break;
449
+ }
450
+ }
451
+
452
+ //# sourceMappingURL=Printer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Glutinum.Converter/Printer.fs"],"names":["__","text","Write","printer","outFile","NewLine","o","digit","name","(|Digit|_|)","fsharpAttribute","caseRules","WriteInline","attributeToText","fsharpAttributes","fsharpType","info","c","printType","typeParameters","index","typeParameter","printAttributes","interfaceInfo","printTypeParameters","Indent","_arg1","propertyInfo","_arg2","option","p","_arg3","methodInfo","printCompactAttributesAndNewLine","Unindent","enumInfo","enumCaseName","sanitizeEnumCaseName","enumCaseInfo","matchValue","aliasInfo","fsharpTypes","printEnum","printInterface","moduleInfo","print","printTypeAlias","unionInfo","printInlineAttributes"],"mappings":";;;;;;;;;;;;;;AAQI,sBAAa;AACb,gCAA\u002BB;AAC/B,\u002BBAAsB;;;AA0BbA,mBAAAA;AAAgB,eAAA,SAAA,AAAAA;;;;;;;;;;;;;AAxBN,AAAAA,4BAAoB,AAAAA,sBAAmB;;;;AAItD,AAAAA,2BAAoB,IAAgB,AAAAA,sBAAmB,GAAG;;;;;;;AAM1D,oCAAA,AAAAA,WAAc,UAAiB,AAAAA,qBAAiB,AAAAA,sBAAkBC;;;;;;;;;AAUhC,oCAAA,AAAAD,WAAcC;;;;AAEhC,8BAAA,AAAAD;;;;AAKpB,AAAAE,6BAAAC,SAAc,cAAc,AAAAC;AAC5B,AAAAC,yBAAAF;AACA,AAAAE,yBAAAF;AAGG;AACC,AAAAD,iCAAAC,SAAc,QAAQG;AACtB,AAAAD,6BAAAF;OAHJ,AAAAC;;;;AAQI,QAAG,mBAA0BG;AACzB,eAAA;;SACJ,IAAK,SAAaA,OAAO;eAChBA;;;AAEL,eAAA;;;;;AAGJC,mBAIG,sBADA,kBADA,kBADHA;AAMF,QADI,AACJ,AAAAC,6BADID;eAGF,OAAKA;;;eACFA;;;;;YAGDE;;mBAE8B;;mBAEhC,aAAA,AAAAA,gCAAA,AAAAA;;mBACuB;;mBACW;;AACTC,8BACrB,AAAAD;mBASJ,g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AE,mCAAe3C,SAAf,AAAAY;;;;;;;;;;;;;AA/CjBgC,sCACf,AAAAhC;AAAA,AAAAO,oCAAgBnB,SAAQ,AAAA4C;AAExB,AAAA7C,6CAAAC,SAAc,QAAQ,AAAA4C;AACtB,AAAA1C,yCAAAF;AACA,AAAAsB,wCAAAtB;AAGG;AACC,AAAAD,iDAAAC,SAAc;AAEd,AAAA6C,8CAAsB7C,SAAQ,AAAAmC;AAE9B,AAAA1B,uDAAAT,SAAoB,AAAAmC;AAEpB,AAAAjC,6CAAAF;uBARJ,AAAA4C;AAWA,AAAAb,0CAAA/B;;;0BAuCEA;8BA5DN,OAAAsC;AA4DA","file":null,"sourcesContent":null,"sourceRoot":null}
@@ -0,0 +1,10 @@
1
+ import { typeScriptReader } from "./Reader/TypeScriptReader.js";
2
+ import { ofSeq, map } from "../fable_modules/fable-library.4.5.0/List.js";
3
+ import { value } from "../fable_modules/fable-library.4.5.0/Option.js";
4
+
5
+ export function readSourceFile(checker, sourceFile) {
6
+ const reader = typeScriptReader(checker);
7
+ return map((node) => reader["Glutinum.Converter.Reader.Types.TypeScriptReader.ReadNode6C0FD055"](node), ofSeq(value(sourceFile).statements));
8
+ }
9
+
10
+ //# sourceMappingURL=Read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Glutinum.Converter/Read.fs"],"names":["reader","checker","node","sourceFile"],"mappings":";;;;;AAQQA,mBAAS,iBAAyCC;AAET,WAAA,cAAS,AAAAD,4EAAAE,OAAvB,MAA/B,MAAAC","file":null,"sourcesContent":null,"sourceRoot":null}
@@ -0,0 +1,28 @@
1
+ import { empty, map, choose, partition } from "../../fable_modules/fable-library.4.5.0/List.js";
2
+ import { toList } from "../../fable_modules/fable-library.4.5.0/Seq.js";
3
+ import { GlueClassDeclaration, GlueConstructor } from "../GlueAST.js";
4
+
5
+ export function readClassDeclaration(reader, classDeclaration) {
6
+ const name = classDeclaration.name;
7
+ const patternInput = partition((m) => {
8
+ if (m.kind === 176) {
9
+ return true;
10
+ }
11
+ else {
12
+ return false;
13
+ }
14
+ }, toList(classDeclaration.members));
15
+ const constructors_1 = choose((m_1) => {
16
+ if (m_1.kind === 176) {
17
+ const constructor = m_1;
18
+ return new GlueConstructor(reader["Glutinum.Converter.Reader.Types.TypeScriptReader.ReadParametersZ17143B5B"](constructor.parameters));
19
+ }
20
+ else {
21
+ return void 0;
22
+ }
23
+ }, patternInput[0]);
24
+ const members_2 = map((declaration) => reader["Glutinum.Converter.Reader.Types.TypeScriptReader.ReadNamedDeclaration2A58F896"](declaration), toList(patternInput[1]));
25
+ return new GlueClassDeclaration(name.getText(), constructors_1, members_2, empty());
26
+ }
27
+
28
+ //# sourceMappingURL=ClassDeclaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/Glutinum.Converter/Reader/ClassDeclaration.fs"],"names":["name","classDeclaration","patternInput","m","constructors","constructor","reader","members","declaration"],"mappings":";;;;;AAYQA,iBAA4B,AAAAC;AAI5BC,yBAEG;AACO,YAAA,AAAAC,WAAA;mBACyB;;;mBACxB;;OAP2B,OAA5B,AAAAF;AAUVG,2BAEG;AACO,YAAA,AAAAD,aAAA;AAEEE,gCAAcF;AAGf,mBAAA,oBADH,AAAAG,mFAAsB,AAAAD;;;AAInB,mBAAA;;OAnBX,AAAAH;AAsBAK,sBAAmC,qBAAS,AAAAD,wFAAAE,cAAvB,OAtBrB,AAAAN;AAwBJ,WAAA,yBACW,AAAAF,gBACQI,gBACLG,WACO","file":null,"sourcesContent":null,"sourceRoot":null}
@@ -0,0 +1,72 @@
1
+ import { tryReadLiteral } from "./Utils.js";
2
+ import { GlueEnum, GlueEnumMember, GlueLiteral } from "../GlueAST.js";
3
+ import { fold, ofSeq, empty, singleton, append } from "../../fable_modules/fable-library.4.5.0/List.js";
4
+ import { uncurry2 } from "../../fable_modules/fable-library.4.5.0/Util.js";
5
+
6
+ function readEnumMembers(checker, state, enumMember) {
7
+ let num, str;
8
+ let caseValue;
9
+ const matchValue = enumMember.initializer;
10
+ if (matchValue != null) {
11
+ const matchValue_2 = tryReadLiteral(matchValue);
12
+ if (matchValue_2 == null) {
13
+ throw new Error("readEnumCases: Unsupported enum initializer");
14
+ }
15
+ else {
16
+ const glueLiteral = matchValue_2;
17
+ let matchResult, value;
18
+ switch (glueLiteral.tag) {
19
+ case 1: {
20
+ matchResult = 0;
21
+ value = glueLiteral;
22
+ break;
23
+ }
24
+ case 2: {
25
+ matchResult = 0;
26
+ value = glueLiteral;
27
+ break;
28
+ }
29
+ case 3: {
30
+ matchResult = 1;
31
+ break;
32
+ }
33
+ default: {
34
+ matchResult = 0;
35
+ value = glueLiteral;
36
+ }
37
+ }
38
+ switch (matchResult) {
39
+ case 0: {
40
+ caseValue = value;
41
+ break;
42
+ }
43
+ default:
44
+ throw new Error("Boolean literals are not supported in enums");
45
+ }
46
+ }
47
+ }
48
+ else {
49
+ const matchValue_1 = checker.getConstantValue(enumMember);
50
+ caseValue = ((matchValue_1 == null) ? (new GlueLiteral(1, [state.NextCaseIndex])) : ((typeof matchValue_1 === "number") ? ((num = matchValue_1, Number.isSafeInteger(num) ? (new GlueLiteral(1, [~~num])) : (new GlueLiteral(2, [num])))) : ((str = matchValue_1, new GlueLiteral(0, [str])))));
51
+ }
52
+ const name = enumMember.name;
53
+ const NextCaseIndex = ((caseValue.tag === 1) ? (caseValue.fields[0] + 1) : (state.NextCaseIndex + 1)) | 0;
54
+ return {
55
+ Members: append(state.Members, singleton(new GlueEnumMember(name.getText(), caseValue))),
56
+ NextCaseIndex: NextCaseIndex,
57
+ };
58
+ }
59
+
60
+ export function readEnumDeclaration(reader, enumDeclaration) {
61
+ let checker;
62
+ const initialState = {
63
+ Members: empty(),
64
+ NextCaseIndex: 0,
65
+ };
66
+ let readEnumResults;
67
+ const list = ofSeq(enumDeclaration.members);
68
+ readEnumResults = fold(uncurry2((checker = reader["Glutinum.Converter.Reader.Types.TypeScriptReader.get_checker"](), (state) => ((enumMember) => readEnumMembers(checker, state, enumMember)))), initialState, list);
69
+ return new GlueEnum(enumDeclaration.name.getText(), readEnumResults.Members);
70
+ }
71
+
72
+ //# sourceMappingURL=EnumDeclaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/Glutinum.Converter/Reader/EnumDeclaration.fs"],"names":["num","str","caseValue","matchValue","enumMember","glueLiteral","value","checker","state","name","NextCaseIndex","initialState","readEnumResults","list","enumDeclaration","reader","readEnumMembers"],"mappings":";;;;;;QAyB4BA,KADAC;AAJpBC;AACMC,uBAAA,AAAAC;AAAA,QAAA,AAAAD;AAWIA,6BAAA,eAAAA;AAAA,YAAA,AAAAA;AASI,4BAAS;;;AARZE,gCACGF;6BAGmBG;oBAHnBD;;;AAGmBC,4BAHnBD;;;;;AAGmBC,4BAHnBD;;;;;;;;;AAGmBC,4BAHnBD;;;;;AAddH,gCAiB0CI;;;;AAE9B,oCAAS;;;;;AAhBXH,6BAAA,AAAAI,yBAA4BH;AAA5B,AAHVF,qBAGU,CAAA,AAAAC,yBAOI,oBAAgB,AAAAK,0BAPpB,CAAA,OACJL,\u002BBACcH,MADdG,cAEE,AAAG,qBAAkCH,QACjC,sBAAoBA,UAEpB,oBAAkBA,aALVC,MAAdE,cAAsB,oBAAmBF;;AAmB/CQ,iBAA4B,AAAAL;AAWlBM,2BAAA,CAAA,AAAAR,wBAKiB,AAAAA,sBAAI,MAGpB,AAAAM,sBAAsB;;iBACvB,OAAA,AAAAA,eAAgB,UAjB1B,mBACW,AAAAC,gBACCP;uBAMFQ;;;;;QA0BIH;AATdI;iBAGc;uBADM;;AAIpBC;AAGGC,iBADA,MADH,AAAAC;AAEG,AAHHF,sBAGG,eAAWL,UAAgB,AAAAQ,sGAAhB,AAAAC,gBAAAT,SAAAC,OAAAJ,gBAAXO,cAAAE;AAEP,WAAA,aACW,AAAAC,gCACG,AAAAF","file":null,"sourcesContent":null,"sourceRoot":null}
@@ -0,0 +1,11 @@
1
+ import { exists } from "../../fable_modules/fable-library.4.5.0/Seq.js";
2
+ import { GlueFunctionDeclaration } from "../GlueAST.js";
3
+
4
+ export function readFunctionDeclaration(reader, declaration) {
5
+ let matchValue, matchValue_1, name;
6
+ return new GlueFunctionDeclaration((matchValue = declaration.modifiers, (matchValue == null) ? false : exists((modifier) => (modifier.kind === 138), matchValue)), (matchValue_1 = declaration.name, (matchValue_1 == null) ? (() => {
7
+ throw new Error("readFunctionDeclaration: Missing name");
8
+ })() : ((name = matchValue_1, name.getText()))), reader["Glutinum.Converter.Reader.Types.TypeScriptReader.ReadTypeNodeZ64B23DD2"](declaration.type), reader["Glutinum.Converter.Reader.Types.TypeScriptReader.ReadParametersZ17143B5B"](declaration.parameters));
9
+ }
10
+
11
+ //# sourceMappingURL=FunctionDeclaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/Glutinum.Converter/Reader/FunctionDeclaration.fs"],"names":["matchValue","name","declaration","modifier","reader"],"mappings":";;;;QAccA,YASAA,cACCC;WAGX,6BAbUD,aAAA,AAAAE,uBAAA,CAAA,AAAAF,sBAMI,QAHH,sBACC,AAAAG,kBAAgB,MAFpBH,eAOEA,eAAA,AAAAE,kBAAA,CAAA,AAAAF;AAEI,wBAAS;aADZC,OAAQD,cAAA,AAAAC,mBAMR,AAAAG,iFAAoB,AAAAF,mBACd,AAAAE,mFAAsB,AAAAF","file":null,"sourcesContent":null,"sourceRoot":null}
@@ -0,0 +1,9 @@
1
+ import { GlueType } from "../GlueAST.js";
2
+
3
+ export function readIndexedAccessType(reader, declaration) {
4
+ let typeOperatorNode;
5
+ const nodeType = declaration.indexType;
6
+ return new GlueType(10, [(nodeType.kind === 198) ? ((typeOperatorNode = declaration.indexType, reader["Glutinum.Converter.Reader.Types.TypeScriptReader.ReadTypeOperatorNodeZ6830FC33"](typeOperatorNode))) : (new GlueType(0, []))]);
7
+ }
8
+
9
+ //# sourceMappingURL=IndexedAccessType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/Glutinum.Converter/Reader/IndexedAccessType.fs"],"names":["typeOperatorNode","nodeType","declaration","reader"],"mappings":";;;QAiBgBA;AALRC,qBAAW,AAAAC;AAaf,WAAA,kBAVU,CAAA,AAAAD,kBAAA,SAEED,mBAAmB,AAAAE,uBACvB,AAAAC,yFAA4BH,uBAK5B","file":null,"sourcesContent":null,"sourceRoot":null}
@@ -0,0 +1,10 @@
1
+ import { empty, map } from "../../fable_modules/fable-library.4.5.0/List.js";
2
+ import { toList } from "../../fable_modules/fable-library.4.5.0/Seq.js";
3
+ import { GlueInterface } from "../GlueAST.js";
4
+
5
+ export function readInterfaceDeclaration(reader, declaration) {
6
+ const members = map((declaration_1) => reader["Glutinum.Converter.Reader.Types.TypeScriptReader.ReadNamedDeclaration2A58F896"](declaration_1), toList(declaration.members));
7
+ return new GlueInterface(declaration.name.getText(), members, empty());
8
+ }
9
+
10
+ //# sourceMappingURL=InterfaceDeclaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/Glutinum.Converter/Reader/InterfaceDeclaration.fs"],"names":["members","reader","declaration"],"mappings":";;;;;AAYQA,oBAGG,uBAAS,AAAAC,wFAAAC,gBADT,OADH,AAAAA;AAIJ,WAAA,kBACW,AAAAA,4BACGF,SACO","file":null,"sourcesContent":null,"sourceRoot":null}
@@ -0,0 +1,23 @@
1
+ import { choose, concat, toList, exists } from "../../fable_modules/fable-library.4.5.0/Seq.js";
2
+ import { ofSeq, map } from "../../fable_modules/fable-library.4.5.0/List.js";
3
+ import { GlueModuleDeclaration } from "../GlueAST.js";
4
+
5
+ export function readModuleDeclaration(reader, declaration) {
6
+ const name = declaration.name;
7
+ const children = declaration.getChildren();
8
+ const isNamespace = exists((node) => (node.kind === 145), children);
9
+ const types = toList(concat(choose((child) => {
10
+ const matchValue = child.kind | 0;
11
+ switch (matchValue) {
12
+ case 268: {
13
+ const moduleBlock = child;
14
+ return map((node_1) => reader["Glutinum.Converter.Reader.Types.TypeScriptReader.ReadNode6C0FD055"](node_1), ofSeq(moduleBlock.statements));
15
+ }
16
+ default:
17
+ return void 0;
18
+ }
19
+ }, children)));
20
+ return new GlueModuleDeclaration(name.getText(), isNamespace, false, types);
21
+ }
22
+
23
+ //# sourceMappingURL=ModuleDeclaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/Glutinum.Converter/Reader/ModuleDeclaration.fs"],"names":["name","declaration","children","isNamespace","node","types","matchValue","child","moduleBlock","reader"],"mappings":";;;;;AAYQA,iBAA4B,AAAAC;AAC5BC,qBAAW,AAAAD;AAEXE,wBAEG,kBAAwB,AAAAC,cAAY,MADvCF;AAGAG,kBAgBG,OADA,OAbA;AACOC,2BAAA,AAAAC;gBAAAD;iBAAA;AAEEE,oCAAcD;AAIf,uBAAA,gBAAS,AAAAE,4EAAAL,SADT,MADH,AAAAI;;;AAMG,uBAAA;;OAZXN;AAiBJ,WAAA,0BACW,AAAAF,gBACOG,aACA,OACNE","file":null,"sourcesContent":null,"sourceRoot":null}