@glutinum/cli 1.0.0-beta.10 → 1.0.0-beta.12

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 (153) hide show
  1. package/dist/Glutinum.Converter/Abbreviations.js +7 -7
  2. package/dist/Glutinum.Converter/DelegateExtensions.js +7 -7
  3. package/dist/Glutinum.Converter/FreeTypeParameters.js +4 -4
  4. package/dist/Glutinum.Converter/FsharpAST.js +3 -3
  5. package/dist/Glutinum.Converter/Generate.js +19 -6
  6. package/dist/Glutinum.Converter/GlueAST.js +8 -8
  7. package/dist/Glutinum.Converter/Hosting.js +11 -11
  8. package/dist/Glutinum.Converter/Merge.js +103 -27
  9. package/dist/Glutinum.Converter/Packages.js +11 -11
  10. package/dist/Glutinum.Converter/Printer.js +23 -11
  11. package/dist/Glutinum.Converter/Read.js +9 -9
  12. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +4 -4
  13. package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +3 -3
  14. package/dist/Glutinum.Converter/Reader/Declaration.js +7 -7
  15. package/dist/Glutinum.Converter/Reader/Deferred.js +8 -8
  16. package/dist/Glutinum.Converter/Reader/Documentation.js +6 -6
  17. package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +2 -2
  18. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +6 -6
  19. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +4 -4
  20. package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +5 -5
  21. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +4 -4
  22. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +1 -1
  23. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +5 -5
  24. package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +5 -5
  25. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +4 -4
  26. package/dist/Glutinum.Converter/Reader/MemberTypes.js +5 -5
  27. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +4 -4
  28. package/dist/Glutinum.Converter/Reader/Node.js +4 -4
  29. package/dist/Glutinum.Converter/Reader/Parameters.js +3 -3
  30. package/dist/Glutinum.Converter/Reader/Report.js +4 -4
  31. package/dist/Glutinum.Converter/Reader/TypeNode.js +9 -9
  32. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +6 -6
  33. package/dist/Glutinum.Converter/Reader/TypeParameters.js +2 -2
  34. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +10 -10
  35. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +4 -4
  36. package/dist/Glutinum.Converter/Reader/Types.js +10 -10
  37. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +4 -4
  38. package/dist/Glutinum.Converter/Reader/UtilityType.js +8 -8
  39. package/dist/Glutinum.Converter/Reader/Utils.js +14 -14
  40. package/dist/Glutinum.Converter/Reader/VariableStatement.js +5 -5
  41. package/dist/Glutinum.Converter/Transform.js +262 -42
  42. package/dist/Glutinum.Converter/Transformer/AnyFunctionOverloads.js +5 -5
  43. package/dist/Glutinum.Converter/Transformer/CallableProperties.js +3 -3
  44. package/dist/Glutinum.Converter/Transformer/Comment.js +7 -7
  45. package/dist/Glutinum.Converter/Transformer/Conditionals.js +10 -10
  46. package/dist/Glutinum.Converter/Transformer/Context.js +11 -11
  47. package/dist/Glutinum.Converter/Transformer/Enum.js +5 -5
  48. package/dist/Glutinum.Converter/Transformer/Exports.js +11 -11
  49. package/dist/Glutinum.Converter/Transformer/Heritage.js +8 -8
  50. package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +9 -9
  51. package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +7 -7
  52. package/dist/Glutinum.Converter/Transformer/TypeParameter.js +5 -5
  53. package/dist/Glutinum.Converter/Transformer/TypeParameters.js +6 -6
  54. package/dist/Glutinum.Converter/Transformer/UnionOverloads.js +7 -25
  55. package/dist/Glutinum.Converter/Transformer/Utils.js +6 -6
  56. package/dist/Glutinum.Converter/Utils/Keywords.js +3 -3
  57. package/dist/Glutinum.Converter/Utils/List.js +2 -2
  58. package/dist/Glutinum.Converter/Utils/Naming.js +6 -6
  59. package/dist/Glutinum.Converter/Utils/String.js +3 -3
  60. package/dist/Program.js +7 -7
  61. package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs.js +2 -2
  62. package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs.js +4 -4
  63. package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs.js +2 -2
  64. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +5 -5
  65. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs.js +4 -4
  66. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs.js +3 -3
  67. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs.js +1 -1
  68. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +3 -3
  69. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs.js +1 -1
  70. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs.js +1 -1
  71. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs.js +4 -4
  72. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +1 -1
  73. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +3 -3
  74. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +1 -1
  75. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +1 -1
  76. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs.js +1 -1
  77. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs.js +2 -2
  78. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs.js +2 -2
  79. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs.js +1 -1
  80. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +7 -7
  81. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs.js +1 -1
  82. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Async.js +21 -7
  83. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/AsyncBuilder.js +51 -6
  84. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/CHANGELOG.md +23 -1
  85. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/CollectionUtil.js +10 -16
  86. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MailboxProcessor.js +19 -3
  87. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MutableMap.js +5 -1
  88. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MutableSet.js +5 -1
  89. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Util.js +15 -3
  90. package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/package.json +1 -1
  91. package/package.json +1 -1
  92. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Array.js +0 -0
  93. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/BigInt.js +0 -0
  94. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/BitConverter.js +0 -0
  95. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Boolean.js +0 -0
  96. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Char.js +0 -0
  97. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Choice.js +0 -0
  98. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/ConditionalWeakTable.js +0 -0
  99. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Date.js +0 -0
  100. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOffset.js +0 -0
  101. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOnly.js +0 -0
  102. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateOnlyTemporal.js +0 -0
  103. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeFormat.js +0 -0
  104. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeOffsetTemporal.js +0 -0
  105. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/DateTimeTemporal.js +0 -0
  106. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Decimal.js +0 -0
  107. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Directory.js +0 -0
  108. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Double.js +0 -0
  109. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Encoding.js +0 -0
  110. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Environment.js +0 -0
  111. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Event.js +0 -0
  112. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Collections.js +0 -0
  113. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Core.CompilerServices.js +0 -0
  114. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/FSharp.Core.js +0 -0
  115. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/File.js +0 -0
  116. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Global.js +0 -0
  117. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Guid.js +0 -0
  118. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Int32.js +0 -0
  119. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/List.js +0 -0
  120. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Long.js +0 -0
  121. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Map.js +0 -0
  122. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/MapUtil.js +0 -0
  123. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Native.js +0 -0
  124. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Numeric.js +0 -0
  125. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Observable.js +0 -0
  126. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Option.js +0 -0
  127. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Path.js +0 -0
  128. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/README.md +0 -0
  129. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Random.js +0 -0
  130. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Range.js +0 -0
  131. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Reflection.js +0 -0
  132. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/RegExp.js +0 -0
  133. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Result.js +0 -0
  134. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Seq.js +0 -0
  135. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Seq2.js +0 -0
  136. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Set.js +0 -0
  137. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/String.js +0 -0
  138. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.Collections.Generic.js +0 -0
  139. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.Text.js +0 -0
  140. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/System.js +0 -0
  141. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Task.js +0 -0
  142. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TaskBuilder.js +0 -0
  143. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeOnly.js +0 -0
  144. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeOnlyTemporal.js +0 -0
  145. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeSpan.js +0 -0
  146. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/TimeSpanTemporal.js +0 -0
  147. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Timer.js +0 -0
  148. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Types.js +0 -0
  149. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Unicode.13.0.0.js +0 -0
  150. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/Uri.js +0 -0
  151. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/big.d.ts +0 -0
  152. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/lib/big.js +0 -0
  153. /package/dist/fable_modules/{fable-library-js.5.17.2 → fable-library-js.5.21.0}/quotation.js +0 -0
@@ -1,14 +1,14 @@
1
1
 
2
- import { substring } from "../../fable_modules/fable-library-js.5.17.2/String.js";
3
- import { length, collect, filter, choose, empty, append, forAll, exists, tail, head, isEmpty, map, fold, tryPick } from "../../fable_modules/fable-library-js.5.17.2/List.js";
4
- import { FSharpSet__Contains, empty as empty_1, ofList, add, contains } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
5
- import { safeHash, equals, comparePrimitives, curry2 } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
2
+ import { substring } from "../../fable_modules/fable-library-js.5.21.0/String.js";
3
+ import { length, collect, filter, choose, empty, append, forAll, exists, tail, head, isEmpty, map, fold, tryPick } from "../../fable_modules/fable-library-js.5.21.0/List.js";
4
+ import { FSharpSet__Contains, empty as empty_1, ofList, add, contains } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
5
+ import { safeHash, equals, comparePrimitives, curry2 } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
6
6
  import { GluePrimitive, GlueSubstitution_substituteMember, GlueTypeUnion, GlueTypeReference, GlueType, GlueSubstitution_substitute, GlueSubstitution_ofTypeArguments, GlueMember, GlueProperty } from "../GlueAST.js";
7
- import { List_distinct, List_distinctBy } from "../../fable_modules/fable-library-js.5.17.2/Seq2.js";
8
- import { FSharpChoice$2 } from "../../fable_modules/fable-library-js.5.17.2/Choice.js";
7
+ import { List_distinct, List_distinctBy } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
8
+ import { FSharpChoice$2 } from "../../fable_modules/fable-library-js.5.21.0/Choice.js";
9
9
  import { isUnionCaseName } from "./Utils.js";
10
10
  import { memberTypeParameterNames } from "./TypeParameters.js";
11
- import { defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
11
+ import { defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
12
12
 
13
13
  function containerOf(fullName) {
14
14
  let unquoted;
@@ -1,10 +1,10 @@
1
1
 
2
- import { Record } from "../../fable_modules/fable-library-js.5.17.2/Types.js";
3
- import { list_type, option_type, record_type, string_type } from "../../fable_modules/fable-library-js.5.17.2/Reflection.js";
2
+ import { Record } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
3
+ import { list_type, option_type, record_type, string_type } from "../../fable_modules/fable-library-js.5.21.0/Reflection.js";
4
4
  import { FSharpParameter, FSharpTypeAlias, FSharpFunctionType, FSharpUnion, FSharpUnionCase, FSharpTypeReference, FSharpType, FSharpMapped, FSharpTypeParameter, FSharpTypeParameterInfo_Create_Z6CFD3565, FSharpTypeParameter_$reflection, FSharpType_$reflection } from "../FsharpAST.js";
5
- import { defaultArg, unwrap } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
6
- import { map, tryFind } from "../../fable_modules/fable-library-js.5.17.2/List.js";
7
- import { substring } from "../../fable_modules/fable-library-js.5.17.2/String.js";
5
+ import { defaultArg, unwrap } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
6
+ import { map, tryFind } from "../../fable_modules/fable-library-js.5.21.0/List.js";
7
+ import { substring } from "../../fable_modules/fable-library-js.5.21.0/String.js";
8
8
  import { tryUnwrapOption } from "./Utils.js";
9
9
 
10
10
  export class SealedTypeInfo extends Record {
@@ -1,12 +1,12 @@
1
1
 
2
2
  import { GlueSubstitution_substitute, GlueType, GluePrimitive, GlueTypeParameter } from "../GlueAST.js";
3
- import { cons, length, choose, exists, empty, append, contains, filter, collect, singleton, map } from "../../fable_modules/fable-library-js.5.17.2/List.js";
3
+ import { cons, length, choose, exists, empty, append, contains, filter, collect, singleton, map } from "../../fable_modules/fable-library-js.5.21.0/List.js";
4
4
  import { FSharpTypeModule_children, FSharpType, FSharpTypeParameter, FSharpTypeParameterInfo_Create_Z6CFD3565 } from "../FsharpAST.js";
5
- import { comparePrimitives, stringHash } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
6
- import { singleton as singleton_2, add, ofSeq, FSharpSet__Contains, ofList } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
7
- import { empty as empty_1, singleton as singleton_1, append as append_1, delay, toList } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
8
- import { substring } from "../../fable_modules/fable-library-js.5.17.2/String.js";
9
- import { remove, map as map_1, FSharpMap__ContainsKey, FSharpMap__get_Item, ofList as ofList_1 } from "../../fable_modules/fable-library-js.5.17.2/Map.js";
5
+ import { comparePrimitives, stringHash } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
6
+ import { singleton as singleton_2, add, ofSeq, FSharpSet__Contains, ofList } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
7
+ import { empty as empty_1, singleton as singleton_1, append as append_1, delay, toList } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
8
+ import { substring } from "../../fable_modules/fable-library-js.5.21.0/String.js";
9
+ import { remove, map as map_1, FSharpMap__ContainsKey, FSharpMap__get_Item, ofList as ofList_1 } from "../../fable_modules/fable-library-js.5.21.0/Map.js";
10
10
 
11
11
  /**
12
12
  * A type parameter without constraint nor default
@@ -1,11 +1,11 @@
1
1
 
2
- import { takeWhile, ofArray, mapIndexed, append, fold, tryFindIndex, empty, zip, tail as tail_1, head as head_1, tryFind, choose, forAll, filter, isEmpty, length, tryPick, map, exists, cons, singleton, collect } from "../../fable_modules/fable-library-js.5.17.2/List.js";
2
+ import { takeWhile, ofArray, mapIndexed, append, fold, tryFindIndex, empty, zip, tail as tail_1, head as head_1, tryFind, choose, forAll, filter, isEmpty, length, tryPick, map, exists, cons, singleton, collect } from "../../fable_modules/fable-library-js.5.21.0/List.js";
3
3
  import { GlueConstructSignature, GlueMethod, GlueMember, GlueMethodSignature, GlueParameter, GlueTypeUnion, GlueSubstitution_substitute, GlueType, GluePrimitive } from "../GlueAST.js";
4
- import { List_distinct } from "../../fable_modules/fable-library-js.5.17.2/Seq2.js";
5
- import { defaultArg } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
6
- import { comparePrimitives, safeHash, equals } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
7
- import { ofList } from "../../fable_modules/fable-library-js.5.17.2/Map.js";
8
- import { map as map_1, empty as empty_1, singleton as singleton_1, append as append_1, delay, toList } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
4
+ import { List_distinct } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
5
+ import { defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
6
+ import { comparePrimitives, safeHash, equals } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
7
+ import { ofList } from "../../fable_modules/fable-library-js.5.21.0/Map.js";
8
+ import { map as map_1, empty as empty_1, singleton as singleton_1, append as append_1, delay, toList } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
9
9
 
10
10
  export const defaultMaxOverloads = 16;
11
11
 
@@ -304,32 +304,14 @@ export function expandParameters(maxOverloads, typeMemory, parameters) {
304
304
  return singleton(parameter_1);
305
305
  }
306
306
  }, parameters), parameters));
307
- const choices_1 = patternInput[0];
308
- const expandsAnOptional = exists((tupledArg_2) => {
309
- if (tupledArg_2[1].IsOptional) {
310
- return length(tupledArg_2[0]) > 1;
311
- }
312
- else {
313
- return false;
314
- }
315
- }, zip(choices_1, parameters));
316
307
  if (patternInput[1] <= 1) {
317
308
  return singleton(parameters);
318
309
  }
319
310
  else {
320
- const expanded = List_distinct(map((combination) => choose((x) => x, takeWhile((option) => (option != null), combination)), cartesian(choices_1)), {
311
+ return List_distinct(map((combination) => choose((x) => x, takeWhile((option) => (option != null), combination)), cartesian(patternInput[0])), {
321
312
  Equals: equals,
322
313
  GetHashCode: (x_1) => (safeHash(x_1) | 0),
323
314
  });
324
- if (expandsAnOptional) {
325
- return expanded;
326
- }
327
- else {
328
- return List_distinct(append(expanded, singleton(parameters)), {
329
- Equals: equals,
330
- GetHashCode: (x_2) => (safeHash(x_2) | 0),
331
- });
332
- }
333
315
  }
334
316
  }
335
317
 
@@ -1,12 +1,12 @@
1
1
 
2
- import { FSharpSet__Contains, ofSeq } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
3
- import { safeHash, equals, comparePrimitives } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
2
+ import { FSharpSet__Contains, ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
3
+ import { safeHash, equals, comparePrimitives } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
4
4
  import { FSharpModule, FSharpTypeAlias, FSharpMapped, FSharpInterface, FSharpMember, FSharpMemberInfo, FSharpParameter, FSharpAttribute, FSharpPrimitive, FSharpLiteral, FSharpType, FSharpUnion } from "../FsharpAST.js";
5
- import { singleton as singleton_1, ofArray, isEmpty, empty, tryPick, collect, map, exists, contains, forAll } from "../../fable_modules/fable-library-js.5.17.2/List.js";
5
+ import { singleton as singleton_1, ofArray, isEmpty, empty, tryPick, collect, map, exists, contains, forAll } from "../../fable_modules/fable-library-js.5.21.0/List.js";
6
6
  import { GlueTypeUnion, GlueTypeReference, GlueType, GluePrimitive } from "../GlueAST.js";
7
- import { concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
8
- import { empty as empty_1, singleton, append, delay, toList } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
9
- import { toArray } from "../../fable_modules/fable-library-js.5.17.2/Option.js";
7
+ import { concat } from "../../fable_modules/fable-library-js.5.21.0/String.js";
8
+ import { empty as empty_1, singleton, append, delay, toList } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
9
+ import { toArray } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
10
10
 
11
11
  export const typedArrayNames = ofSeq(["Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array", "BigInt64Array", "BigUint64Array"], {
12
12
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
@@ -1,7 +1,7 @@
1
1
 
2
- import { ofList } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
3
- import { ofArray } from "../../fable_modules/fable-library-js.5.17.2/List.js";
4
- import { comparePrimitives } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
2
+ import { ofList } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
3
+ import { ofArray } from "../../fable_modules/fable-library-js.5.21.0/List.js";
4
+ import { comparePrimitives } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
5
5
 
6
6
  export const fsharp = ofList(ofArray(["abstract", "and", "as", "assert", "base", "begin", "class", "default", "delegate", "do", "done", "downcast", "downto", "elif", "else", "end", "exception", "extern", "false", "finally", "for", "fun", "function", "global", "if", "in", "inherit", "inline", "interface", "internal", "lazy", "let", "match", "member", "module", "mutable", "namespace", "new", "null", "of", "open", "or", "override", "private", "public", "rec", "return", "sig", "static", "struct", "then", "to", "true", "try", "type", "upcast", "use", "val", "void", "when", "while", "with", "yield", "atomic", "break", "checked", "component", "const", "constraint", "constructor", "continue", "eager", "fixed", "fori", "functor", "include", "measure", "method", "mixin", "object", "parallel", "params", "process", "protected", "pure", "recursive", "sealed", "tailcall", "trait", "virtual", "volatile", "mod", "land", "lor", "lxor", "lsl", "lsr", "asr"]), {
7
7
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
@@ -1,6 +1,6 @@
1
1
 
2
- import { skipWhile, empty, tail, head, isEmpty, cons, reverse } from "../../fable_modules/fable-library-js.5.17.2/List.js";
3
- import { isNullOrEmpty } from "../../fable_modules/fable-library-js.5.17.2/String.js";
2
+ import { skipWhile, empty, tail, head, isEmpty, cons, reverse } from "../../fable_modules/fable-library-js.5.21.0/List.js";
3
+ import { isNullOrEmpty } from "../../fable_modules/fable-library-js.5.21.0/String.js";
4
4
 
5
5
  export function removeConsecutiveEmptyLines(list) {
6
6
  const loop = (acc_mut, _arg_mut) => {
@@ -1,11 +1,11 @@
1
1
 
2
- import { isLetterOrDigit, isDigit } from "../../fable_modules/fable-library-js.5.17.2/Char.js";
3
- import { exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
4
- import { FSharpSet__Contains } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
2
+ import { isLetterOrDigit, isDigit } from "../../fable_modules/fable-library-js.5.21.0/Char.js";
3
+ import { exists } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
4
+ import { FSharpSet__Contains } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
5
5
  import { fsharp } from "./Keywords.js";
6
- import { isNullOrWhiteSpace, replace, substring, isNullOrEmpty, concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
7
- import { Record } from "../../fable_modules/fable-library-js.5.17.2/Types.js";
8
- import { record_type, bool_type, string_type } from "../../fable_modules/fable-library-js.5.17.2/Reflection.js";
6
+ import { isNullOrWhiteSpace, replace, substring, isNullOrEmpty, concat } from "../../fable_modules/fable-library-js.5.21.0/String.js";
7
+ import { Record } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
8
+ import { record_type, bool_type, string_type } from "../../fable_modules/fable-library-js.5.21.0/Reflection.js";
9
9
 
10
10
  function startWithDigit(name) {
11
11
  if (name.length > 0) {
@@ -1,7 +1,7 @@
1
1
 
2
- import { split, trim, replace as replace_1 } from "../../fable_modules/fable-library-js.5.17.2/String.js";
3
- import { replace as replace_2 } from "../../fable_modules/fable-library-js.5.17.2/RegExp.js";
4
- import { ofArray } from "../../fable_modules/fable-library-js.5.17.2/List.js";
2
+ import { split, trim, replace as replace_1 } from "../../fable_modules/fable-library-js.5.21.0/String.js";
3
+ import { replace as replace_2 } from "../../fable_modules/fable-library-js.5.21.0/RegExp.js";
4
+ import { ofArray } from "../../fable_modules/fable-library-js.5.21.0/List.js";
5
5
 
6
6
  export function replace(oldValue, newValue, input) {
7
7
  return replace_1(input, oldValue, newValue);
package/dist/Program.js CHANGED
@@ -2,16 +2,16 @@
2
2
  import path from "path";
3
3
  import { fileURLToPath } from "url";
4
4
  import { writeFileSync, mkdirSync, readFileSync } from "fs";
5
- import { collect, map, toList } from "./fable_modules/fable-library-js.5.17.2/Seq.js";
6
- import { join, concat, split } from "./fable_modules/fable-library-js.5.17.2/String.js";
7
- import { item, equalsWith } from "./fable_modules/fable-library-js.5.17.2/Array.js";
8
- import { defaultOf } from "./fable_modules/fable-library-js.5.17.2/Util.js";
9
- import { defaultArg } from "./fable_modules/fable-library-js.5.17.2/Option.js";
10
- import { parse } from "./fable_modules/fable-library-js.5.17.2/Int32.js";
5
+ import { collect, map, toList } from "./fable_modules/fable-library-js.5.21.0/Seq.js";
6
+ import { join, concat, split } from "./fable_modules/fable-library-js.5.21.0/String.js";
7
+ import { item, equalsWith } from "./fable_modules/fable-library-js.5.21.0/Array.js";
8
+ import { defaultOf } from "./fable_modules/fable-library-js.5.21.0/Util.js";
9
+ import { defaultArg } from "./fable_modules/fable-library-js.5.21.0/Option.js";
10
+ import { parse } from "./fable_modules/fable-library-js.5.21.0/Int32.js";
11
11
  import { defaultMaxOverloads } from "./Glutinum.Converter/Transformer/UnionOverloads.js";
12
12
  import { GenerateOptions } from "./Glutinum.Converter/Packages.js";
13
13
  import { generateBindingFileWithOptions, generatePackagesFromDisk } from "./Glutinum.Converter/Generate.js";
14
- import { exists, length, head, tail, isEmpty, empty } from "./fable_modules/fable-library-js.5.17.2/List.js";
14
+ import { exists, length, head, tail, isEmpty, empty } from "./fable_modules/fable-library-js.5.21.0/List.js";
15
15
  import { success, error, info } from "./Glutinum.Converter/Log.js";
16
16
  import { program as program_1 } from "commander";
17
17
 
@@ -1,6 +1,6 @@
1
1
 
2
- import { value as value_1 } from "../fable-library-js.5.17.2/Option.js";
3
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
2
+ import { value as value_1 } from "../fable-library-js.5.21.0/Option.js";
3
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
4
4
 
5
5
  /**
6
6
  * Creates AsyncIterable. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of#specifications
@@ -1,8 +1,8 @@
1
1
 
2
- import { Result_MapError, Result_Map, FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
3
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
4
- import { disposeSafe, getEnumerator } from "../fable-library-js.5.17.2/Util.js";
5
- import { Operators_IsNull } from "../fable-library-js.5.17.2/FSharp.Core.js";
2
+ import { Result_MapError, Result_Map, FSharpResult$2 } from "../fable-library-js.5.21.0/Result.js";
3
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
4
+ import { disposeSafe, getEnumerator } from "../fable-library-js.5.21.0/Util.js";
5
+ import { Operators_IsNull } from "../fable-library-js.5.21.0/FSharp.Core.js";
6
6
 
7
7
  /**
8
8
  * This is an identity function, it calls the given function and return the promise value untouched.
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { PromiseBuilder_$ctor } from "./Promise.fs.js";
3
- import { value } from "../fable-library-js.5.17.2/Option.js";
4
- import { FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
3
+ import { value } from "../fable-library-js.5.21.0/Option.js";
4
+ import { FSharpResult$2 } from "../fable-library-js.5.21.0/Result.js";
5
5
 
6
6
  export const promise = PromiseBuilder_$ctor();
7
7
 
@@ -1,9 +1,9 @@
1
1
 
2
- import { append, skip, head, reverse, equalsWith } from "../fable-library-js.5.17.2/Array.js";
3
- import { defaultOf, equals } from "../fable-library-js.5.17.2/Util.js";
4
- import { FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
5
- import { singleton } from "../fable-library-js.5.17.2/AsyncBuilder.js";
6
- import { some, value as value_10 } from "../fable-library-js.5.17.2/Option.js";
2
+ import { append, skip, head, reverse, equalsWith } from "../fable-library-js.5.21.0/Array.js";
3
+ import { defaultOf, equals } from "../fable-library-js.5.21.0/Util.js";
4
+ import { FSharpResult$2 } from "../fable-library-js.5.21.0/Result.js";
5
+ import { singleton } from "../fable-library-js.5.21.0/AsyncBuilder.js";
6
+ import { some, value as value_10 } from "../fable-library-js.5.21.0/Option.js";
7
7
 
8
8
  function traverseResultM$0027(state_mut, f_mut, xs_mut) {
9
9
  traverseResultM$0027:
@@ -1,8 +1,8 @@
1
1
 
2
- import { Exception } from "../fable-library-js.5.17.2/Util.js";
3
- import { fromContinuations, cancellationToken, startWithContinuations } from "../fable-library-js.5.17.2/Async.js";
4
- import { FSharpChoice$3 } from "../fable-library-js.5.17.2/Choice.js";
5
- import { singleton } from "../fable-library-js.5.17.2/AsyncBuilder.js";
2
+ import { Exception } from "../fable-library-js.5.21.0/Util.js";
3
+ import { fromContinuations, cancellationToken, startWithContinuations } from "../fable-library-js.5.21.0/Async.js";
4
+ import { FSharpChoice$3 } from "../fable-library-js.5.21.0/Choice.js";
5
+ import { singleton } from "../fable-library-js.5.21.0/AsyncBuilder.js";
6
6
 
7
7
  export function Microsoft_FSharp_Control_FSharpAsync__Async_TryFinallyAsync_Static_Z753D11A1(comp, deferred) {
8
8
  const finish = (tupledArg, tupledArg_1) => {
@@ -1,7 +1,7 @@
1
1
 
2
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
3
- import { singleton } from "../fable-library-js.5.17.2/AsyncBuilder.js";
4
- import { value as value_2, some } from "../fable-library-js.5.17.2/Option.js";
2
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
3
+ import { singleton } from "../fable-library-js.5.21.0/AsyncBuilder.js";
4
+ import { value as value_2, some } from "../fable-library-js.5.21.0/Option.js";
5
5
 
6
6
  export class AsyncOptionCE_AsyncOptionBuilder {
7
7
  constructor() {
@@ -1,5 +1,5 @@
1
1
 
2
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
2
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
3
3
 
4
4
  export class AsyncResultCE_AsyncResultBuilder {
5
5
  constructor() {
@@ -1,7 +1,7 @@
1
1
 
2
- import { singleton } from "../fable-library-js.5.17.2/AsyncBuilder.js";
3
- import { FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
4
- import { some, value as value_4 } from "../fable-library-js.5.17.2/Option.js";
2
+ import { singleton } from "../fable-library-js.5.21.0/AsyncBuilder.js";
3
+ import { FSharpResult$2 } from "../fable-library-js.5.21.0/Result.js";
4
+ import { some, value as value_4 } from "../fable-library-js.5.21.0/Option.js";
5
5
 
6
6
  export function AsyncResultOption_apply(applier, input) {
7
7
  return singleton.Bind(applier, (x_3) => singleton.Bind(input, (y_2) => {
@@ -1,5 +1,5 @@
1
1
 
2
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
2
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
3
3
 
4
4
  export class AsyncResultOptionCE_AsyncResultOptionBuilder {
5
5
  constructor() {
@@ -1,5 +1,5 @@
1
1
 
2
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
2
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
3
3
 
4
4
  export class AsyncValidationBuilder {
5
5
  constructor() {
@@ -1,8 +1,8 @@
1
1
 
2
- import { append, singleton as singleton_1, empty, reverse, tail, cons, head, isEmpty } from "../fable-library-js.5.17.2/List.js";
3
- import { FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
4
- import { singleton } from "../fable-library-js.5.17.2/AsyncBuilder.js";
5
- import { some, value as value_10 } from "../fable-library-js.5.17.2/Option.js";
2
+ import { append, singleton as singleton_1, empty, reverse, tail, cons, head, isEmpty } from "../fable-library-js.5.21.0/List.js";
3
+ import { FSharpResult$2 } from "../fable-library-js.5.21.0/Result.js";
4
+ import { singleton } from "../fable-library-js.5.21.0/AsyncBuilder.js";
5
+ import { some, value as value_10 } from "../fable-library-js.5.21.0/Option.js";
6
6
 
7
7
  function traverseResultM$0027(state_mut, f_mut, xs_mut) {
8
8
  traverseResultM$0027:
@@ -1,5 +1,5 @@
1
1
 
2
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
2
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
3
3
 
4
4
  export class OptionBuilderBase {
5
5
  constructor() {
@@ -1,7 +1,7 @@
1
1
 
2
- import { Exception } from "../fable-library-js.5.17.2/Util.js";
3
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
4
- import { singleton } from "../fable-library-js.5.17.2/AsyncBuilder.js";
2
+ import { Exception } from "../fable-library-js.5.21.0/Util.js";
3
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
4
+ import { singleton } from "../fable-library-js.5.21.0/AsyncBuilder.js";
5
5
 
6
6
  export class InternalHelpers_AsyncResultErrorException$1 extends Exception {
7
7
  constructor(value) {
@@ -1,5 +1,5 @@
1
1
 
2
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
2
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
3
3
 
4
4
  export class ParallelAsyncResultBuilder {
5
5
  constructor() {
@@ -1,5 +1,5 @@
1
1
 
2
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
2
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
3
3
 
4
4
  export class ParallelAsyncValidationBuilder {
5
5
  constructor() {
@@ -1,5 +1,5 @@
1
1
 
2
- import { FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
2
+ import { FSharpResult$2 } from "../fable-library-js.5.21.0/Result.js";
3
3
 
4
4
  /**
5
5
  * Takes two results and returns a tuple of the pair
@@ -1,6 +1,6 @@
1
1
 
2
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
3
- import { FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
2
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
3
+ import { FSharpResult$2 } from "../fable-library-js.5.21.0/Result.js";
4
4
 
5
5
  export class ResultCE_ResultBuilder {
6
6
  constructor() {
@@ -1,6 +1,6 @@
1
1
 
2
- import { FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
3
- import { value } from "../fable-library-js.5.17.2/Option.js";
2
+ import { FSharpResult$2 } from "../fable-library-js.5.21.0/Result.js";
3
+ import { value } from "../fable-library-js.5.21.0/Option.js";
4
4
 
5
5
  /**
6
6
  * Combines two <c>Result</c> values that contain <c>Option</c> values into a single <c>Result</c> value that contains the tuple of the two values wrapped in an <c>Option</c>, if they are both <c>Some</c>.
@@ -1,5 +1,5 @@
1
1
 
2
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
2
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
3
3
 
4
4
  export class ResultOptionCE_ResultOptionBuilder {
5
5
  constructor() {
@@ -1,11 +1,11 @@
1
1
 
2
- import { empty } from "../fable-library-js.5.17.2/Seq.js";
3
- import { FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
4
- import { Operators_NullArg, Operators_IsNull } from "../fable-library-js.5.17.2/FSharp.Core.js";
5
- import { disposeSafe, getEnumerator, defaultOf } from "../fable-library-js.5.17.2/Util.js";
6
- import { singleton } from "../fable-library-js.5.17.2/AsyncBuilder.js";
7
- import { ArgumentNullException_$ctor_Z721C83C5 } from "../fable-library-js.5.17.2/System.js";
8
- import { value as value_1 } from "../fable-library-js.5.17.2/Option.js";
2
+ import { empty } from "../fable-library-js.5.21.0/Seq.js";
3
+ import { FSharpResult$2 } from "../fable-library-js.5.21.0/Result.js";
4
+ import { Operators_NullArg, Operators_IsNull } from "../fable-library-js.5.21.0/FSharp.Core.js";
5
+ import { disposeSafe, getEnumerator, defaultOf } from "../fable-library-js.5.21.0/Util.js";
6
+ import { singleton } from "../fable-library-js.5.21.0/AsyncBuilder.js";
7
+ import { ArgumentNullException_$ctor_Z721C83C5 } from "../fable-library-js.5.21.0/System.js";
8
+ import { value as value_1 } from "../fable-library-js.5.21.0/Option.js";
9
9
 
10
10
  /**
11
11
  * Applies a function to each element of a sequence and returns a single result
@@ -1,5 +1,5 @@
1
1
 
2
- import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
2
+ import { class_type } from "../fable-library-js.5.21.0/Reflection.js";
3
3
 
4
4
  export class ValidationCE_ValidationBuilder {
5
5
  constructor() {
@@ -86,6 +86,9 @@ export function awaitEvent(event, cancelAction) {
86
86
  }
87
87
  ctx.onCancel(new OperationCanceledException());
88
88
  });
89
+ if (ctx.cancelToken.isCancelled) {
90
+ return;
91
+ }
89
92
  event.AddHandler(handler);
90
93
  });
91
94
  }
@@ -127,15 +130,26 @@ export function sequential(computations) {
127
130
  }
128
131
  export function sleep(millisecondsDueTime) {
129
132
  return protectedCont((ctx) => {
133
+ let completed = false;
130
134
  let tokenId;
131
- const timeoutId = setTimeout(() => {
132
- ctx.cancelToken.removeListener(tokenId);
133
- ctx.onSuccess(void 0);
134
- }, millisecondsDueTime);
135
- tokenId = ctx.cancelToken.addListener(() => {
135
+ const settle = (cancelled) => {
136
+ if (completed) {
137
+ return;
138
+ }
139
+ completed = true;
136
140
  clearTimeout(timeoutId);
137
- ctx.onCancel(new OperationCanceledException());
138
- });
141
+ if (tokenId !== undefined) {
142
+ ctx.cancelToken.removeListener(tokenId);
143
+ }
144
+ if (cancelled) {
145
+ ctx.onCancel(new OperationCanceledException());
146
+ }
147
+ else {
148
+ ctx.onSuccess(void 0);
149
+ }
150
+ };
151
+ const timeoutId = setTimeout(() => settle(false), millisecondsDueTime);
152
+ tokenId = ctx.cancelToken.addListener(() => settle(true));
139
153
  });
140
154
  }
141
155
  export function start(computation, cancellationToken) {
@@ -1,4 +1,12 @@
1
1
  import { Exception, ensureErrorOrException } from "./Util.js";
2
+ // AggregateError requires ES2021; the runtime also supports ES2020 hosts.
3
+ export class CancellationCallbackError extends Exception {
4
+ constructor(errors) {
5
+ // invariant: F# InnerException exposes the first failure without discarding the remaining errors
6
+ super("Cancellation callbacks failed", errors[0]);
7
+ this.errors = errors;
8
+ }
9
+ }
2
10
  export class CancellationToken {
3
11
  constructor(cancelled = false) {
4
12
  this._id = 0;
@@ -11,14 +19,35 @@ export class CancellationToken {
11
19
  cancel() {
12
20
  if (!this._cancelled) {
13
21
  this._cancelled = true;
14
- for (const [, listener] of this._listeners) {
15
- listener();
22
+ // decision: visit newest registrations first, matching .NET; disposal can skip pending callbacks
23
+ const pending = Array.from(this._listeners.keys()).reverse();
24
+ const errors = [];
25
+ for (const id of pending) {
26
+ const listener = this._listeners.get(id);
27
+ this._listeners.delete(id);
28
+ if (listener) {
29
+ try {
30
+ listener();
31
+ }
32
+ catch (error) {
33
+ errors.push(error);
34
+ }
35
+ }
36
+ }
37
+ if (errors.length > 0) {
38
+ throw new CancellationCallbackError(errors);
16
39
  }
17
40
  }
18
41
  }
19
42
  addListener(f) {
20
43
  const id = this._id;
21
- this._listeners.set(this._id++, f);
44
+ this._id++;
45
+ if (this._cancelled) {
46
+ f();
47
+ }
48
+ else {
49
+ this._listeners.set(id, f);
50
+ }
22
51
  return id;
23
52
  }
24
53
  removeListener(id) {
@@ -148,15 +177,31 @@ export class AsyncBuilder {
148
177
  return protectedCont((ctx) => {
149
178
  computation({
150
179
  onSuccess: (x) => {
151
- compensation();
180
+ try {
181
+ compensation();
182
+ }
183
+ catch (error) {
184
+ ctx.onError(ensureErrorOrException(error));
185
+ return;
186
+ }
152
187
  ctx.onSuccess(x);
153
188
  },
154
189
  onError: (x) => {
155
- compensation();
190
+ try {
191
+ compensation();
192
+ }
193
+ catch (error) {
194
+ ctx.onError(ensureErrorOrException(error));
195
+ return;
196
+ }
156
197
  ctx.onError(x);
157
198
  },
158
199
  onCancel: (x) => {
159
- compensation();
200
+ // decision: cancellation remains terminal when compensation throws, matching .NET Async.TryFinally
201
+ try {
202
+ compensation();
203
+ }
204
+ catch { /* Cancellation takes precedence. */ }
160
205
  ctx.onCancel(x);
161
206
  },
162
207
  cancelToken: ctx.cancelToken,