@glutinum/cli 0.13.0 → 0.14.1

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 (319) hide show
  1. package/README.md +19 -1
  2. package/dist/Glutinum.Converter/Abbreviations.js +246 -0
  3. package/dist/Glutinum.Converter/FsharpAST.js +87 -28
  4. package/dist/Glutinum.Converter/Generate.js +55 -8
  5. package/dist/Glutinum.Converter/GlueAST.js +333 -34
  6. package/dist/Glutinum.Converter/Log.js +7 -8
  7. package/dist/Glutinum.Converter/Merge.js +683 -31
  8. package/dist/Glutinum.Converter/Packages.js +308 -0
  9. package/dist/Glutinum.Converter/Printer.js +323 -186
  10. package/dist/Glutinum.Converter/Read.js +279 -6
  11. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +13 -7
  12. package/dist/Glutinum.Converter/Reader/Declaration.js +102 -17
  13. package/dist/Glutinum.Converter/Reader/Documentation.js +168 -73
  14. package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +7 -51
  15. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +64 -15
  16. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +165 -0
  17. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +30 -5
  18. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +122 -4
  19. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +83 -7
  20. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +8 -8
  21. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +11 -9
  22. package/dist/Glutinum.Converter/Reader/NamedTupleMember.js +3 -2
  23. package/dist/Glutinum.Converter/Reader/Node.js +24 -10
  24. package/dist/Glutinum.Converter/Reader/Parameters.js +110 -7
  25. package/dist/Glutinum.Converter/Reader/Report.js +31 -12
  26. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +4 -3
  27. package/dist/Glutinum.Converter/Reader/TypeNode.js +1524 -253
  28. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +75 -20
  29. package/dist/Glutinum.Converter/Reader/TypeParameters.js +8 -5
  30. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +184 -50
  31. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +32 -13
  32. package/dist/Glutinum.Converter/Reader/Types.js +180 -0
  33. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +99 -43
  34. package/dist/Glutinum.Converter/Reader/Utils.js +1143 -55
  35. package/dist/Glutinum.Converter/Reader/VariableStatement.js +59 -14
  36. package/dist/Glutinum.Converter/Transform.js +8292 -1119
  37. package/dist/Glutinum.Converter/TypeScript.Extensions.js +3 -3
  38. package/dist/Glutinum.Converter/TypeScript.js +3 -3
  39. package/dist/Glutinum.Converter/Utils/Keywords.js +6 -6
  40. package/dist/Glutinum.Converter/Utils/List.js +3 -3
  41. package/dist/Glutinum.Converter/Utils/Naming.js +61 -12
  42. package/dist/Glutinum.Converter/Utils/String.js +7 -3
  43. package/dist/Program.js +230 -72
  44. package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs +89 -0
  45. package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/AsyncIterable.fs.js +29 -29
  46. package/dist/fable_modules/Fable.Promise.3.2.1/Fable.Promise.fableproj +25 -0
  47. package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/Promise.fs +842 -766
  48. package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/Promise.fs.js +26 -12
  49. package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/PromiseImpl.fs +31 -31
  50. package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/PromiseImpl.fs.js +5 -5
  51. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs +235 -0
  52. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +384 -0
  53. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AssemblyInfo.fs +4 -4
  54. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Async.fs +89 -9
  55. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Async.fs.js +13 -12
  56. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOption.fs +50 -4
  57. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionCE.fs +30 -39
  58. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionCE.fs.js +10 -10
  59. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResult.fs +52 -8
  60. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultCE.fs +26 -42
  61. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultCE.fs.js +3 -3
  62. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOption.fs +17 -5
  63. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +26 -0
  64. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionCE.fs +31 -33
  65. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionCE.fs.js +3 -3
  66. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidation.fs +1 -6
  67. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationCE.fs +10 -18
  68. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationCE.fs.js +3 -3
  69. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/FsToolkit.ErrorHandling.fableproj +69 -0
  70. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/List.fs +68 -10
  71. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/List.fs.js +47 -41
  72. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Nullness.fs +81 -0
  73. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Option.fs +133 -2
  74. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs +139 -0
  75. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +48 -0
  76. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/OptionOp.fs +3 -3
  77. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs +88 -0
  78. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +30 -0
  79. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs +200 -0
  80. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +18 -0
  81. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidation.fs +34 -0
  82. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs +244 -0
  83. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +18 -0
  84. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Result.fs +87 -0
  85. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Result.fs.js +8 -8
  86. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultCE.fs +8 -23
  87. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultCE.fs.js +5 -5
  88. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOption.fs +1 -1
  89. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOption.fs.js +10 -10
  90. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionCE.fs +7 -18
  91. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionCE.fs.js +3 -3
  92. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs +503 -0
  93. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +295 -0
  94. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Validation.fs +0 -5
  95. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationCE.fs +7 -13
  96. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationCE.fs.js +3 -3
  97. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValueOption.fs +1 -4
  98. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOption.fs +102 -0
  99. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionCE.fs +587 -0
  100. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionOp.fs +10 -0
  101. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +3 -3
  102. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.fs +3 -0
  103. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.1 → FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0}/FsToolkit.ErrorHandling.AssemblyInfo.fs +4 -4
  104. package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +4 -4
  105. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
  106. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Array.js +192 -86
  107. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Async.js +58 -53
  108. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/AsyncBuilder.js +29 -8
  109. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/BigInt.js +71 -46
  110. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/BitConverter.js +2 -2
  111. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Boolean.js +4 -3
  112. package/dist/fable_modules/fable-library-js.5.17.2/CHANGELOG.md +348 -0
  113. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Char.js +64 -31
  114. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Choice.js +2 -2
  115. package/dist/fable_modules/fable-library-js.5.17.2/CollectionUtil.js +182 -0
  116. package/dist/fable_modules/fable-library-js.5.17.2/ConditionalWeakTable.js +21 -0
  117. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Date.js +197 -112
  118. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/DateOffset.js +46 -62
  119. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/DateOnly.js +6 -6
  120. package/dist/fable_modules/fable-library-js.5.17.2/DateOnlyTemporal.js +146 -0
  121. package/dist/fable_modules/fable-library-js.5.17.2/DateTimeFormat.js +523 -0
  122. package/dist/fable_modules/fable-library-js.5.17.2/DateTimeOffsetTemporal.js +283 -0
  123. package/dist/fable_modules/fable-library-js.5.17.2/DateTimeTemporal.js +243 -0
  124. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Decimal.js +39 -13
  125. package/dist/fable_modules/fable-library-js.5.17.2/Directory.js +11 -0
  126. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Double.js +10 -3
  127. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Encoding.js +20 -8
  128. package/dist/fable_modules/fable-library-js.5.17.2/Environment.js +3 -0
  129. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Event.js +10 -1
  130. package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Collections.js +45 -0
  131. package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.js +156 -0
  132. package/dist/fable_modules/fable-library-js.5.17.2/File.js +27 -0
  133. package/dist/fable_modules/fable-library-js.5.17.2/Global.js +29 -0
  134. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Guid.js +33 -12
  135. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Int32.js +17 -17
  136. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/List.js +170 -106
  137. package/dist/fable_modules/fable-library-js.5.17.2/Long.js +38 -0
  138. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MailboxProcessor.js +13 -6
  139. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Map.js +65 -61
  140. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MapUtil.js +22 -4
  141. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MutableMap.js +28 -16
  142. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MutableSet.js +7 -7
  143. package/dist/fable_modules/fable-library-js.5.17.2/Native.js +14 -0
  144. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Numeric.js +44 -3
  145. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Observable.js +5 -3
  146. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Option.js +11 -20
  147. package/dist/fable_modules/fable-library-js.5.17.2/Path.js +31 -0
  148. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Random.js +22 -20
  149. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Range.js +12 -12
  150. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Reflection.js +50 -22
  151. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/RegExp.js +68 -30
  152. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Result.js +6 -6
  153. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Seq.js +229 -104
  154. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Seq2.js +1 -1
  155. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Set.js +153 -113
  156. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/String.js +238 -50
  157. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/System.Collections.Generic.js +30 -14
  158. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/System.Text.js +69 -31
  159. package/dist/fable_modules/fable-library-js.5.17.2/System.js +289 -0
  160. package/dist/fable_modules/fable-library-js.5.17.2/Task.js +27 -0
  161. package/dist/fable_modules/fable-library-js.5.17.2/TaskBuilder.js +72 -0
  162. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/TimeOnly.js +6 -6
  163. package/dist/fable_modules/fable-library-js.5.17.2/TimeOnlyTemporal.js +142 -0
  164. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/TimeSpan.js +18 -15
  165. package/dist/fable_modules/fable-library-js.5.17.2/TimeSpanTemporal.js +259 -0
  166. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Types.js +14 -24
  167. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Uri.js +44 -21
  168. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Util.js +49 -12
  169. package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/lib/big.js +14 -11
  170. package/dist/fable_modules/fable-library-js.5.17.2/package.json +24 -0
  171. package/dist/fable_modules/fable-library-js.5.17.2/quotation.js +682 -0
  172. package/package.json +4 -4
  173. package/src/Glutinum.Converter/js/bootstrap.js +109 -2
  174. package/src/Glutinum.Converter/js/host.js +144 -0
  175. package/src/Glutinum.Converter/js/npm.js +137 -0
  176. package/src/Glutinum.Converter/js/resolve.js +402 -0
  177. package/dist/Glutinum.Converter/FsharpAST.js.map +0 -1
  178. package/dist/Glutinum.Converter/Generate.js.map +0 -1
  179. package/dist/Glutinum.Converter/GlueAST.js.map +0 -1
  180. package/dist/Glutinum.Converter/Log.js.map +0 -1
  181. package/dist/Glutinum.Converter/Merge.js.map +0 -1
  182. package/dist/Glutinum.Converter/Printer.js.map +0 -1
  183. package/dist/Glutinum.Converter/Read.js.map +0 -1
  184. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js.map +0 -1
  185. package/dist/Glutinum.Converter/Reader/Declaration.js.map +0 -1
  186. package/dist/Glutinum.Converter/Reader/Documentation.js.map +0 -1
  187. package/dist/Glutinum.Converter/Reader/EnumDeclaration.js.map +0 -1
  188. package/dist/Glutinum.Converter/Reader/ExportAssignment.js.map +0 -1
  189. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js.map +0 -1
  190. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js.map +0 -1
  191. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js.map +0 -1
  192. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js.map +0 -1
  193. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js.map +0 -1
  194. package/dist/Glutinum.Converter/Reader/NamedTupleMember.js.map +0 -1
  195. package/dist/Glutinum.Converter/Reader/Node.js.map +0 -1
  196. package/dist/Glutinum.Converter/Reader/Parameters.js.map +0 -1
  197. package/dist/Glutinum.Converter/Reader/Report.js.map +0 -1
  198. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js.map +0 -1
  199. package/dist/Glutinum.Converter/Reader/TypeNode.js.map +0 -1
  200. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js.map +0 -1
  201. package/dist/Glutinum.Converter/Reader/TypeParameters.js.map +0 -1
  202. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js.map +0 -1
  203. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js.map +0 -1
  204. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js.map +0 -1
  205. package/dist/Glutinum.Converter/Reader/Utils.js.map +0 -1
  206. package/dist/Glutinum.Converter/Reader/VariableStatement.js.map +0 -1
  207. package/dist/Glutinum.Converter/Transform.js.map +0 -1
  208. package/dist/Glutinum.Converter/TypeScript.Extensions.js.map +0 -1
  209. package/dist/Glutinum.Converter/TypeScript.js.map +0 -1
  210. package/dist/Glutinum.Converter/Utils/Keywords.js.map +0 -1
  211. package/dist/Glutinum.Converter/Utils/List.js.map +0 -1
  212. package/dist/Glutinum.Converter/Utils/Naming.js.map +0 -1
  213. package/dist/Glutinum.Converter/Utils/String.js.map +0 -1
  214. package/dist/Program.js.map +0 -1
  215. package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +0 -57
  216. package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js.map +0 -1
  217. package/dist/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +0 -20
  218. package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs.js.map +0 -1
  219. package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +0 -1
  220. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs.js.map +0 -1
  221. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs.js.map +0 -1
  222. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs.js.map +0 -1
  223. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js +0 -26
  224. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js.map +0 -1
  225. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs.js.map +0 -1
  226. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs.js.map +0 -1
  227. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/FsToolkit.ErrorHandling.fableproj +0 -51
  228. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs.js.map +0 -1
  229. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs +0 -186
  230. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js +0 -18
  231. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js.map +0 -1
  232. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs.js.map +0 -1
  233. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs.js.map +0 -1
  234. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs.js.map +0 -1
  235. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs.js.map +0 -1
  236. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs +0 -19
  237. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js +0 -31
  238. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js.map +0 -1
  239. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs +0 -22
  240. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js +0 -18
  241. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js.map +0 -1
  242. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs.js.map +0 -1
  243. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValueOptionCE.fs +0 -165
  244. package/dist/fable_modules/fable-library-js.4.14.0/Array.d.ts +0 -123
  245. package/dist/fable_modules/fable-library-js.4.14.0/Async.d.ts +0 -32
  246. package/dist/fable_modules/fable-library-js.4.14.0/AsyncBuilder.d.ts +0 -59
  247. package/dist/fable_modules/fable-library-js.4.14.0/BigInt.d.ts +0 -115
  248. package/dist/fable_modules/fable-library-js.4.14.0/BitConverter.d.ts +0 -27
  249. package/dist/fable_modules/fable-library-js.4.14.0/Boolean.d.ts +0 -3
  250. package/dist/fable_modules/fable-library-js.4.14.0/CHANGELOG.md +0 -37
  251. package/dist/fable_modules/fable-library-js.4.14.0/Char.d.ts +0 -65
  252. package/dist/fable_modules/fable-library-js.4.14.0/Choice.d.ts +0 -121
  253. package/dist/fable_modules/fable-library-js.4.14.0/Date.d.ts +0 -70
  254. package/dist/fable_modules/fable-library-js.4.14.0/DateOffset.d.ts +0 -63
  255. package/dist/fable_modules/fable-library-js.4.14.0/DateOnly.d.ts +0 -18
  256. package/dist/fable_modules/fable-library-js.4.14.0/Decimal.d.ts +0 -45
  257. package/dist/fable_modules/fable-library-js.4.14.0/Double.d.ts +0 -11
  258. package/dist/fable_modules/fable-library-js.4.14.0/Encoding.d.ts +0 -12
  259. package/dist/fable_modules/fable-library-js.4.14.0/Event.d.ts +0 -31
  260. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.d.ts +0 -7
  261. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.js +0 -27
  262. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.CompilerServices.d.ts +0 -12
  263. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.d.ts +0 -17
  264. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.js +0 -69
  265. package/dist/fable_modules/fable-library-js.4.14.0/Global.d.ts +0 -24
  266. package/dist/fable_modules/fable-library-js.4.14.0/Global.js +0 -8
  267. package/dist/fable_modules/fable-library-js.4.14.0/Guid.d.ts +0 -10
  268. package/dist/fable_modules/fable-library-js.4.14.0/Int32.d.ts +0 -28
  269. package/dist/fable_modules/fable-library-js.4.14.0/List.d.ts +0 -143
  270. package/dist/fable_modules/fable-library-js.4.14.0/Long.d.ts +0 -3
  271. package/dist/fable_modules/fable-library-js.4.14.0/Long.js +0 -46
  272. package/dist/fable_modules/fable-library-js.4.14.0/MailboxProcessor.d.ts +0 -25
  273. package/dist/fable_modules/fable-library-js.4.14.0/Map.d.ts +0 -178
  274. package/dist/fable_modules/fable-library-js.4.14.0/MapUtil.d.ts +0 -10
  275. package/dist/fable_modules/fable-library-js.4.14.0/MutableMap.d.ts +0 -52
  276. package/dist/fable_modules/fable-library-js.4.14.0/MutableSet.d.ts +0 -39
  277. package/dist/fable_modules/fable-library-js.4.14.0/Native.d.ts +0 -2
  278. package/dist/fable_modules/fable-library-js.4.14.0/Native.js +0 -8
  279. package/dist/fable_modules/fable-library-js.4.14.0/Numeric.d.ts +0 -19
  280. package/dist/fable_modules/fable-library-js.4.14.0/Observable.d.ts +0 -32
  281. package/dist/fable_modules/fable-library-js.4.14.0/Option.d.ts +0 -28
  282. package/dist/fable_modules/fable-library-js.4.14.0/Random.d.ts +0 -37
  283. package/dist/fable_modules/fable-library-js.4.14.0/Range.d.ts +0 -12
  284. package/dist/fable_modules/fable-library-js.4.14.0/Reflection.d.ts +0 -119
  285. package/dist/fable_modules/fable-library-js.4.14.0/RegExp.d.ts +0 -10
  286. package/dist/fable_modules/fable-library-js.4.14.0/Result.d.ts +0 -37
  287. package/dist/fable_modules/fable-library-js.4.14.0/Seq.d.ts +0 -165
  288. package/dist/fable_modules/fable-library-js.4.14.0/Seq2.d.ts +0 -18
  289. package/dist/fable_modules/fable-library-js.4.14.0/Set.d.ts +0 -190
  290. package/dist/fable_modules/fable-library-js.4.14.0/String.d.ts +0 -50
  291. package/dist/fable_modules/fable-library-js.4.14.0/System.Collections.Generic.d.ts +0 -79
  292. package/dist/fable_modules/fable-library-js.4.14.0/System.Text.d.ts +0 -38
  293. package/dist/fable_modules/fable-library-js.4.14.0/SystemException.d.ts +0 -5
  294. package/dist/fable_modules/fable-library-js.4.14.0/SystemException.js +0 -5
  295. package/dist/fable_modules/fable-library-js.4.14.0/TimeOnly.d.ts +0 -15
  296. package/dist/fable_modules/fable-library-js.4.14.0/TimeSpan.d.ts +0 -34
  297. package/dist/fable_modules/fable-library-js.4.14.0/Timer.d.ts +0 -19
  298. package/dist/fable_modules/fable-library-js.4.14.0/Types.d.ts +0 -58
  299. package/dist/fable_modules/fable-library-js.4.14.0/Unicode.13.0.0.d.ts +0 -2
  300. package/dist/fable_modules/fable-library-js.4.14.0/Uri.d.ts +0 -29
  301. package/dist/fable_modules/fable-library-js.4.14.0/Util.d.ts +0 -207
  302. package/dist/fable_modules/fable-library-js.4.14.0/lib/big.d.ts +0 -5
  303. package/dist/fable_modules/fable-library-js.4.14.0/package.json +0 -24
  304. package/dist/fable_modules/project_cracked.json +0 -1
  305. /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionOp.fs +0 -0
  306. /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOp.fs +0 -0
  307. /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionOp.fs +0 -0
  308. /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationOp.fs +0 -0
  309. /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOp.fs +0 -0
  310. /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionOp.fs +0 -0
  311. /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationOp.fs +0 -0
  312. /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -0
  313. /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
  314. /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -0
  315. /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/FSharp.Core.CompilerServices.js +0 -0
  316. /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/README.md +0 -0
  317. /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Timer.js +0 -0
  318. /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Unicode.13.0.0.js +0 -0
  319. /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/big.d.ts +0 -0
@@ -1,6 +1,7 @@
1
1
  import { Record, Union } from "./Types.js";
2
- import { combineHashCodes, equalArraysWith, stringHash } from "./Util.js";
2
+ import { Exception, combineHashCodes, equalArraysWith, stringHash } from "./Util.js";
3
3
  import Decimal from "./Decimal.js";
4
+ import { Some, some } from "./Option.js";
4
5
  export class CaseInfo {
5
6
  constructor(declaringType, tag, name, fields) {
6
7
  this.declaringType = declaringType;
@@ -85,10 +86,18 @@ export function lambda_type(argType, returnType) {
85
86
  return new TypeInfo("Microsoft.FSharp.Core.FSharpFunc`2", [argType, returnType]);
86
87
  }
87
88
  export function option_type(generic) {
88
- return new TypeInfo("Microsoft.FSharp.Core.FSharpOption`1", [generic]);
89
+ const t = new TypeInfo("Microsoft.FSharp.Core.FSharpOption`1", [generic], undefined, undefined, undefined, () => [
90
+ new CaseInfo(t, 0, "None"),
91
+ new CaseInfo(t, 1, "Some", [["value", generic]])
92
+ ]);
93
+ return t;
89
94
  }
90
95
  export function list_type(generic) {
91
- return new TypeInfo("Microsoft.FSharp.Collections.FSharpList`1", [generic]);
96
+ const t = new TypeInfo("Microsoft.FSharp.Collections.FSharpList`1", [generic], undefined, undefined, undefined, () => [
97
+ new CaseInfo(t, 0, "Empty"),
98
+ new CaseInfo(t, 1, "Cons", [["Head", generic], ["Tail", t]])
99
+ ]);
100
+ return t;
92
101
  }
93
102
  export function array_type(generic) {
94
103
  return new TypeInfo("[]", [generic]);
@@ -135,7 +144,7 @@ export function name(info) {
135
144
  }
136
145
  else {
137
146
  const i = info.fullname.lastIndexOf(".");
138
- return i === -1 ? info.fullname : info.fullname.substr(i + 1);
147
+ return i === -1 ? info.fullname : info.fullname.slice(i + 1);
139
148
  }
140
149
  }
141
150
  else {
@@ -161,7 +170,7 @@ export function namespace(t) {
161
170
  }
162
171
  else {
163
172
  const i = t.fullname.lastIndexOf(".");
164
- return i === -1 ? "" : t.fullname.substr(0, i);
173
+ return i === -1 ? "" : t.fullname.slice(0, i);
165
174
  }
166
175
  }
167
176
  export function isArray(t) {
@@ -239,7 +248,7 @@ export function getEnumValues(t) {
239
248
  return t.enumCases.map((kv) => kv[1]);
240
249
  }
241
250
  else {
242
- throw new Error(`${t.fullname} is not an enum type`);
251
+ throw new Exception(`${t.fullname} is not an enum type`);
243
252
  }
244
253
  }
245
254
  export function getEnumNames(t) {
@@ -247,7 +256,7 @@ export function getEnumNames(t) {
247
256
  return t.enumCases.map((kv) => kv[0]);
248
257
  }
249
258
  else {
250
- throw new Error(`${t.fullname} is not an enum type`);
259
+ throw new Exception(`${t.fullname} is not an enum type`);
251
260
  }
252
261
  }
253
262
  function getEnumCase(t, v) {
@@ -258,7 +267,7 @@ function getEnumCase(t, v) {
258
267
  return kv;
259
268
  }
260
269
  }
261
- throw new Error(`'${v}' was not found in ${t.fullname}`);
270
+ throw new Exception(`'${v}' was not found in ${t.fullname}`);
262
271
  }
263
272
  else {
264
273
  for (const kv of t.enumCases) {
@@ -271,7 +280,7 @@ function getEnumCase(t, v) {
271
280
  }
272
281
  }
273
282
  else {
274
- throw new Error(`${t.fullname} is not an enum type`);
283
+ throw new Exception(`${t.fullname} is not an enum type`);
275
284
  }
276
285
  }
277
286
  export function parseEnum(t, str) {
@@ -307,7 +316,7 @@ export function getUnionCases(t) {
307
316
  return t.cases();
308
317
  }
309
318
  else {
310
- throw new Error(`${t.fullname} is not an F# union type`);
319
+ throw new Exception(`${t.fullname} is not an F# union type`);
311
320
  }
312
321
  }
313
322
  export function getRecordElements(t) {
@@ -315,7 +324,7 @@ export function getRecordElements(t) {
315
324
  return t.fields();
316
325
  }
317
326
  else {
318
- throw new Error(`${t.fullname} is not an F# record type`);
327
+ throw new Exception(`${t.fullname} is not an F# record type`);
319
328
  }
320
329
  }
321
330
  export function getTupleElements(t) {
@@ -323,7 +332,7 @@ export function getTupleElements(t) {
323
332
  return t.generics;
324
333
  }
325
334
  else {
326
- throw new Error(`${t.fullname} is not a tuple type`);
335
+ throw new Exception(`${t.fullname} is not a tuple type`);
327
336
  }
328
337
  }
329
338
  export function getFunctionElements(t) {
@@ -332,7 +341,7 @@ export function getFunctionElements(t) {
332
341
  return [gen[0], gen[1]];
333
342
  }
334
343
  else {
335
- throw new Error(`${t.fullname} is not an F# function type`);
344
+ throw new Exception(`${t.fullname} is not an F# function type`);
336
345
  }
337
346
  }
338
347
  export function isUnion(t) {
@@ -351,9 +360,19 @@ export function isFunction(t) {
351
360
  // FSharpValue
352
361
  export function getUnionFields(v, t) {
353
362
  const cases = getUnionCases(t);
363
+ // Special handling for option types (None is undefined, Some is the value or a Some wrapper)
364
+ if (t.fullname === "Microsoft.FSharp.Core.FSharpOption`1") {
365
+ if (v == null) {
366
+ return [cases[0], []]; // None case
367
+ }
368
+ else {
369
+ const innerValue = v instanceof Some ? v.value : v;
370
+ return [cases[1], [innerValue]]; // Some case
371
+ }
372
+ }
354
373
  const case_ = cases[v.tag];
355
374
  if (case_ == null) {
356
- throw new Error(`Cannot find case ${v.name} in union type`);
375
+ throw new Exception(`Cannot find case ${v.name} in union type`);
357
376
  }
358
377
  return [case_, v.fields];
359
378
  }
@@ -362,8 +381,14 @@ export function getUnionCaseFields(uci) {
362
381
  }
363
382
  // This is used as replacement of `FSharpValue.GetRecordFields`
364
383
  // For `FSharpTypes.GetRecordFields` see `getRecordElements`
365
- // Object.keys returns keys in the order they were added to the object
366
- export function getRecordFields(v) {
384
+ // TypeInfo is used when available to enumerate fields by name: anonymous record None fields
385
+ // are omitted from the JS object, so Object.keys alone would miss them.
386
+ // Boxed anonymous record would are still not covered but this is the best we can do for now
387
+ // without adding a __fields__ to every anonymous record being created
388
+ export function getRecordFields(v, t) {
389
+ if (t.fields != null) {
390
+ return t.fields().map(([key, _]) => v[key]);
391
+ }
367
392
  return Object.keys(v).map((k) => v[k]);
368
393
  }
369
394
  export function getRecordField(v, field) {
@@ -378,7 +403,11 @@ export function getTupleField(v, i) {
378
403
  export function makeUnion(uci, values) {
379
404
  const expectedLength = (uci.fields || []).length;
380
405
  if (values.length !== expectedLength) {
381
- throw new Error(`Expected an array of length ${expectedLength} but got ${values.length}`);
406
+ throw new Exception(`Expected an array of length ${expectedLength} but got ${values.length}`);
407
+ }
408
+ // Special handling for option types
409
+ if (uci.declaringType.fullname === "Microsoft.FSharp.Core.FSharpOption`1") {
410
+ return uci.tag === 0 ? undefined : some(values[0]);
382
411
  }
383
412
  const construct = uci.declaringType.construct;
384
413
  if (construct == null) {
@@ -395,7 +424,7 @@ export function makeUnion(uci, values) {
395
424
  export function makeRecord(t, values) {
396
425
  const fields = getRecordElements(t);
397
426
  if (fields.length !== values.length) {
398
- throw new Error(`Expected an array of length ${fields.length} but got ${values.length}`);
427
+ throw new Exception(`Expected an array of length ${fields.length} but got ${values.length}`);
399
428
  }
400
429
  return t.construct != null
401
430
  ? new t.construct(...values)
@@ -431,10 +460,9 @@ export function createInstance(t, consArgs) {
431
460
  case decimal_type.fullname:
432
461
  return new Decimal(0);
433
462
  case char_type.fullname:
434
- // Even though char is a value type, it's erased to string, and Unchecked.defaultof<char> is null
435
- return null;
463
+ return "\0";
436
464
  default:
437
- throw new Error(`Cannot access constructor of ${t.fullname}`);
465
+ throw new Exception(`Cannot access constructor of ${t.fullname}`);
438
466
  }
439
467
  }
440
468
  }
@@ -444,7 +472,7 @@ export function getValue(propertyInfo, v) {
444
472
  // Fable.Core.Reflection
445
473
  function assertUnion(x) {
446
474
  if (!(x instanceof Union)) {
447
- throw new Error(`Value is not an F# union type`);
475
+ throw new Exception(`Value is not an F# union type`);
448
476
  }
449
477
  }
450
478
  export function getCaseTag(x) {
@@ -1,3 +1,4 @@
1
+ import { Exception } from "./Util.js";
1
2
  export function create(pattern, options = 0) {
2
3
  // Supported RegexOptions
3
4
  // * IgnoreCase: 0x0001
@@ -6,7 +7,7 @@ export function create(pattern, options = 0) {
6
7
  // * Singleline: 0x0010
7
8
  // * ECMAScript: 0x0100 (ignored)
8
9
  if ((options & ~(1 ^ 2 ^ 8 ^ 16 ^ 256)) !== 0) {
9
- throw new Error("RegexOptions only supports: IgnoreCase, Multiline, Compiled, Singleline and ECMAScript");
10
+ throw new Exception("RegexOptions only supports: IgnoreCase, Multiline, Compiled, Singleline and ECMAScript");
10
11
  }
11
12
  // Set always global and unicode flags for compatibility with dotnet, see #2925
12
13
  let flags = "gu";
@@ -17,10 +18,19 @@ export function create(pattern, options = 0) {
17
18
  }
18
19
  // From http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
19
20
  export function escape(str) {
20
- return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
21
+ // Matches the characters escaped by .NET's Regex.Escape.
22
+ // Note:
23
+ //
24
+ // .NET also escapes space and # (relevant for IgnorePatternWhitespace mode),
25
+ // but JS unicode-mode regex rejects \ and \# as invalid escapes, and we don't
26
+ // support IgnorePatternWhitespace, so we omit them.
27
+ //
28
+ // .NET does not escape ] and } but JS unicode-mode regex rejects bare ] and }
29
+ // as invalid, so we escape them too for compatibility.
30
+ return str.replace(/[$()*+.?[\\\^{|}\]]/g, "\\$&");
21
31
  }
22
32
  export function unescape(str) {
23
- return str.replace(/\\([\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|])/g, "$1");
33
+ return str.replace(/\\([$()*+.?[\\\^{|}\]])/g, "$1");
24
34
  }
25
35
  export function isMatch(reg, input, startAt = 0) {
26
36
  reg.lastIndex = startAt;
@@ -32,16 +42,15 @@ export function match(reg, input, startAt = 0) {
32
42
  }
33
43
  export function matches(reg, input, startAt = 0) {
34
44
  if (input == null) {
35
- throw new Error("Input cannot ve null");
45
+ throw new Exception("Input cannot ve null");
36
46
  }
37
47
  if (!reg.global) {
38
- throw new Error("Non-global RegExp"); // Prevent infinite loop
48
+ throw new Exception("Non-global RegExp"); // Prevent infinite loop
39
49
  }
40
50
  reg.lastIndex = startAt;
41
51
  const matches = [];
42
52
  let m;
43
53
  let lastMatchIndex = -1;
44
- // tslint:disable-next-line:no-conditional-assignment
45
54
  while ((m = reg.exec(input)) != null) {
46
55
  // It can happen even global regex get stuck, see #2845
47
56
  if (m.index === lastMatchIndex) {
@@ -96,29 +105,38 @@ export function replace(reg, input, replacement, limit, offset = 0) {
96
105
  input = tmp;
97
106
  limit = undefined;
98
107
  }
99
- if (typeof replacement === "function") {
100
- limit = limit == null ? -1 : limit;
101
- return input.substring(0, offset) + input.substring(offset).replace(reg, replacer);
102
- }
103
- else {
104
- replacement =
105
- replacement
106
- // $0 doesn't work with JS regex, see #1155
107
- .replace(/\$0/g, (_s) => "$&")
108
- // named groups in replacement are `${name}` in .Net, but `$<name>` in JS (in regex: groups are `(?<name>...)` in both)
109
- .replace(/\${([^}]+)}/g, "\$<$1>");
110
- if (limit != null) {
111
- let m;
112
- const sub1 = input.substring(offset);
113
- const _matches = matches(reg, sub1);
114
- const sub2 = matches.length > limit ? (m = _matches[limit - 1], sub1.substring(0, m.index + m[0].length)) : sub1;
115
- return input.substring(0, offset) + sub2.replace(reg, replacement)
116
- + input.substring(offset + sub2.length);
117
- }
118
- else {
119
- return input.replace(reg, replacement);
120
- }
108
+ if (typeof replacement === "string") {
109
+ const rep = replacement;
110
+ // .NET replacement patterns cannot be rewritten as JS replacement strings unambiguously
111
+ // (e.g. `$$0` must stay literal "$0", `$0` doesn't work with JS regex (see #1155), and
112
+ // `${1}` followed by a digit must not become `$1` + digit), so interpret them with an
113
+ // evaluator instead, honoring the `$$` escape left-to-right
114
+ replacement = (match) => rep.replace(/\$(?:(\$)|(&)|(`)|(')|(\d+)|\{(\d+)\}|\{([^}]+)\})/g, (s, dollar, and, before, after, num, numBraced, name) => {
115
+ if (dollar != null) {
116
+ return "$";
117
+ }
118
+ if (and != null) {
119
+ return match[0];
120
+ }
121
+ if (before != null) {
122
+ return match.input.substring(0, match.index);
123
+ }
124
+ if (after != null) {
125
+ return match.input.substring(match.index + match[0].length);
126
+ }
127
+ const n = num ?? numBraced;
128
+ if (n != null) {
129
+ const i = parseInt(n, 10);
130
+ // Same as .NET: an unmatched group is replaced by an empty string,
131
+ // a nonexistent group number keeps the substitution pattern literally
132
+ return i < match.length ? (match[i] ?? "") : s;
133
+ }
134
+ // Named groups are `${name}` in .NET (in regex: groups are `(?<name>...)` in both)
135
+ return match.groups != null && name in match.groups ? (match.groups[name] ?? "") : s;
136
+ });
121
137
  }
138
+ limit = limit == null ? -1 : limit;
139
+ return input.substring(0, offset) + input.substring(offset).replace(reg, replacer);
122
140
  }
123
141
  export function split(reg, input, limit, offset = 0) {
124
142
  if (typeof reg === "string") {
@@ -127,6 +145,26 @@ export function split(reg, input, limit, offset = 0) {
127
145
  input = tmp;
128
146
  limit = undefined;
129
147
  }
130
- input = input.substring(offset);
131
- return input.split(reg, limit);
148
+ // JS String.split(regex, limit) truncates the result and discards the remainder,
149
+ // whereas .NET keeps it in the last element (`limit` is the max number of elements),
150
+ // keeps the text before `offset` in the first element and includes the values of
151
+ // matched capture groups, so iterate the matches manually like .NET Regex.Split does
152
+ const result = [];
153
+ let prev = 0;
154
+ let count = limit == null ? -1 : limit - 1;
155
+ for (const m of matches(reg, input, offset)) {
156
+ if (count === 0) {
157
+ break;
158
+ }
159
+ result.push(input.substring(prev, m.index));
160
+ prev = m.index + m[0].length;
161
+ for (let i = 1; i < m.length; i++) {
162
+ if (m[i] !== undefined) {
163
+ result.push(m[i]);
164
+ }
165
+ }
166
+ count--;
167
+ }
168
+ result.push(input.substring(prev));
169
+ return result;
132
170
  }
@@ -6,7 +6,7 @@ import { some } from "./Option.js";
6
6
  export function FSharpResult$2_Ok(ResultValue) {
7
7
  return new FSharpResult$2(0, [ResultValue]);
8
8
  }
9
- export function FSharpResult$2_Error(ErrorValue) {
9
+ export function FSharpResult$2_Error$(ErrorValue) {
10
10
  return new FSharpResult$2(1, [ErrorValue]);
11
11
  }
12
12
  export class FSharpResult$2 extends Union {
@@ -27,7 +27,7 @@ export function Result_Map(mapping, result) {
27
27
  return FSharpResult$2_Ok(mapping(result.fields[0]));
28
28
  }
29
29
  else {
30
- return FSharpResult$2_Error(result.fields[0]);
30
+ return FSharpResult$2_Error$(result.fields[0]);
31
31
  }
32
32
  }
33
33
  export function Result_MapError(mapping, result) {
@@ -35,7 +35,7 @@ export function Result_MapError(mapping, result) {
35
35
  return FSharpResult$2_Ok(result.fields[0]);
36
36
  }
37
37
  else {
38
- return FSharpResult$2_Error(mapping(result.fields[0]));
38
+ return FSharpResult$2_Error$(mapping(result.fields[0]));
39
39
  }
40
40
  }
41
41
  export function Result_Bind(binder, result) {
@@ -43,7 +43,7 @@ export function Result_Bind(binder, result) {
43
43
  return binder(result.fields[0]);
44
44
  }
45
45
  else {
46
- return FSharpResult$2_Error(result.fields[0]);
46
+ return FSharpResult$2_Error$(result.fields[0]);
47
47
  }
48
48
  }
49
49
  export function Result_IsOk(result) {
@@ -152,7 +152,7 @@ export function Result_ToOption(result) {
152
152
  return some(result.fields[0]);
153
153
  }
154
154
  else {
155
- return void 0;
155
+ return undefined;
156
156
  }
157
157
  }
158
158
  export function Result_ToValueOption(result) {
@@ -160,6 +160,6 @@ export function Result_ToValueOption(result) {
160
160
  return some(result.fields[0]);
161
161
  }
162
162
  else {
163
- return void 0;
163
+ return undefined;
164
164
  }
165
165
  }