@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,704 @@
1
+
2
+ import { Record } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
3
+ import { importAllAttribute, TransformContext__get_TypeMemory, TransformContext__get_State, sanitizeNameAndPushScope, importAttribute, TransformContext__PushScope_27AED5E3, sanitizeMemberNameAndPushScope, TransformContext__get_ImportSource, importDefaultAttribute, TransformContext_$reflection } from "./Context.js";
4
+ import { GlueFunctionDeclaration, GlueVariable, GlueType__get_Name, GlueType, GlueConstructor, GlueFunctionDeclaration_$reflection, GlueTypeParameter_$reflection, GlueParameter_$reflection, GlueType_$reflection } from "../GlueAST.js";
5
+ import { FSharpInterface, FSharpAccessor, FSharpMapped, FSharpMemberInfoBody, FSharpAccessibility, FSharpAttribute, FSharpMember_$reflection, FSharpMember, FSharpMemberInfo, FSharpParameter, FSharpType, FSharpParameter_$reflection, FSharpType_$reflection } from "../FsharpAST.js";
6
+ import { tuple_type, class_type, string_type, bool_type, record_type, list_type, lambda_type } from "../../fable_modules/fable-library-js.5.21.0/Reflection.js";
7
+ import { mapFsharpParameter, mapFSharpType, SealedTypeInfo, TransformTypeParametersResult_$reflection } from "./TypeParameter.js";
8
+ import { union, empty as empty_2, ofSeq, singleton as singleton_2, contains, FSharpSet__Contains, ofList } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
9
+ import { tail as tail_3, head as head_1, fold, sortBy, append as append_1, tryPick, collect, ofArray, exists, singleton as singleton_1, empty, isEmpty, filter, map, choose } from "../../fable_modules/fable-library-js.5.21.0/List.js";
10
+ import { curry2, stringHash, comparePrimitives } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
11
+ import { List_distinct } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
12
+ import { namedTypeParameters } from "./TypeParameters.js";
13
+ import { empty as empty_3, add, tryFind } from "../../fable_modules/fable-library-js.5.21.0/Map.js";
14
+ import { map as map_1, empty as empty_1, forAll, singleton, append, delay, toList } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
15
+ import { printf, toFail, substring, concat } from "../../fable_modules/fable-library-js.5.21.0/String.js";
16
+ import { removeSurroundingQuotes, sanitizeTypeName } from "../Utils/Naming.js";
17
+ import { transformComment } from "./Comment.js";
18
+ import { requiredBeforeParamArray } from "./Utils.js";
19
+ import { isLetterOrDigit } from "../../fable_modules/fable-library-js.5.21.0/Char.js";
20
+ import { defaultArg, toArray } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
21
+ import { expandParameters } from "./UnionOverloads.js";
22
+ import { expandFunction } from "./KeyOfMaps.js";
23
+ import { resolveFunction } from "./Conditionals.js";
24
+ import { Aliases_get_Empty, distinctBySignature } from "../Merge.js";
25
+
26
+ export class Transforms extends Record {
27
+ constructor(Type, Parameter, TypeParameters, DefaultedTypeParameterOverloadsOfFunction, DictionaryParameterOverloadsOfFunction) {
28
+ super();
29
+ this.Type = Type;
30
+ this.Parameter = Parameter;
31
+ this.TypeParameters = TypeParameters;
32
+ this.DefaultedTypeParameterOverloadsOfFunction = DefaultedTypeParameterOverloadsOfFunction;
33
+ this.DictionaryParameterOverloadsOfFunction = DictionaryParameterOverloadsOfFunction;
34
+ }
35
+ }
36
+
37
+ export function Transforms_$reflection() {
38
+ return record_type("Glutinum.Converter.Transformer.Exports.Transforms", [], Transforms, () => [["Type", lambda_type(TransformContext_$reflection(), lambda_type(GlueType_$reflection(), FSharpType_$reflection()))], ["Parameter", lambda_type(TransformContext_$reflection(), lambda_type(GlueParameter_$reflection(), FSharpParameter_$reflection()))], ["TypeParameters", lambda_type(TransformContext_$reflection(), lambda_type(list_type(GlueTypeParameter_$reflection()), TransformTypeParametersResult_$reflection()))], ["DefaultedTypeParameterOverloadsOfFunction", lambda_type(GlueFunctionDeclaration_$reflection(), list_type(GlueFunctionDeclaration_$reflection()))], ["DictionaryParameterOverloadsOfFunction", lambda_type(GlueFunctionDeclaration_$reflection(), list_type(GlueFunctionDeclaration_$reflection()))]]);
39
+ }
40
+
41
+ function withoutFreeTypeParameters(members) {
42
+ const erase = (declared, typ) => {
43
+ const declaredNames = ofList(choose((_arg) => {
44
+ if (_arg.tag === 0) {
45
+ return undefined;
46
+ }
47
+ else {
48
+ return _arg.fields[0].Name;
49
+ }
50
+ }, declared), {
51
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
52
+ });
53
+ const free = map((name_1) => (new SealedTypeInfo(name_1, FSharpType.Object$)), filter((name) => !FSharpSet__Contains(declaredNames, name), List_distinct(namedTypeParameters(typ), {
54
+ Equals: (x_1, y_1) => (x_1 === y_1),
55
+ GetHashCode: (x_1) => (stringHash(x_1) | 0),
56
+ })));
57
+ if (isEmpty(free)) {
58
+ return typ;
59
+ }
60
+ else {
61
+ return mapFSharpType(free, typ);
62
+ }
63
+ };
64
+ const eraseInfo = (info_1) => {
65
+ const Type = erase(info_1.TypeParameters, info_1.Type);
66
+ return new FSharpMemberInfo(info_1.Attributes, info_1.Name, info_1.OriginalName, info_1.TypeParameters, map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, erase(info_1.TypeParameters, parameter.Type), parameter.OriginalGlueMember)), info_1.Parameters), Type, info_1.IsOptional, info_1.IsStatic, info_1.Accessor, info_1.Accessibility, info_1.XmlDoc, info_1.Body);
67
+ };
68
+ return map((_arg_1) => {
69
+ switch (_arg_1.tag) {
70
+ case 1:
71
+ return new FSharpMember(/* Property */ 1, [eraseInfo(_arg_1.fields[0])]);
72
+ case 2:
73
+ return new FSharpMember(/* StaticMember */ 2, [_arg_1.fields[0]]);
74
+ default:
75
+ return new FSharpMember(/* Method */ 0, [eraseInfo(_arg_1.fields[0])]);
76
+ }
77
+ }, members);
78
+ }
79
+
80
+ class ExportScope extends Record {
81
+ constructor(Context, IsTopLevel, DefaultExportedDeclarations, ExportEqualsNames, DeclaredValueNames, ExportEqualsMembers, ExportEqualsCalls, Transforms) {
82
+ super();
83
+ this.Context = Context;
84
+ this.IsTopLevel = IsTopLevel;
85
+ this.DefaultExportedDeclarations = DefaultExportedDeclarations;
86
+ this.ExportEqualsNames = ExportEqualsNames;
87
+ this.DeclaredValueNames = DeclaredValueNames;
88
+ this.ExportEqualsMembers = ExportEqualsMembers;
89
+ this.ExportEqualsCalls = ExportEqualsCalls;
90
+ this.Transforms = Transforms;
91
+ }
92
+ }
93
+
94
+ function ExportScope_$reflection() {
95
+ return record_type("Glutinum.Converter.Transformer.Exports.ExportScope", [], ExportScope, () => [["Context", TransformContext_$reflection()], ["IsTopLevel", bool_type], ["DefaultExportedDeclarations", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])], ["ExportEqualsNames", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])], ["DeclaredValueNames", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])], ["ExportEqualsMembers", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, string_type])], ["ExportEqualsCalls", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])], ["Transforms", Transforms_$reflection()]]);
96
+ }
97
+
98
+ class ExportMembers extends Record {
99
+ constructor(Members, Names, Prepended, ExportEqualsMembers, ExportEqualsCalls) {
100
+ super();
101
+ this.Members = Members;
102
+ this.Names = Names;
103
+ this.Prepended = Prepended;
104
+ this.ExportEqualsMembers = ExportEqualsMembers;
105
+ this.ExportEqualsCalls = ExportEqualsCalls;
106
+ }
107
+ }
108
+
109
+ function ExportMembers_$reflection() {
110
+ return record_type("Glutinum.Converter.Transformer.Exports.ExportMembers", [], ExportMembers, () => [["Members", list_type(FSharpMember_$reflection())], ["Names", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type])], ["Prepended", list_type(GlueType_$reflection())], ["ExportEqualsMembers", list_type(tuple_type(string_type, string_type))], ["ExportEqualsCalls", list_type(string_type)]]);
111
+ }
112
+
113
+ function exportMembers(members, names) {
114
+ return new ExportMembers(members, names, empty(), empty(), empty());
115
+ }
116
+
117
+ function throughDefault(scope, memberName, emit) {
118
+ const matchValue = tryFind(memberName, scope.ExportEqualsMembers);
119
+ let matchResult, objectName_1;
120
+ if (matchValue != null) {
121
+ if (scope.IsTopLevel) {
122
+ matchResult = 0;
123
+ objectName_1 = matchValue;
124
+ }
125
+ else {
126
+ matchResult = 1;
127
+ }
128
+ }
129
+ else {
130
+ matchResult = 1;
131
+ }
132
+ switch (matchResult) {
133
+ case 0: {
134
+ const emit_1 = contains(memberName, scope.ExportEqualsCalls) ? "$0($1...)" : emit;
135
+ return toList(delay(() => append(importDefaultAttribute(objectName_1, TransformContext__get_ImportSource(scope.Context)), delay(() => singleton(new FSharpAttribute(/* Text */ 0, [concat("Emit(\"", emit_1, "\")")]))))));
136
+ }
137
+ default:
138
+ return undefined;
139
+ }
140
+ }
141
+
142
+ function exportProperty(scope) {
143
+ return new FSharpMemberInfo(empty(), "", "", empty(), empty(), FSharpType.Discard, false, scope.IsTopLevel, undefined, FSharpAccessibility.Public, empty(), FSharpMemberInfoBody.NativeOnly);
144
+ }
145
+
146
+ function moduleNames(seenNames, moduleDeclaration) {
147
+ const sanitizedName = sanitizeTypeName(moduleDeclaration.Name);
148
+ const withSuffix = sanitizeTypeName(removeSurroundingQuotes(moduleDeclaration.Name) + "_");
149
+ return [sanitizedName, withSuffix, FSharpSet__Contains(seenNames, sanitizedName) ? withSuffix : sanitizedName];
150
+ }
151
+
152
+ function exportVariable(scope, info) {
153
+ let bind$0040;
154
+ const patternInput = sanitizeMemberNameAndPushScope(scope.IsTopLevel, info.Name, scope.Context);
155
+ const name = patternInput[0];
156
+ const context_1 = TransformContext__PushScope_27AED5E3(patternInput[1], "Type");
157
+ const xmlDocInfo = transformComment(info.Documentation);
158
+ return exportMembers(singleton_1(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(toList(delay(() => {
159
+ let matchValue;
160
+ return append((matchValue = throughDefault(scope, info.Name, concat("$0.", info.Name)), (matchValue == null) ? (scope.IsTopLevel ? importAttribute(info.Name, TransformContext__get_ImportSource(context_1)) : singleton(new FSharpAttribute(/* EmitMacroProperty */ 19, [info.Name]))) : matchValue), delay(() => xmlDocInfo.ObsoleteAttributes));
161
+ })), name, info.Name, bind$0040.TypeParameters, bind$0040.Parameters, scope.Transforms.Type(context_1, info.Type), bind$0040.IsOptional, bind$0040.IsStatic, bind$0040.Accessor, bind$0040.Accessibility, xmlDocInfo.XmlDoc, bind$0040.Body))])), singleton_2(name, {
162
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
163
+ }));
164
+ }
165
+
166
+ function exportFunction(scope, seenNames, exports, info) {
167
+ let f1, specifier;
168
+ const patternInput = sanitizeMemberNameAndPushScope(scope.IsTopLevel, info.Name, scope.Context);
169
+ const name = patternInput[0];
170
+ const context = patternInput[1];
171
+ const xmlDocInfo = transformComment(info.Documentation);
172
+ const typeParameters = scope.Transforms.TypeParameters(context, info.TypeParameters);
173
+ const method = new FSharpMemberInfo(toList(delay(() => {
174
+ let matchValue;
175
+ return append((matchValue = throughDefault(scope, info.Name, concat("$0.", info.Name, "($1...)")), (matchValue == null) ? (scope.IsTopLevel ? (FSharpSet__Contains(scope.DefaultExportedDeclarations, info.Name) ? importDefaultAttribute(info.Name, TransformContext__get_ImportSource(context)) : importAttribute(info.Name, TransformContext__get_ImportSource(context))) : singleton(new FSharpAttribute(/* EmitMacroInvoke */ 18, [info.Name]))) : matchValue), delay(() => xmlDocInfo.ObsoleteAttributes));
176
+ })), name, info.Name, typeParameters.TypeParameters, requiredBeforeParamArray(map((f1 = curry2(scope.Transforms.Parameter)(context), (arg) => mapFsharpParameter(typeParameters.SealedTypes, f1(arg))), info.Parameters)), mapFSharpType(typeParameters.SealedTypes, scope.Transforms.Type(context, info.Type)), false, scope.IsTopLevel, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly);
177
+ let runtimeName;
178
+ const matchValue_1 = TransformContext__get_ImportSource(context);
179
+ let matchResult, specifier_1;
180
+ if (matchValue_1.tag === 0) {
181
+ if ((specifier = matchValue_1.fields[0], ((((((scope.IsTopLevel && FSharpSet__Contains(scope.DefaultExportedDeclarations, info.Name)) && (specifier !== "REPLACE_ME_WITH_MODULE_NAME")) && !(specifier.indexOf("/") >= 0)) && forAll((c) => {
182
+ if (isLetterOrDigit(c)) {
183
+ return true;
184
+ }
185
+ else {
186
+ return c === "_";
187
+ }
188
+ }, specifier.split(""))) && (specifier !== name)) && !FSharpSet__Contains(seenNames, specifier)) && !exists((_arg) => {
189
+ let matchResult_1, other, other_1;
190
+ switch (_arg.tag) {
191
+ case 6: {
192
+ matchResult_1 = 0;
193
+ other = _arg.fields[0];
194
+ break;
195
+ }
196
+ case 25: {
197
+ if (_arg.fields[0].tag === 6) {
198
+ matchResult_1 = 0;
199
+ other = _arg.fields[0].fields[0];
200
+ }
201
+ else {
202
+ matchResult_1 = 2;
203
+ }
204
+ break;
205
+ }
206
+ case 2: {
207
+ matchResult_1 = 1;
208
+ other_1 = _arg.fields[0];
209
+ break;
210
+ }
211
+ default:
212
+ matchResult_1 = 2;
213
+ }
214
+ switch (matchResult_1) {
215
+ case 0:
216
+ return other.Name === specifier;
217
+ case 1:
218
+ return other_1.Name === specifier;
219
+ default:
220
+ return false;
221
+ }
222
+ }, exports))) {
223
+ matchResult = 0;
224
+ specifier_1 = matchValue_1.fields[0];
225
+ }
226
+ else {
227
+ matchResult = 1;
228
+ }
229
+ }
230
+ else {
231
+ matchResult = 1;
232
+ }
233
+ switch (matchResult) {
234
+ case 0: {
235
+ runtimeName = specifier_1;
236
+ break;
237
+ }
238
+ default:
239
+ runtimeName = undefined;
240
+ }
241
+ return exportMembers(toList(delay(() => append(singleton(new FSharpMember(/* Method */ 0, [method])), delay(() => {
242
+ const matchValue_2 = runtimeName;
243
+ if (matchValue_2 == null) {
244
+ return empty_1();
245
+ }
246
+ else {
247
+ return singleton(new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(method.Attributes, matchValue_2, method.OriginalName, method.TypeParameters, method.Parameters, method.Type, method.IsOptional, method.IsStatic, method.Accessor, method.Accessibility, method.XmlDoc, method.Body)]));
248
+ }
249
+ })))), ofList(toList(delay(() => append(singleton(name), delay(() => ofArray(toArray(runtimeName)))))), {
250
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
251
+ }));
252
+ }
253
+
254
+ function exportClass(scope, isDefaultExport, info) {
255
+ const patternInput = sanitizeNameAndPushScope(info.Name, scope.Context);
256
+ const name = patternInput[0];
257
+ const context = patternInput[1];
258
+ return exportMembers(map((constructorInfo_1) => {
259
+ let f1;
260
+ const xmlDocInfo = transformComment(constructorInfo_1.Documentation);
261
+ const typParameters = scope.Transforms.TypeParameters(context, info.TypeParameters);
262
+ return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(toList(delay(() => append(scope.IsTopLevel ? append(isDefaultExport ? importDefaultAttribute(info.Name, TransformContext__get_ImportSource(context)) : importAttribute(info.Name, TransformContext__get_ImportSource(context)), delay(() => singleton(FSharpAttribute.EmitConstructor))) : singleton(new FSharpAttribute(/* EmitMacroConstructor */ 17, [info.Name])), delay(() => xmlDocInfo.ObsoleteAttributes)))), name, info.Name, typParameters.TypeParameters, requiredBeforeParamArray(map((f1 = curry2(scope.Transforms.Parameter)(context), (arg) => mapFsharpParameter(typParameters.SealedTypes, f1(arg))), constructorInfo_1.Parameters)), new FSharpType(/* Mapped */ 7, [new FSharpMapped(sanitizeTypeName(info.Name), typParameters.TypeParameters)]), false, scope.IsTopLevel, undefined, FSharpAccessibility.Public, xmlDocInfo.XmlDoc, FSharpMemberInfoBody.NativeOnly)]);
263
+ }, isEmpty(info.Constructors) ? singleton_1(new GlueConstructor(empty(), empty())) : collect((constructorInfo) => map((parameters) => (new GlueConstructor(constructorInfo.Documentation, parameters)), expandParameters(TransformContext__get_State(context).MaxOverloads, TransformContext__get_TypeMemory(context), constructorInfo.Parameters)), info.Constructors)), singleton_2(name, {
264
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
265
+ }));
266
+ }
267
+
268
+ function exportModule(scope, seenNames, moduleDeclaration) {
269
+ let bind$0040, typ_2;
270
+ const context = scope.Context;
271
+ const patternInput = moduleNames(seenNames, moduleDeclaration);
272
+ const mangledName = patternInput[2];
273
+ const exportTypeName = moduleDeclaration.IsTopLevel ? concat(patternInput[1], ".Exports") : concat(patternInput[0], ".Exports");
274
+ const isAmbientModule = moduleDeclaration.Name.startsWith("\"") ? true : moduleDeclaration.Name.startsWith("\'");
275
+ const exportEqualsType = tryPick((_arg) => {
276
+ let matchResult, name_1, typ_1;
277
+ if (_arg.tag === 25) {
278
+ if (_arg.fields[0].tag === 2) {
279
+ if (_arg.fields[0].fields[0].Name.startsWith("export=")) {
280
+ matchResult = 0;
281
+ name_1 = _arg.fields[0].fields[0].Name;
282
+ typ_1 = _arg.fields[0].fields[0].Type;
283
+ }
284
+ else {
285
+ matchResult = 1;
286
+ }
287
+ }
288
+ else {
289
+ matchResult = 1;
290
+ }
291
+ }
292
+ else {
293
+ matchResult = 1;
294
+ }
295
+ switch (matchResult) {
296
+ case 0:
297
+ return typ_1;
298
+ default:
299
+ return undefined;
300
+ }
301
+ }, moduleDeclaration.Types);
302
+ const xmlDocInfo = transformComment(moduleDeclaration.Documentation);
303
+ const namespaceValues = (scope.IsTopLevel && (FSharpSet__Contains(scope.ExportEqualsNames, moduleDeclaration.Name) ? true : FSharpSet__Contains(scope.DefaultExportedDeclarations, moduleDeclaration.Name))) ? choose((_arg_1) => {
304
+ let info, info_1;
305
+ let matchResult_1, info_2, info_3;
306
+ switch (_arg_1.tag) {
307
+ case 6: {
308
+ if ((info = _arg_1.fields[0], !FSharpSet__Contains(scope.DeclaredValueNames, info.Name) && !FSharpSet__Contains(seenNames, info.Name))) {
309
+ matchResult_1 = 0;
310
+ info_2 = _arg_1.fields[0];
311
+ }
312
+ else {
313
+ matchResult_1 = 2;
314
+ }
315
+ break;
316
+ }
317
+ case 2: {
318
+ if ((info_1 = _arg_1.fields[0], !FSharpSet__Contains(scope.DeclaredValueNames, info_1.Name) && !FSharpSet__Contains(seenNames, info_1.Name))) {
319
+ matchResult_1 = 1;
320
+ info_3 = _arg_1.fields[0];
321
+ }
322
+ else {
323
+ matchResult_1 = 2;
324
+ }
325
+ break;
326
+ }
327
+ default:
328
+ matchResult_1 = 2;
329
+ }
330
+ switch (matchResult_1) {
331
+ case 0:
332
+ return new GlueType(/* FunctionDeclaration */ 6, [info_2]);
333
+ case 1:
334
+ return new GlueType(/* Variable */ 2, [info_3]);
335
+ default:
336
+ return undefined;
337
+ }
338
+ }, moduleDeclaration.Types) : empty();
339
+ return new ExportMembers(singleton_1(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(toList(delay(() => append(xmlDocInfo.ObsoleteAttributes, delay(() => (isAmbientModule ? singleton(new FSharpAttribute(/* ImportAll */ 4, [removeSurroundingQuotes(moduleDeclaration.Name)])) : (scope.IsTopLevel ? importAllAttribute(removeSurroundingQuotes(moduleDeclaration.Name), TransformContext__get_ImportSource(context)) : singleton(new FSharpAttribute(/* EmitMacroProperty */ 19, [removeSurroundingQuotes(moduleDeclaration.Name)])))))))), mangledName, concat(moduleDeclaration.Name, ".Exports"), bind$0040.TypeParameters, bind$0040.Parameters, (exportEqualsType == null) ? (new FSharpType(/* Mapped */ 7, [new FSharpMapped(exportTypeName, empty())])) : ((typ_2 = exportEqualsType, scope.Transforms.Type(TransformContext__PushScope_27AED5E3(context, mangledName), typ_2))), bind$0040.IsOptional, scope.IsTopLevel ? true : isAmbientModule, FSharpAccessor.ReadOnly, bind$0040.Accessibility, xmlDocInfo.XmlDoc, bind$0040.Body))])), singleton_2(mangledName, {
340
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
341
+ }), namespaceValues, map((value) => [GlueType__get_Name(value), moduleDeclaration.Name], namespaceValues), empty());
342
+ }
343
+
344
+ function exportEqualsVariable(scope, name, typ) {
345
+ const patternInput = sanitizeMemberNameAndPushScope(true, substring(name, "export=".length), scope.Context);
346
+ const name_1 = patternInput[0];
347
+ const context = patternInput[1];
348
+ let property;
349
+ const bind$0040 = exportProperty(scope);
350
+ property = (new FSharpMemberInfo(importDefaultAttribute(name_1, TransformContext__get_ImportSource(context)), name_1, name_1, bind$0040.TypeParameters, bind$0040.Parameters, scope.Transforms.Type(context, typ), bind$0040.IsOptional, true, bind$0040.Accessor, bind$0040.Accessibility, bind$0040.XmlDoc, bind$0040.Body));
351
+ const withoutThis = (memberType) => {
352
+ if (memberType.tag === 17) {
353
+ return typ;
354
+ }
355
+ else {
356
+ return memberType;
357
+ }
358
+ };
359
+ const objectMembers = (typ.tag === 13) ? defaultArg(tryPick((_arg) => {
360
+ let matchResult, info_1;
361
+ if (_arg.tag === 1) {
362
+ if (_arg.fields[0].FullName === typ.fields[0].FullName) {
363
+ matchResult = 0;
364
+ info_1 = _arg.fields[0];
365
+ }
366
+ else {
367
+ matchResult = 1;
368
+ }
369
+ }
370
+ else {
371
+ matchResult = 1;
372
+ }
373
+ switch (matchResult) {
374
+ case 0:
375
+ return info_1.Members;
376
+ default:
377
+ return undefined;
378
+ }
379
+ }, TransformContext__get_TypeMemory(context)), empty()) : ((typ.tag === 22) ? typ.fields[0].Members : empty());
380
+ const memberExports = filter((glueType) => (GlueType__get_Name(glueType) !== name_1), choose((_arg_1) => {
381
+ let matchResult_1, info_5, info_6, info_7;
382
+ switch (_arg_1.tag) {
383
+ case 1: {
384
+ if (!_arg_1.fields[0].IsStatic) {
385
+ matchResult_1 = 0;
386
+ info_5 = _arg_1.fields[0];
387
+ }
388
+ else {
389
+ matchResult_1 = 3;
390
+ }
391
+ break;
392
+ }
393
+ case 6: {
394
+ matchResult_1 = 1;
395
+ info_6 = _arg_1.fields[0];
396
+ break;
397
+ }
398
+ case 0: {
399
+ if (!_arg_1.fields[0].IsStatic) {
400
+ matchResult_1 = 2;
401
+ info_7 = _arg_1.fields[0];
402
+ }
403
+ else {
404
+ matchResult_1 = 3;
405
+ }
406
+ break;
407
+ }
408
+ default:
409
+ matchResult_1 = 3;
410
+ }
411
+ switch (matchResult_1) {
412
+ case 0:
413
+ return new GlueType(/* Variable */ 2, [new GlueVariable(info_5.Documentation, info_5.Name, info_5.Type)]);
414
+ case 1:
415
+ return new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(info_6.Documentation, true, info_6.Name, withoutThis(info_6.Type), info_6.Parameters, empty())]);
416
+ case 2:
417
+ return new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(info_7.Documentation, true, info_7.Name, withoutThis(info_7.Type), info_7.Parameters, empty())]);
418
+ default:
419
+ return undefined;
420
+ }
421
+ }, objectMembers));
422
+ const calls = collect((_arg_2) => {
423
+ if (_arg_2.tag === 4) {
424
+ const info_8 = _arg_2.fields[0];
425
+ return map((parameters) => (new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(empty(), true, name_1, withoutThis(info_8.Type), parameters, info_8.TypeParameters)])), expandParameters(TransformContext__get_State(context).MaxOverloads, TransformContext__get_TypeMemory(context), info_8.Parameters));
426
+ }
427
+ else {
428
+ return empty();
429
+ }
430
+ }, objectMembers);
431
+ return new ExportMembers(isEmpty(calls) ? singleton_1(new FSharpMember(/* Property */ 1, [property])) : empty(), singleton_2(name_1, {
432
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
433
+ }), append_1(calls, memberExports), toList(delay(() => append(map_1((memberExport) => [GlueType__get_Name(memberExport), name_1], memberExports), delay(() => (!isEmpty(calls) ? singleton([name_1, name_1]) : empty_1()))))), isEmpty(calls) ? empty() : singleton_1(name_1));
434
+ }
435
+
436
+ function exportDefaultModule(scope, seenNames, moduleDeclaration) {
437
+ let bind$0040;
438
+ const patternInput = moduleNames(seenNames, moduleDeclaration);
439
+ const name = patternInput[2];
440
+ const xmlDocInfo = transformComment(moduleDeclaration.Documentation);
441
+ return exportMembers(singleton_1(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(toList(delay(() => append(xmlDocInfo.ObsoleteAttributes, delay(() => importDefaultAttribute(moduleDeclaration.Name, TransformContext__get_ImportSource(scope.Context)))))), name, concat(moduleDeclaration.Name, ".Exports"), bind$0040.TypeParameters, bind$0040.Parameters, new FSharpType(/* Mapped */ 7, [new FSharpMapped(concat(patternInput[1], ".Exports"), empty())]), bind$0040.IsOptional, true, FSharpAccessor.ReadOnly, bind$0040.Accessibility, xmlDocInfo.XmlDoc, bind$0040.Body))])), singleton_2(name, {
442
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
443
+ }));
444
+ }
445
+
446
+ function exportDefault(scope, seenNames, glueType) {
447
+ let bind$0040;
448
+ const patternInput = sanitizeMemberNameAndPushScope(true, GlueType__get_Name(glueType), scope.Context);
449
+ const name = patternInput[0];
450
+ const context = patternInput[1];
451
+ const name_1 = FSharpSet__Contains(seenNames, name) ? concat(name, "_") : name;
452
+ const context_1 = (glueType.tag === 2) ? TransformContext__PushScope_27AED5E3(context, "Type") : context;
453
+ return exportMembers(singleton_1(new FSharpMember(/* Property */ 1, [(bind$0040 = exportProperty(scope), new FSharpMemberInfo(importDefaultAttribute(GlueType__get_Name(glueType), TransformContext__get_ImportSource(context_1)), name_1, GlueType__get_Name(glueType), bind$0040.TypeParameters, bind$0040.Parameters, scope.Transforms.Type(context_1, glueType), bind$0040.IsOptional, true, bind$0040.Accessor, bind$0040.Accessibility, bind$0040.XmlDoc, bind$0040.Body))])), singleton_2(name_1, {
454
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
455
+ }));
456
+ }
457
+
458
+ export function transformExports(transforms, context, isTopLevel, exports) {
459
+ let members_2;
460
+ const context_1 = TransformContext__PushScope_27AED5E3(context, "Exports");
461
+ const exportEqualsNames = ofSeq(choose((_arg) => {
462
+ let matchResult, name_1;
463
+ if (_arg.tag === 25) {
464
+ if (_arg.fields[0].tag === 2) {
465
+ if (_arg.fields[0].fields[0].Name.startsWith("export=")) {
466
+ matchResult = 0;
467
+ name_1 = _arg.fields[0].fields[0].Name;
468
+ }
469
+ else {
470
+ matchResult = 1;
471
+ }
472
+ }
473
+ else {
474
+ matchResult = 1;
475
+ }
476
+ }
477
+ else {
478
+ matchResult = 1;
479
+ }
480
+ switch (matchResult) {
481
+ case 0:
482
+ return substring(name_1, "export=".length);
483
+ default:
484
+ return undefined;
485
+ }
486
+ }, exports), {
487
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
488
+ });
489
+ const sortedExports = sortBy((_arg_3) => {
490
+ if (_arg_3.tag === 11) {
491
+ return 1;
492
+ }
493
+ else {
494
+ return 0;
495
+ }
496
+ }, collect((_arg_2) => {
497
+ let info_2;
498
+ let matchResult_1, info_1, glueType;
499
+ switch (_arg_2.tag) {
500
+ case 6: {
501
+ matchResult_1 = 0;
502
+ info_1 = _arg_2.fields[0];
503
+ break;
504
+ }
505
+ case 25: {
506
+ if (_arg_2.fields[0].tag === 6) {
507
+ matchResult_1 = 0;
508
+ info_1 = _arg_2.fields[0].fields[0];
509
+ }
510
+ else {
511
+ matchResult_1 = 1;
512
+ glueType = _arg_2;
513
+ }
514
+ break;
515
+ }
516
+ default: {
517
+ matchResult_1 = 1;
518
+ glueType = _arg_2;
519
+ }
520
+ }
521
+ switch (matchResult_1) {
522
+ case 0:
523
+ return collect((info_3) => map((Item) => (new GlueType(/* FunctionDeclaration */ 6, [Item])), collect(transforms.DictionaryParameterOverloadsOfFunction, map((parameters) => (new GlueFunctionDeclaration(info_3.Documentation, info_3.IsDeclared, info_3.Name, info_3.Type, parameters, info_3.TypeParameters)), expandParameters(TransformContext__get_State(context_1).MaxOverloads, TransformContext__get_TypeMemory(context_1), info_3.Parameters)))), collect(transforms.DefaultedTypeParameterOverloadsOfFunction, (info_2 = expandFunction(TransformContext__get_State(context_1).KeyOfMaps, info_1), resolveFunction(TransformContext__get_State(context_1).Conditionals, info_2))));
524
+ default:
525
+ return singleton_1(glueType);
526
+ }
527
+ }, filter((_arg_1) => {
528
+ if (_arg_1.tag === 2) {
529
+ return !FSharpSet__Contains(exportEqualsNames, _arg_1.fields[0].Name);
530
+ }
531
+ else {
532
+ return true;
533
+ }
534
+ }, exports)), {
535
+ Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
536
+ });
537
+ const apply = (scope_1_mut, acc_mut, seenNames_mut, glueTypes_mut) => {
538
+ apply:
539
+ while (true) {
540
+ const scope_1 = scope_1_mut, acc = acc_mut, seenNames = seenNames_mut, glueTypes = glueTypes_mut;
541
+ let info_10;
542
+ let matchResult_2, name_5, tail_1, head, tail_2;
543
+ if (!isEmpty(glueTypes)) {
544
+ if (head_1(glueTypes).tag === 25) {
545
+ if (head_1(glueTypes).fields[0].tag === 2) {
546
+ if (FSharpSet__Contains(scope_1.DefaultExportedDeclarations, head_1(glueTypes).fields[0].fields[0].Name)) {
547
+ matchResult_2 = 1;
548
+ name_5 = head_1(glueTypes).fields[0].fields[0].Name;
549
+ tail_1 = tail_3(glueTypes);
550
+ }
551
+ else {
552
+ matchResult_2 = 2;
553
+ head = head_1(glueTypes);
554
+ tail_2 = tail_3(glueTypes);
555
+ }
556
+ }
557
+ else {
558
+ matchResult_2 = 2;
559
+ head = head_1(glueTypes);
560
+ tail_2 = tail_3(glueTypes);
561
+ }
562
+ }
563
+ else {
564
+ matchResult_2 = 2;
565
+ head = head_1(glueTypes);
566
+ tail_2 = tail_3(glueTypes);
567
+ }
568
+ }
569
+ else {
570
+ matchResult_2 = 0;
571
+ }
572
+ switch (matchResult_2) {
573
+ case 0:
574
+ return acc;
575
+ case 1: {
576
+ scope_1_mut = scope_1;
577
+ acc_mut = acc;
578
+ seenNames_mut = seenNames;
579
+ glueTypes_mut = tail_1;
580
+ continue apply;
581
+ }
582
+ default: {
583
+ const added = (head.tag === 2) ? exportVariable(scope_1, head.fields[0]) : ((head.tag === 6) ? exportFunction(scope_1, seenNames, glueTypes, head.fields[0]) : ((head.tag === 12) ? (((info_10 = head.fields[0], !info_10.IsExported && !FSharpSet__Contains(scope_1.DefaultExportedDeclarations, info_10.Name))) ? exportMembers(empty(), empty_2({
584
+ Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
585
+ })) : exportClass(scope_1, FSharpSet__Contains(scope_1.DefaultExportedDeclarations, head.fields[0].Name), head.fields[0])) : ((head.tag === 25) ? ((head.fields[0].tag === 12) ? exportClass(scope_1, true, head.fields[0].fields[0]) : ((head.fields[0].tag === 2) ? (head.fields[0].fields[0].Name.startsWith("export=") ? (isTopLevel ? exportEqualsVariable(scope_1, head.fields[0].fields[0].Name, head.fields[0].fields[0].Type) : exportMembers(empty(), empty_2({
586
+ Compare: (x_7, y_7) => (comparePrimitives(x_7, y_7) | 0),
587
+ }))) : exportDefault(scope_1, seenNames, head.fields[0])) : ((head.fields[0].tag === 11) ? exportDefaultModule(scope_1, seenNames, head.fields[0].fields[0]) : exportDefault(scope_1, seenNames, head.fields[0])))) : ((head.tag === 11) ? exportModule(scope_1, seenNames, head.fields[0]) : toFail(printf("Could not generate exportMembers for: %A"))(head)))));
588
+ scope_1_mut = (new ExportScope(scope_1.Context, scope_1.IsTopLevel, scope_1.DefaultExportedDeclarations, scope_1.ExportEqualsNames, scope_1.DeclaredValueNames, fold((acc_1, tupledArg) => add(tupledArg[0], tupledArg[1], acc_1), scope_1.ExportEqualsMembers, added.ExportEqualsMembers), union(scope_1.ExportEqualsCalls, ofSeq(added.ExportEqualsCalls, {
589
+ Compare: (x_8, y_8) => (comparePrimitives(x_8, y_8) | 0),
590
+ })), scope_1.Transforms));
591
+ acc_mut = append_1(acc, added.Members);
592
+ seenNames_mut = union(seenNames, added.Names);
593
+ glueTypes_mut = append_1(added.Prepended, tail_2);
594
+ continue apply;
595
+ }
596
+ }
597
+ break;
598
+ }
599
+ };
600
+ return new FSharpType(/* Interface */ 5, [new FSharpInterface(ofArray([FSharpAttribute.AbstractClass, FSharpAttribute.Erase]), "Exports", empty(), "Exports", empty(), (members_2 = withoutFreeTypeParameters(apply(new ExportScope(context_1, isTopLevel, ofSeq(choose((_arg_4) => {
601
+ let name_2;
602
+ let matchResult_3, info_6, name_3;
603
+ if (_arg_4.tag === 25) {
604
+ switch (_arg_4.fields[0].tag) {
605
+ case 6: {
606
+ matchResult_3 = 0;
607
+ info_6 = _arg_4.fields[0].fields[0];
608
+ break;
609
+ }
610
+ case 2: {
611
+ if ((name_2 = _arg_4.fields[0].fields[0].Name, exists((_arg_5) => {
612
+ switch (_arg_5.tag) {
613
+ case 12:
614
+ return _arg_5.fields[0].Name === name_2;
615
+ case 6:
616
+ return _arg_5.fields[0].Name === name_2;
617
+ default:
618
+ return false;
619
+ }
620
+ }, sortedExports))) {
621
+ matchResult_3 = 1;
622
+ name_3 = _arg_4.fields[0].fields[0].Name;
623
+ }
624
+ else {
625
+ matchResult_3 = 2;
626
+ }
627
+ break;
628
+ }
629
+ default:
630
+ matchResult_3 = 2;
631
+ }
632
+ }
633
+ else {
634
+ matchResult_3 = 2;
635
+ }
636
+ switch (matchResult_3) {
637
+ case 0:
638
+ return info_6.Name;
639
+ case 1:
640
+ return name_3;
641
+ default:
642
+ return undefined;
643
+ }
644
+ }, exports), {
645
+ Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
646
+ }), exportEqualsNames, ofSeq(choose((_arg_6) => {
647
+ let matchResult_4, info_7, info_8, info_9;
648
+ switch (_arg_6.tag) {
649
+ case 6: {
650
+ matchResult_4 = 0;
651
+ info_7 = _arg_6.fields[0];
652
+ break;
653
+ }
654
+ case 25: {
655
+ switch (_arg_6.fields[0].tag) {
656
+ case 6: {
657
+ matchResult_4 = 0;
658
+ info_7 = _arg_6.fields[0].fields[0];
659
+ break;
660
+ }
661
+ case 12: {
662
+ matchResult_4 = 2;
663
+ info_9 = _arg_6.fields[0].fields[0];
664
+ break;
665
+ }
666
+ default:
667
+ matchResult_4 = 3;
668
+ }
669
+ break;
670
+ }
671
+ case 2: {
672
+ matchResult_4 = 1;
673
+ info_8 = _arg_6.fields[0];
674
+ break;
675
+ }
676
+ case 12: {
677
+ matchResult_4 = 2;
678
+ info_9 = _arg_6.fields[0];
679
+ break;
680
+ }
681
+ default:
682
+ matchResult_4 = 3;
683
+ }
684
+ switch (matchResult_4) {
685
+ case 0:
686
+ return info_7.Name;
687
+ case 1:
688
+ return info_8.Name;
689
+ case 2:
690
+ return info_9.Name;
691
+ default:
692
+ return undefined;
693
+ }
694
+ }, exports), {
695
+ Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
696
+ }), empty_3({
697
+ Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
698
+ }), empty_2({
699
+ Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
700
+ }), transforms), empty(), empty_2({
701
+ Compare: (x_9, y_9) => (comparePrimitives(x_9, y_9) | 0),
702
+ }), sortedExports)), distinctBySignature(Aliases_get_Empty(), members_2)), empty())]);
703
+ }
704
+