@glutinum/cli 1.0.0-beta.14 → 1.0.0-beta.15

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 (34) hide show
  1. package/dist/Glutinum.Converter/GlueAST.js +19 -14
  2. package/dist/Glutinum.Converter/Merge.js +480 -205
  3. package/dist/Glutinum.Converter/Packages.js +2 -2
  4. package/dist/Glutinum.Converter/Printer.js +26 -21
  5. package/dist/Glutinum.Converter/Read.js +377 -169
  6. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +25 -8
  7. package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +2 -2
  8. package/dist/Glutinum.Converter/Reader/Declaration.js +15 -15
  9. package/dist/Glutinum.Converter/Reader/Deferred.js +114 -43
  10. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +98 -44
  11. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +2 -2
  12. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +61 -46
  13. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +4 -4
  14. package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +38 -25
  15. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +6 -5
  16. package/dist/Glutinum.Converter/Reader/Node.js +1 -1
  17. package/dist/Glutinum.Converter/Reader/TypeNode.js +244 -29
  18. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +1 -1
  19. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +143 -35
  20. package/dist/Glutinum.Converter/Reader/UtilityType.js +114 -31
  21. package/dist/Glutinum.Converter/Reader/Utils.js +186 -17
  22. package/dist/Glutinum.Converter/Reader/VariableStatement.js +46 -16
  23. package/dist/Glutinum.Converter/Transform.js +1062 -629
  24. package/dist/Glutinum.Converter/Transformer/CallableProperties.js +2 -2
  25. package/dist/Glutinum.Converter/Transformer/Conditionals.js +17 -16
  26. package/dist/Glutinum.Converter/Transformer/Context.js +12 -4
  27. package/dist/Glutinum.Converter/Transformer/Exports.js +242 -66
  28. package/dist/Glutinum.Converter/Transformer/Heritage.js +275 -17
  29. package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +4 -4
  30. package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +105 -19
  31. package/dist/Glutinum.Converter/Transformer/TypeParameters.js +2 -2
  32. package/dist/Glutinum.Converter/Transformer/Utils.js +3 -3
  33. package/dist/Glutinum.Converter/Utils/Naming.js +10 -3
  34. package/package.json +1 -1
@@ -211,8 +211,8 @@ function qualify(modulePath, glueType) {
211
211
  }
212
212
  case 14:
213
213
  return new GlueType(/* Array */ 14, [qualify_1(glueType.fields[0])]);
214
- case 30:
215
- return new GlueType(/* ReadOnly */ 30, [qualify_1(glueType.fields[0])]);
214
+ case 31:
215
+ return new GlueType(/* ReadOnly */ 31, [qualify_1(glueType.fields[0])]);
216
216
  case 23:
217
217
  return new GlueType(/* OptionalType */ 23, [qualify_1(glueType.fields[0])]);
218
218
  case 7:
@@ -9,6 +9,7 @@ import { safeHash, stringHash, equals, comparePrimitives, disposeSafe, getEnumer
9
9
  import { empty as empty_2, FSharpMap__get_IsEmpty, FSharpMap__get_Item, FSharpMap__TryFind, ofList, FSharpMap__ContainsKey, ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Map.js";
10
10
  import { map } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
11
11
  import { defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
12
+ import { isErrorHeritage } from "./Heritage.js";
12
13
  import { List_distinct } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
13
14
 
14
15
  /**
@@ -55,7 +56,7 @@ export function create(typeMemory) {
55
56
  iterate(collect, glueType.fields[0].Types);
56
57
  break;
57
58
  }
58
- case 31: {
59
+ case 32: {
59
60
  iterate(collect, glueType.fields[0].Types);
60
61
  break;
61
62
  }
@@ -70,7 +71,7 @@ export function create(typeMemory) {
70
71
  let typeReference;
71
72
  let matchResult, typeReference_1, typeReference_2, innerType, elements;
72
73
  switch (glueType_1.tag) {
73
- case 33: {
74
+ case 34: {
74
75
  matchResult = 0;
75
76
  break;
76
77
  }
@@ -90,7 +91,7 @@ export function create(typeMemory) {
90
91
  innerType = glueType_1.fields[0];
91
92
  break;
92
93
  }
93
- case 30: {
94
+ case 31: {
94
95
  matchResult = 3;
95
96
  innerType = glueType_1.fields[0];
96
97
  break;
@@ -175,7 +176,7 @@ function isErrorClass(state, visited, fullName) {
175
176
  return exists((_arg) => {
176
177
  if (_arg.tag === 13) {
177
178
  const typeReference = _arg.fields[0];
178
- if (typeReference.IsStandardLibrary && (typeReference.Name === "Error")) {
179
+ if (isErrorHeritage(_arg)) {
179
180
  return true;
180
181
  }
181
182
  else if (!FSharpSet__Contains(visited, typeReference.FullName)) {
@@ -308,7 +309,7 @@ function mentionsConditional(state_mut, glueType_mut) {
308
309
  const state = state_mut, glueType = glueType_mut;
309
310
  let matchResult, innerType;
310
311
  switch (glueType.tag) {
311
- case 33: {
312
+ case 34: {
312
313
  matchResult = 0;
313
314
  break;
314
315
  }
@@ -325,7 +326,7 @@ function mentionsConditional(state_mut, glueType_mut) {
325
326
  innerType = glueType.fields[0];
326
327
  break;
327
328
  }
328
- case 30: {
329
+ case 31: {
329
330
  matchResult = 3;
330
331
  innerType = glueType.fields[0];
331
332
  break;
@@ -399,7 +400,7 @@ function resolveWith(state, seen, glueType) {
399
400
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
400
401
  }), alias.Type);
401
402
  switch (matchValue.tag) {
402
- case 33:
403
+ case 34:
403
404
  return defaultArg(tryCollapse(resolve_2, withInferredConstraints(matchValue.fields[0])), glueType);
404
405
  case 13: {
405
406
  const matchValue_1 = resolve_2(matchValue);
@@ -439,14 +440,14 @@ function resolveWith(state, seen, glueType) {
439
440
  else {
440
441
  return new GlueType(/* TypeReference */ 13, [new GlueTypeReference(glueType.fields[0].Name, glueType.fields[0].FullName, glueType.fields[0].ModulePath, map_1(resolve_1, glueType.fields[0].TypeArguments), glueType.fields[0].IsStandardLibrary)]);
441
442
  }
442
- case 33:
443
+ case 34:
443
444
  return defaultArg(tryCollapse(resolve_1, withInferredConstraints(glueType.fields[0])), glueType);
444
445
  case 7:
445
446
  return new GlueType(/* Union */ 7, [new GlueTypeUnion(map_1(resolve_1, glueType.fields[0].fields[0]))]);
446
447
  case 14:
447
448
  return new GlueType(/* Array */ 14, [resolve_1(glueType.fields[0])]);
448
- case 30:
449
- return new GlueType(/* ReadOnly */ 30, [resolve_1(glueType.fields[0])]);
449
+ case 31:
450
+ return new GlueType(/* ReadOnly */ 31, [resolve_1(glueType.fields[0])]);
450
451
  case 23:
451
452
  return new GlueType(/* OptionalType */ 23, [resolve_1(glueType.fields[0])]);
452
453
  case 18:
@@ -513,13 +514,13 @@ function expandAlias(state, typeReference) {
513
514
 
514
515
  function inlineConditional(state, glueType) {
515
516
  switch (glueType.tag) {
516
- case 33:
517
+ case 34:
517
518
  return glueType.fields[0];
518
519
  case 13: {
519
520
  const matchValue = expandAlias(state, glueType.fields[0]);
520
521
  let matchResult, conditionalType_1;
521
522
  if (matchValue != null) {
522
- if (matchValue.tag === 33) {
523
+ if (matchValue.tag === 34) {
523
524
  matchResult = 0;
524
525
  conditionalType_1 = matchValue.fields[0];
525
526
  }
@@ -590,7 +591,7 @@ function tryFindConditional(state, own, seen, glueType) {
590
591
  innerType = glueType.fields[0];
591
592
  break;
592
593
  }
593
- case 30: {
594
+ case 31: {
594
595
  matchResult_1 = 2;
595
596
  innerType = glueType.fields[0];
596
597
  break;
@@ -664,7 +665,7 @@ function branchesOf(checkType, conditionalType) {
664
665
  const branch = [conditionalType.ExtendsType, conditionalType.TrueType, conditionalType.Inferred];
665
666
  const matchValue = conditionalType.FalseType;
666
667
  let matchResult, next_1, elseType_1;
667
- if (matchValue.tag === 33) {
668
+ if (matchValue.tag === 34) {
668
669
  if (equals(matchValue.fields[0].CheckType, checkType)) {
669
670
  matchResult = 0;
670
671
  next_1 = matchValue.fields[0];
@@ -866,8 +867,8 @@ function replaceConditional(state_mut, checkedName_mut, replacement_mut, seen_mu
866
867
  return new GlueType(/* Union */ 7, [new GlueTypeUnion(map_1(replace, glueType.fields[0].fields[0]))]);
867
868
  case 14:
868
869
  return new GlueType(/* Array */ 14, [replace(glueType.fields[0])]);
869
- case 30:
870
- return new GlueType(/* ReadOnly */ 30, [replace(glueType.fields[0])]);
870
+ case 31:
871
+ return new GlueType(/* ReadOnly */ 31, [replace(glueType.fields[0])]);
871
872
  case 23:
872
873
  return new GlueType(/* OptionalType */ 23, [replace(glueType.fields[0])]);
873
874
  case 18:
@@ -2,7 +2,7 @@
2
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
3
  import { trimStart, join, concat, substring } from "../../fable_modules/fable-library-js.5.21.0/String.js";
4
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";
5
+ import { isEmpty, empty, singleton, choose, contains, map } from "../../fable_modules/fable-library-js.5.21.0/List.js";
6
6
  import { FSharpModule, FSharpTypeAlias, FSharpEnum, FSharpUnion, FSharpDelegate, FSharpClass, FSharpInterface, FSharpAttribute, FSharpMember, FSharpMemberInfo, FSharpType } from "../FsharpAST.js";
7
7
  import { Union, FSharpRef, Record } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
8
8
  import { create, State_$reflection } from "./Conditionals.js";
@@ -164,22 +164,30 @@ export function typeName(typ) {
164
164
  * The indexes of the run over the type memory, and the declarations being expanded
165
165
  */
166
166
  export class TransformState extends Record {
167
- constructor(Conditionals, KeyOfMaps, PartialHeritageBeingExpanded, UnionAliasesBeingExpanded, MaxOverloads) {
167
+ constructor(Conditionals, KeyOfMaps, PartialHeritageBeingExpanded, UnionAliasesBeingExpanded, MaxOverloads, ClassConstructors) {
168
168
  super();
169
169
  this.Conditionals = Conditionals;
170
170
  this.KeyOfMaps = KeyOfMaps;
171
171
  this.PartialHeritageBeingExpanded = PartialHeritageBeingExpanded;
172
172
  this.UnionAliasesBeingExpanded = UnionAliasesBeingExpanded;
173
173
  this.MaxOverloads = (MaxOverloads | 0);
174
+ this.ClassConstructors = ClassConstructors;
174
175
  }
175
176
  }
176
177
 
177
178
  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
+ 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], ["ClassConstructors", class_type("System.Collections.Generic.HashSet`1", [string_type])]]);
179
180
  }
180
181
 
181
182
  export function TransformState_Create_Z68CEF8E2(typeMemory, maxOverloads) {
182
- return new TransformState(create(typeMemory), create_1(typeMemory), [], [], maxOverloads);
183
+ return new TransformState(create(typeMemory), create_1(typeMemory), [], [], maxOverloads, new Set(choose((_arg) => {
184
+ if (_arg.tag === 30) {
185
+ return _arg.fields[0].FullName;
186
+ }
187
+ else {
188
+ return undefined;
189
+ }
190
+ }, typeMemory)));
183
191
  }
184
192
 
185
193
  /**
@@ -1,12 +1,12 @@
1
1
 
2
2
  import { Record } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
3
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";
4
+ import { GlueVariable, GlueType__get_Name, GlueType, GlueConstructor, GlueFunctionDeclaration, GlueFunctionDeclaration_$reflection, GlueTypeParameter_$reflection, GlueParameter_$reflection, GlueType_$reflection } from "../GlueAST.js";
5
5
  import { FSharpInterface, FSharpAccessor, FSharpMapped, FSharpMemberInfoBody, FSharpAccessibility, FSharpAttribute, FSharpMember_$reflection, FSharpMember, FSharpMemberInfo, FSharpParameter, FSharpType, FSharpParameter_$reflection, FSharpType_$reflection } from "../FsharpAST.js";
6
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
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";
8
+ import { union, empty as empty_2, unionMany, 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, length, contains as contains_1, singleton as singleton_1, empty, isEmpty, filter, map, choose } from "../../fable_modules/fable-library-js.5.21.0/List.js";
10
10
  import { curry2, stringHash, comparePrimitives } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
11
11
  import { List_distinct } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
12
12
  import { namedTypeParameters } from "./TypeParameters.js";
@@ -163,6 +163,56 @@ function exportVariable(scope, info) {
163
163
  }));
164
164
  }
165
165
 
166
+ function signaturesOfFunctionValue(info) {
167
+ const declaration = (typeParameters, parameters, returnType) => (new GlueFunctionDeclaration(info.Documentation, true, info.Name, returnType, parameters, typeParameters));
168
+ const matchValue = info.Type;
169
+ let matchResult, functionType, members;
170
+ switch (matchValue.tag) {
171
+ case 15: {
172
+ matchResult = 0;
173
+ functionType = matchValue.fields[0];
174
+ break;
175
+ }
176
+ case 22: {
177
+ if (!isEmpty(matchValue.fields[0].Members)) {
178
+ matchResult = 1;
179
+ members = matchValue.fields[0].Members;
180
+ }
181
+ else {
182
+ matchResult = 2;
183
+ }
184
+ break;
185
+ }
186
+ default:
187
+ matchResult = 2;
188
+ }
189
+ switch (matchResult) {
190
+ case 0:
191
+ return singleton_1(declaration(filter((typeParameter) => contains_1(typeParameter.Name, functionType.OwnTypeParameterNames, {
192
+ Equals: (x, y) => (x === y),
193
+ GetHashCode: (x) => (stringHash(x) | 0),
194
+ }), functionType.TypeParameters), functionType.Parameters, functionType.Type));
195
+ case 1: {
196
+ const signatures = choose((_arg) => {
197
+ if (_arg.tag === 4) {
198
+ return _arg.fields[0];
199
+ }
200
+ else {
201
+ return undefined;
202
+ }
203
+ }, members);
204
+ if (length(signatures) === length(members)) {
205
+ return map((signature_1) => declaration(signature_1.TypeParameters, signature_1.Parameters, signature_1.Type), signatures);
206
+ }
207
+ else {
208
+ return empty();
209
+ }
210
+ }
211
+ default:
212
+ return empty();
213
+ }
214
+ }
215
+
166
216
  function exportFunction(scope, seenNames, exports, info) {
167
217
  let f1, specifier;
168
218
  const patternInput = sanitizeMemberNameAndPushScope(scope.IsTopLevel, info.Name, scope.Context);
@@ -486,43 +536,56 @@ export function transformExports(transforms, context, isTopLevel, exports) {
486
536
  }, exports), {
487
537
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
488
538
  });
489
- const sortedExports = sortBy((_arg_3) => {
490
- if (_arg_3.tag === 11) {
539
+ const sortedExports = sortBy((_arg_4) => {
540
+ if (_arg_4.tag === 11) {
491
541
  return 1;
492
542
  }
493
543
  else {
494
544
  return 0;
495
545
  }
496
- }, collect((_arg_2) => {
497
- let info_2;
498
- let matchResult_1, info_1, glueType;
499
- switch (_arg_2.tag) {
546
+ }, collect((_arg_3) => {
547
+ let info_3;
548
+ let matchResult_1, info_2, glueType_1;
549
+ switch (_arg_3.tag) {
500
550
  case 6: {
501
551
  matchResult_1 = 0;
502
- info_1 = _arg_2.fields[0];
552
+ info_2 = _arg_3.fields[0];
503
553
  break;
504
554
  }
505
555
  case 25: {
506
- if (_arg_2.fields[0].tag === 6) {
556
+ if (_arg_3.fields[0].tag === 6) {
507
557
  matchResult_1 = 0;
508
- info_1 = _arg_2.fields[0].fields[0];
558
+ info_2 = _arg_3.fields[0].fields[0];
509
559
  }
510
560
  else {
511
561
  matchResult_1 = 1;
512
- glueType = _arg_2;
562
+ glueType_1 = _arg_3;
513
563
  }
514
564
  break;
515
565
  }
516
566
  default: {
517
567
  matchResult_1 = 1;
518
- glueType = _arg_2;
568
+ glueType_1 = _arg_3;
519
569
  }
520
570
  }
521
571
  switch (matchResult_1) {
522
572
  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))));
573
+ return collect((info_4) => map((Item_1) => (new GlueType(/* FunctionDeclaration */ 6, [Item_1])), collect(transforms.DictionaryParameterOverloadsOfFunction, map((parameters) => (new GlueFunctionDeclaration(info_4.Documentation, info_4.IsDeclared, info_4.Name, info_4.Type, parameters, info_4.TypeParameters)), expandParameters(TransformContext__get_State(context_1).MaxOverloads, TransformContext__get_TypeMemory(context_1), info_4.Parameters)))), collect(transforms.DefaultedTypeParameterOverloadsOfFunction, (info_3 = expandFunction(TransformContext__get_State(context_1).KeyOfMaps, info_2), resolveFunction(TransformContext__get_State(context_1).Conditionals, info_3))));
524
574
  default:
525
- return singleton_1(glueType);
575
+ return singleton_1(glueType_1);
576
+ }
577
+ }, collect((_arg_2) => {
578
+ if (_arg_2.tag === 2) {
579
+ const matchValue = signaturesOfFunctionValue(_arg_2.fields[0]);
580
+ if (isEmpty(matchValue)) {
581
+ return singleton_1(_arg_2);
582
+ }
583
+ else {
584
+ return map((Item) => (new GlueType(/* FunctionDeclaration */ 6, [Item])), matchValue);
585
+ }
586
+ }
587
+ else {
588
+ return singleton_1(_arg_2);
526
589
  }
527
590
  }, filter((_arg_1) => {
528
591
  if (_arg_1.tag === 2) {
@@ -531,14 +594,14 @@ export function transformExports(transforms, context, isTopLevel, exports) {
531
594
  else {
532
595
  return true;
533
596
  }
534
- }, exports)), {
597
+ }, exports))), {
535
598
  Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
536
599
  });
537
600
  const apply = (scope_1_mut, acc_mut, seenNames_mut, glueTypes_mut) => {
538
601
  apply:
539
602
  while (true) {
540
603
  const scope_1 = scope_1_mut, acc = acc_mut, seenNames = seenNames_mut, glueTypes = glueTypes_mut;
541
- let info_10;
604
+ let info_11;
542
605
  let matchResult_2, name_5, tail_1, head, tail_2;
543
606
  if (!isEmpty(glueTypes)) {
544
607
  if (head_1(glueTypes).tag === 25) {
@@ -580,62 +643,175 @@ export function transformExports(transforms, context, isTopLevel, exports) {
580
643
  continue apply;
581
644
  }
582
645
  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),
646
+ let added_1;
647
+ let matchResult_3, info_12, info_14, info_15, info_16, info_17, moduleDeclaration, name_7, typ_1, moduleDeclaration_1, glueType_2, glueType_3;
648
+ switch (head.tag) {
649
+ case 2: {
650
+ matchResult_3 = 0;
651
+ info_12 = head.fields[0];
652
+ break;
653
+ }
654
+ case 6: {
655
+ matchResult_3 = 1;
656
+ info_14 = head.fields[0];
657
+ break;
658
+ }
659
+ case 12: {
660
+ if ((info_11 = head.fields[0], !info_11.IsExported && !FSharpSet__Contains(scope_1.DefaultExportedDeclarations, info_11.Name))) {
661
+ matchResult_3 = 2;
662
+ info_15 = head.fields[0];
663
+ }
664
+ else {
665
+ matchResult_3 = 4;
666
+ info_17 = head.fields[0];
667
+ }
668
+ break;
669
+ }
670
+ case 25: {
671
+ switch (head.fields[0].tag) {
672
+ case 12: {
673
+ matchResult_3 = 3;
674
+ info_16 = head.fields[0].fields[0];
675
+ break;
676
+ }
677
+ case 2: {
678
+ if (head.fields[0].fields[0].Name.startsWith("export=")) {
679
+ matchResult_3 = 6;
680
+ name_7 = head.fields[0].fields[0].Name;
681
+ typ_1 = head.fields[0].fields[0].Type;
682
+ }
683
+ else {
684
+ matchResult_3 = 8;
685
+ glueType_2 = head.fields[0];
686
+ }
687
+ break;
688
+ }
689
+ case 11: {
690
+ matchResult_3 = 7;
691
+ moduleDeclaration_1 = head.fields[0].fields[0];
692
+ break;
693
+ }
694
+ default: {
695
+ matchResult_3 = 8;
696
+ glueType_2 = head.fields[0];
697
+ }
698
+ }
699
+ break;
700
+ }
701
+ case 11: {
702
+ matchResult_3 = 5;
703
+ moduleDeclaration = head.fields[0];
704
+ break;
705
+ }
706
+ default: {
707
+ matchResult_3 = 9;
708
+ glueType_3 = head;
709
+ }
710
+ }
711
+ switch (matchResult_3) {
712
+ case 0: {
713
+ const matchValue_1 = signaturesOfFunctionValue(info_12);
714
+ if (isEmpty(matchValue_1)) {
715
+ added_1 = exportVariable(scope_1, info_12);
716
+ }
717
+ else {
718
+ const added = map((info_13) => exportFunction(scope_1, seenNames, glueTypes, info_13), matchValue_1);
719
+ added_1 = exportMembers(collect((_arg_8) => _arg_8.Members, added), unionMany(map((_arg_9) => _arg_9.Names, added), {
720
+ Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
721
+ }));
722
+ }
723
+ break;
724
+ }
725
+ case 1: {
726
+ added_1 = exportFunction(scope_1, seenNames, glueTypes, info_14);
727
+ break;
728
+ }
729
+ case 2: {
730
+ added_1 = exportMembers(empty(), empty_2({
731
+ Compare: (x_7, y_7) => (comparePrimitives(x_7, y_7) | 0),
732
+ }));
733
+ break;
734
+ }
735
+ case 3: {
736
+ added_1 = exportClass(scope_1, true, info_16);
737
+ break;
738
+ }
739
+ case 4: {
740
+ added_1 = exportClass(scope_1, FSharpSet__Contains(scope_1.DefaultExportedDeclarations, info_17.Name), info_17);
741
+ break;
742
+ }
743
+ case 5: {
744
+ added_1 = exportModule(scope_1, seenNames, moduleDeclaration);
745
+ break;
746
+ }
747
+ case 6: {
748
+ added_1 = (isTopLevel ? exportEqualsVariable(scope_1, name_7, typ_1) : exportMembers(empty(), empty_2({
749
+ Compare: (x_8, y_8) => (comparePrimitives(x_8, y_8) | 0),
750
+ })));
751
+ break;
752
+ }
753
+ case 7: {
754
+ added_1 = exportDefaultModule(scope_1, seenNames, moduleDeclaration_1);
755
+ break;
756
+ }
757
+ case 8: {
758
+ added_1 = exportDefault(scope_1, seenNames, glueType_2);
759
+ break;
760
+ }
761
+ default:
762
+ added_1 = toFail(printf("Could not generate exportMembers for: %A"))(glueType_3);
763
+ }
764
+ 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_1.ExportEqualsMembers), union(scope_1.ExportEqualsCalls, ofSeq(added_1.ExportEqualsCalls, {
765
+ Compare: (x_9, y_9) => (comparePrimitives(x_9, y_9) | 0),
590
766
  })), 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);
767
+ acc_mut = append_1(acc, added_1.Members);
768
+ seenNames_mut = union(seenNames, added_1.Names);
769
+ glueTypes_mut = append_1(added_1.Prepended, tail_2);
594
770
  continue apply;
595
771
  }
596
772
  }
597
773
  break;
598
774
  }
599
775
  };
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) => {
776
+ 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_5) => {
601
777
  let name_2;
602
- let matchResult_3, info_6, name_3;
603
- if (_arg_4.tag === 25) {
604
- switch (_arg_4.fields[0].tag) {
778
+ let matchResult_4, info_7, name_3;
779
+ if (_arg_5.tag === 25) {
780
+ switch (_arg_5.fields[0].tag) {
605
781
  case 6: {
606
- matchResult_3 = 0;
607
- info_6 = _arg_4.fields[0].fields[0];
782
+ matchResult_4 = 0;
783
+ info_7 = _arg_5.fields[0].fields[0];
608
784
  break;
609
785
  }
610
786
  case 2: {
611
- if ((name_2 = _arg_4.fields[0].fields[0].Name, exists((_arg_5) => {
612
- switch (_arg_5.tag) {
787
+ if ((name_2 = _arg_5.fields[0].fields[0].Name, exists((_arg_6) => {
788
+ switch (_arg_6.tag) {
613
789
  case 12:
614
- return _arg_5.fields[0].Name === name_2;
790
+ return _arg_6.fields[0].Name === name_2;
615
791
  case 6:
616
- return _arg_5.fields[0].Name === name_2;
792
+ return _arg_6.fields[0].Name === name_2;
617
793
  default:
618
794
  return false;
619
795
  }
620
796
  }, sortedExports))) {
621
- matchResult_3 = 1;
622
- name_3 = _arg_4.fields[0].fields[0].Name;
797
+ matchResult_4 = 1;
798
+ name_3 = _arg_5.fields[0].fields[0].Name;
623
799
  }
624
800
  else {
625
- matchResult_3 = 2;
801
+ matchResult_4 = 2;
626
802
  }
627
803
  break;
628
804
  }
629
805
  default:
630
- matchResult_3 = 2;
806
+ matchResult_4 = 2;
631
807
  }
632
808
  }
633
809
  else {
634
- matchResult_3 = 2;
810
+ matchResult_4 = 2;
635
811
  }
636
- switch (matchResult_3) {
812
+ switch (matchResult_4) {
637
813
  case 0:
638
- return info_6.Name;
814
+ return info_7.Name;
639
815
  case 1:
640
816
  return name_3;
641
817
  default:
@@ -643,51 +819,51 @@ export function transformExports(transforms, context, isTopLevel, exports) {
643
819
  }
644
820
  }, exports), {
645
821
  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) {
822
+ }), exportEqualsNames, ofSeq(choose((_arg_7) => {
823
+ let matchResult_5, info_8, info_9, info_10;
824
+ switch (_arg_7.tag) {
649
825
  case 6: {
650
- matchResult_4 = 0;
651
- info_7 = _arg_6.fields[0];
826
+ matchResult_5 = 0;
827
+ info_8 = _arg_7.fields[0];
652
828
  break;
653
829
  }
654
830
  case 25: {
655
- switch (_arg_6.fields[0].tag) {
831
+ switch (_arg_7.fields[0].tag) {
656
832
  case 6: {
657
- matchResult_4 = 0;
658
- info_7 = _arg_6.fields[0].fields[0];
833
+ matchResult_5 = 0;
834
+ info_8 = _arg_7.fields[0].fields[0];
659
835
  break;
660
836
  }
661
837
  case 12: {
662
- matchResult_4 = 2;
663
- info_9 = _arg_6.fields[0].fields[0];
838
+ matchResult_5 = 2;
839
+ info_10 = _arg_7.fields[0].fields[0];
664
840
  break;
665
841
  }
666
842
  default:
667
- matchResult_4 = 3;
843
+ matchResult_5 = 3;
668
844
  }
669
845
  break;
670
846
  }
671
847
  case 2: {
672
- matchResult_4 = 1;
673
- info_8 = _arg_6.fields[0];
848
+ matchResult_5 = 1;
849
+ info_9 = _arg_7.fields[0];
674
850
  break;
675
851
  }
676
852
  case 12: {
677
- matchResult_4 = 2;
678
- info_9 = _arg_6.fields[0];
853
+ matchResult_5 = 2;
854
+ info_10 = _arg_7.fields[0];
679
855
  break;
680
856
  }
681
857
  default:
682
- matchResult_4 = 3;
858
+ matchResult_5 = 3;
683
859
  }
684
- switch (matchResult_4) {
860
+ switch (matchResult_5) {
685
861
  case 0:
686
- return info_7.Name;
687
- case 1:
688
862
  return info_8.Name;
689
- case 2:
863
+ case 1:
690
864
  return info_9.Name;
865
+ case 2:
866
+ return info_10.Name;
691
867
  default:
692
868
  return undefined;
693
869
  }
@@ -698,7 +874,7 @@ export function transformExports(transforms, context, isTopLevel, exports) {
698
874
  }), empty_2({
699
875
  Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
700
876
  }), transforms), empty(), empty_2({
701
- Compare: (x_9, y_9) => (comparePrimitives(x_9, y_9) | 0),
877
+ Compare: (x_10, y_10) => (comparePrimitives(x_10, y_10) | 0),
702
878
  }), sortedExports)), distinctBySignature(Aliases_get_Empty(), members_2)), empty())]);
703
879
  }
704
880