@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
@@ -0,0 +1,142 @@
1
+ import { toInt64, fromFloat64 } from "./BigInt.js";
2
+ import { fromTicks as TimeSpan_fromTicks, totalNanoseconds as TimeSpan_totalNanoseconds } from "./TimeSpanTemporal.js";
3
+ import { Exception } from "./Util.js";
4
+ export const PlainTime = Temporal.PlainTime;
5
+ // The generic equality/comparison/hashing helpers in Util.ts dispatch at runtime
6
+ // on .NET-style Equals/CompareTo/GetHashCode methods. Attach them so TimeOnly
7
+ // also works in generic contexts: records, tuples, erased generics, etc.
8
+ const proto = Temporal.PlainTime.prototype;
9
+ proto.Equals = function (other) { return this.equals(other); };
10
+ proto.CompareTo = function (other) { return Temporal.PlainTime.compare(this, other); };
11
+ proto.GetHashCode = function () { return hash(this); };
12
+ // Lets String.Format format this value without String.ts importing this module (see String.ts)
13
+ proto[Symbol.for("Fable.DateTimeFormattable")] = function (format) { return toString(this, format); };
14
+ const nanosecondsPerDay = 86400000000000;
15
+ const nanosecondsPerDayBig = 86400000000000n;
16
+ function totalNanoseconds(t) {
17
+ return ((t.hour * 60 + t.minute) * 60 + t.second) * 1000000000
18
+ + t.millisecond * 1000000 + t.microsecond * 1000 + t.nanosecond;
19
+ }
20
+ function fromNanoseconds(n) {
21
+ return new Temporal.PlainTime(Math.floor(n / 3600000000000), Math.floor(n / 60000000000) % 60, Math.floor(n / 1000000000) % 60, Math.floor(n / 1000000) % 1000, Math.floor(n / 1000) % 1000, n % 1000);
22
+ }
23
+ export function create(h = 0, m = 0, s = 0, ms = 0, us = 0) {
24
+ return new Temporal.PlainTime(h, m, s, ms, us);
25
+ }
26
+ export function fromTicks(ticks) {
27
+ return fromNanoseconds(Number(BigInt(ticks) * 100n));
28
+ }
29
+ export function fromTimeSpan(timeSpan) {
30
+ const ns = Number(TimeSpan_totalNanoseconds(timeSpan));
31
+ if (ns < 0 || ns >= nanosecondsPerDay)
32
+ throw new Exception("The TimeSpan describes an unrepresentable TimeOnly.");
33
+ return fromNanoseconds(ns);
34
+ }
35
+ export function fromDateTime(d) {
36
+ // Under the Temporal representation a DateTime is a PlainDateTime (kind-agnostic wall-clock)
37
+ return new Temporal.PlainTime(d.hour, d.minute, d.second, d.millisecond, d.microsecond, d.nanosecond);
38
+ }
39
+ export function minValue() {
40
+ return new Temporal.PlainTime();
41
+ }
42
+ export function maxValue() {
43
+ // This is "23:59:59.9999999" (.NET tick precision)
44
+ return new Temporal.PlainTime(23, 59, 59, 999, 999, 900);
45
+ }
46
+ export function ticks(t) {
47
+ return toInt64(fromFloat64(totalNanoseconds(t) / 100));
48
+ }
49
+ export function toTimeSpan(t) {
50
+ // TimeOnly is tick-precise, so the nanosecond count is always a multiple of 100.
51
+ return TimeSpan_fromTicks(Math.round(totalNanoseconds(t) / 100));
52
+ }
53
+ // Kept in bigint: a TimeOnly itself always fits a float64 exactly (under 2^47 ns),
54
+ // but the amount added does not — a TimeSpan of more than ~104 days already
55
+ // exceeds Number.MAX_SAFE_INTEGER in nanoseconds, and .NET wraps it modulo a day
56
+ // rather than saturating, so the low ticks are the part that must survive.
57
+ function addNanoseconds(t, deltaNs, wrappedDays) {
58
+ const totalNs = BigInt(totalNanoseconds(t)) + deltaNs;
59
+ let days = totalNs / nanosecondsPerDayBig;
60
+ let remainder = totalNs % nanosecondsPerDayBig;
61
+ // BigInt division truncates toward zero; .NET wraps toward the previous day.
62
+ if (remainder < 0n) {
63
+ remainder += nanosecondsPerDayBig;
64
+ days -= 1n;
65
+ }
66
+ if (wrappedDays !== undefined) {
67
+ wrappedDays.contents = Number(days);
68
+ }
69
+ return fromNanoseconds(Number(remainder));
70
+ }
71
+ export function add(t, ts, wrappedDays) {
72
+ return addNanoseconds(t, TimeSpan_totalNanoseconds(ts), wrappedDays);
73
+ }
74
+ export function addHours(t, h) {
75
+ // Scale to ticks first, as .NET does, then widen — `h` hours in nanoseconds
76
+ // overflows the exact float64 range two orders of magnitude sooner.
77
+ return addNanoseconds(t, BigInt(Math.round(h * 36000000000)) * 100n);
78
+ }
79
+ export function addMinutes(t, m) {
80
+ return addNanoseconds(t, BigInt(Math.round(m * 600000000)) * 100n);
81
+ }
82
+ export function isBetween(t, start, end) {
83
+ return Temporal.PlainTime.compare(start, end) <= 0
84
+ ? (Temporal.PlainTime.compare(start, t) <= 0 && Temporal.PlainTime.compare(end, t) > 0)
85
+ : (Temporal.PlainTime.compare(start, t) <= 0 || Temporal.PlainTime.compare(end, t) > 0);
86
+ }
87
+ export function equals(x, y) {
88
+ return x.equals(y);
89
+ }
90
+ export function compare(x, y) {
91
+ return Temporal.PlainTime.compare(x, y);
92
+ }
93
+ export function hash(t) {
94
+ return totalNanoseconds(t) % 2147483647;
95
+ }
96
+ export function op_Subtraction(left, right) {
97
+ // Returns the elapsed TimeSpan, wrapping around midnight
98
+ const ns = (totalNanoseconds(left) - totalNanoseconds(right) + nanosecondsPerDay) % nanosecondsPerDay;
99
+ return TimeSpan_fromTicks(Math.round(ns / 100));
100
+ }
101
+ export function toString(t, format = "t", _provider) {
102
+ switch (format) {
103
+ case "t":
104
+ return t.toString({ smallestUnit: "minute" });
105
+ case "r":
106
+ case "R":
107
+ case "T":
108
+ return t.toString({ smallestUnit: "second" });
109
+ case "o":
110
+ case "O":
111
+ // .NET tick precision is 7 fractional digits
112
+ return t.toString({ fractionalSecondDigits: 7 });
113
+ default:
114
+ throw new Exception("Custom formats are not supported");
115
+ }
116
+ }
117
+ export function parse(str) {
118
+ // Allowed format types:
119
+ // hh:mm
120
+ // hh:mm:ss
121
+ // hh:mm:ss.fffffff
122
+ const r = /^\s*([0-1]?\d|2[0-3])\s*:\s*([0-5]?\d)(\s*:\s*([0-5]?\d)(\.(\d+))?)?\s*$/.exec(str);
123
+ if (r != null && r[1] != null && r[2] != null) {
124
+ const h = +r[1];
125
+ const m = +r[2];
126
+ const s = r[4] != null ? +r[4] : 0;
127
+ // .NET resolves the fraction down to a single tick (7 digits) and truncates
128
+ // anything finer, so the digits are read as ticks rather than milliseconds.
129
+ const subSecondTicks = r[6] != null ? +r[6].padEnd(7, "0").substring(0, 7) : 0;
130
+ return fromNanoseconds(((h * 60 + m) * 60 + s) * 1000000000 + subSecondTicks * 100);
131
+ }
132
+ throw new Exception(`String '${str}' was not recognized as a valid TimeOnly.`);
133
+ }
134
+ export function tryParse(v, defValue) {
135
+ try {
136
+ defValue.contents = parse(v);
137
+ return true;
138
+ }
139
+ catch {
140
+ return false;
141
+ }
142
+ }
@@ -1,5 +1,5 @@
1
- import { comparePrimitives, padLeftAndRightWithZeros, padWithZeros } from "./Util.js";
2
- import { toInt64 } from "./BigInt.js";
1
+ import { Exception, comparePrimitives, padLeftAndRightWithZeros, padWithZeros } from "./Util.js";
2
+ import { toInt64, fromFloat64 } from "./BigInt.js";
3
3
  /**
4
4
  * Calls:
5
5
  * - `Math.ceil` if the `value` is **negative**
@@ -27,17 +27,20 @@ export function create(d = 0, h = 0, m = 0, s = 0, ms = 0) {
27
27
  export function fromTicks(ticks) {
28
28
  return Number(BigInt(ticks) / 10000n);
29
29
  }
30
- export function fromDays(d) {
31
- return create(d, 0, 0, 0);
30
+ export function fromDays(d, h = 0, m = 0n, s = 0n, ms = 0n) {
31
+ return create(d, h, Number(m), Number(s), Number(ms));
32
32
  }
33
- export function fromHours(h) {
34
- return create(h, 0, 0);
33
+ export function fromHours(h, m = 0n, s = 0n, ms = 0n) {
34
+ return create(0, h, Number(m), Number(s), Number(ms));
35
35
  }
36
- export function fromMinutes(m) {
37
- return create(0, m, 0);
36
+ export function fromMinutes(m, s = 0n, ms = 0n) {
37
+ return create(0, 0, Number(m), Number(s), Number(ms));
38
38
  }
39
- export function fromSeconds(s) {
40
- return create(0, 0, s);
39
+ export function fromSeconds(s, ms = 0n) {
40
+ return create(0, 0, 0, Number(s), Number(ms));
41
+ }
42
+ export function fromMilliseconds(ms) {
43
+ return Number(ms);
41
44
  }
42
45
  export function days(ts) {
43
46
  return signedRound(ts / 86400000);
@@ -55,7 +58,7 @@ export function milliseconds(ts) {
55
58
  return signedRound(ts % 1000);
56
59
  }
57
60
  export function ticks(ts) {
58
- return toInt64(BigInt(ts) * 10000n);
61
+ return toInt64(fromFloat64(ts * 10000));
59
62
  }
60
63
  export function totalDays(ts) {
61
64
  return ts / 86400000;
@@ -95,7 +98,7 @@ export function duration(x) {
95
98
  }
96
99
  export function toString(ts, format = "c", _provider) {
97
100
  if (["c", "g", "G"].indexOf(format) === -1) {
98
- throw new Error("Custom formats are not supported");
101
+ throw new Exception("Custom formats are not supported");
99
102
  }
100
103
  const d = Math.abs(days(ts));
101
104
  const h = Math.abs(hours(ts));
@@ -111,7 +114,7 @@ export function parse(str) {
111
114
  if (firstDot === -1 && firstColon === -1) { // There is only a day ex: 4
112
115
  const d = parseInt(str, 0);
113
116
  if (isNaN(d)) {
114
- throw new Error(`String '${str}' was not recognized as a valid TimeSpan.`);
117
+ throw new Exception(`String '${str}' was not recognized as a valid TimeSpan.`);
115
118
  }
116
119
  else {
117
120
  return create(d, 0, 0, 0, 0);
@@ -158,13 +161,13 @@ export function parse(str) {
158
161
  ms = +r[8] / 10000;
159
162
  break;
160
163
  default:
161
- throw new Error(`String '${str}' was not recognized as a valid TimeSpan.`);
164
+ throw new Exception(`String '${str}' was not recognized as a valid TimeSpan.`);
162
165
  }
163
166
  }
164
167
  return sign * create(d, h, m, s, ms);
165
168
  }
166
169
  }
167
- throw new Error(`String '${str}' was not recognized as a valid TimeSpan.`);
170
+ throw new Exception(`String '${str}' was not recognized as a valid TimeSpan.`);
168
171
  }
169
172
  export function tryParse(v, defValue) {
170
173
  try {
@@ -0,0 +1,259 @@
1
+ import { toInt64 } from "./BigInt.js";
2
+ import { Exception, padWithZeros } from "./Util.js";
3
+ export const Duration = Temporal.Duration;
4
+ // The generic equality/comparison/hashing helpers in Util.ts dispatch at runtime
5
+ // on .NET-style Equals/CompareTo/GetHashCode methods. Attach them so TimeSpan
6
+ // also works in generic contexts: records, tuples, erased generics, etc.
7
+ const proto = Temporal.Duration.prototype;
8
+ proto.Equals = function (other) { return Temporal.Duration.compare(this, other) === 0; };
9
+ proto.CompareTo = function (other) { return Temporal.Duration.compare(this, other); };
10
+ proto.GetHashCode = function () { return hash(this); };
11
+ // Lets String.Format format this value without String.ts importing this module (see String.ts)
12
+ proto[Symbol.for("Fable.DateTimeFormattable")] = function (format) { return toString(this, format); };
13
+ const nsPerMillisecond = 1000000n;
14
+ const nsPerSecond = 1000000000n;
15
+ const nsPerMinute = 60000000000n;
16
+ const nsPerHour = 3600000000000n;
17
+ const nsPerDay = 86400000000000n;
18
+ export function totalNanoseconds(ts) {
19
+ return BigInt(ts.days) * nsPerDay
20
+ + BigInt(ts.hours) * nsPerHour
21
+ + BigInt(ts.minutes) * nsPerMinute
22
+ + BigInt(ts.seconds) * nsPerSecond
23
+ + BigInt(ts.milliseconds) * nsPerMillisecond
24
+ + BigInt(ts.microseconds) * 1000n
25
+ + BigInt(ts.nanoseconds);
26
+ }
27
+ function fromNanoseconds(totalNs) {
28
+ const negative = totalNs < 0n;
29
+ // A .NET TimeSpan is a whole number of 100ns ticks, so anything finer than a
30
+ // tick is dropped (toward zero, as .NET does) rather than carried in the
31
+ // Duration's nanosecond field — otherwise values that cannot exist in .NET
32
+ // would leak out of Parse/FromMilliseconds/arithmetic.
33
+ let n = (negative ? -totalNs : totalNs) / 100n * 100n;
34
+ const days = Number(n / nsPerDay);
35
+ n %= nsPerDay;
36
+ const hours = Number(n / nsPerHour);
37
+ n %= nsPerHour;
38
+ const minutes = Number(n / nsPerMinute);
39
+ n %= nsPerMinute;
40
+ const seconds = Number(n / nsPerSecond);
41
+ n %= nsPerSecond;
42
+ const milliseconds = Number(n / nsPerMillisecond);
43
+ n %= nsPerMillisecond;
44
+ const microseconds = Number(n / 1000n);
45
+ n %= 1000n;
46
+ const d = new Temporal.Duration(0, 0, 0, days, hours, minutes, seconds, milliseconds, microseconds, Number(n));
47
+ return negative ? d.negated() : d;
48
+ }
49
+ // Converts a possibly fractional unit count into an exact nanosecond amount,
50
+ // keeping the integer part exact for the full Int64 tick range.
51
+ function unitToNanoseconds(value, nsPerUnit) {
52
+ const whole = Math.trunc(value);
53
+ const frac = value - whole;
54
+ return BigInt(whole) * nsPerUnit + BigInt(Math.round(frac * Number(nsPerUnit)));
55
+ }
56
+ export function create(d = 0, h = 0, m = 0, s = 0, ms = 0, us = 0) {
57
+ switch (arguments.length) {
58
+ case 1:
59
+ // ticks
60
+ return fromTicks(arguments[0]);
61
+ case 3:
62
+ // h,m,s
63
+ d = 0, h = arguments[0], m = arguments[1], s = arguments[2], ms = 0;
64
+ break;
65
+ default:
66
+ // d,h,m,s,ms,us
67
+ break;
68
+ }
69
+ return fromNanoseconds(unitToNanoseconds(d, nsPerDay) + unitToNanoseconds(h, nsPerHour) + unitToNanoseconds(m, nsPerMinute)
70
+ + unitToNanoseconds(s, nsPerSecond) + unitToNanoseconds(ms, nsPerMillisecond) + unitToNanoseconds(us, 1000n));
71
+ }
72
+ export function fromTicks(ticks) {
73
+ return fromNanoseconds(BigInt(ticks) * 100n);
74
+ }
75
+ export function zero() {
76
+ return new Temporal.Duration();
77
+ }
78
+ const ticksPerUnit = {
79
+ days: 864000000000,
80
+ hours: 36000000000,
81
+ minutes: 600000000,
82
+ seconds: 10000000,
83
+ milliseconds: 10000,
84
+ };
85
+ // The DateTime/DateTimeOffset/TimeOnly Add* members take a double and are
86
+ // tick-precise in .NET: the value is scaled to ticks and rounded, so
87
+ // AddSeconds(0.0000001) moves exactly one tick and AddDays(1.5) exactly 36 hours.
88
+ // Temporal's own `add({ days: 1.5 })` rejects non-integers, so the scaling has to
89
+ // happen here.
90
+ export function fromUnits(value, unit) {
91
+ return fromTicks(BigInt(Math.round(value * ticksPerUnit[unit])));
92
+ }
93
+ export function fromDays(d, h = 0, m = 0n, s = 0n, ms = 0n) {
94
+ return create(d, h, Number(m), Number(s), Number(ms));
95
+ }
96
+ export function fromHours(h, m = 0n, s = 0n, ms = 0n) {
97
+ return create(0, h, Number(m), Number(s), Number(ms));
98
+ }
99
+ export function fromMinutes(m, s = 0n, ms = 0n) {
100
+ return create(0, 0, Number(m), Number(s), Number(ms));
101
+ }
102
+ export function fromSeconds(s, ms = 0n) {
103
+ return create(0, 0, 0, Number(s), Number(ms));
104
+ }
105
+ export function fromMilliseconds(ms) {
106
+ return fromNanoseconds(unitToNanoseconds(Number(ms), nsPerMillisecond));
107
+ }
108
+ export function ticks(ts) {
109
+ return toInt64(totalNanoseconds(ts) / 100n);
110
+ }
111
+ // .NET computes each total as (double)Ticks / TicksPerUnit; match that exactly
112
+ // (Temporal's own .total() balances differently and can be 1 ULP off).
113
+ function totalTicks(ts) {
114
+ return Number(totalNanoseconds(ts) / 100n);
115
+ }
116
+ export function totalDays(ts) {
117
+ return totalTicks(ts) / 864000000000;
118
+ }
119
+ export function totalHours(ts) {
120
+ return totalTicks(ts) / 36000000000;
121
+ }
122
+ export function totalMinutes(ts) {
123
+ return totalTicks(ts) / 600000000;
124
+ }
125
+ export function totalSeconds(ts) {
126
+ return totalTicks(ts) / 10000000;
127
+ }
128
+ export function totalMilliseconds(ts) {
129
+ return totalTicks(ts) / 10000;
130
+ }
131
+ export function negate(ts) {
132
+ return ts.negated();
133
+ }
134
+ export function add(ts1, ts2) {
135
+ return fromNanoseconds(totalNanoseconds(ts1) + totalNanoseconds(ts2));
136
+ }
137
+ export function subtract(ts1, ts2) {
138
+ return fromNanoseconds(totalNanoseconds(ts1) - totalNanoseconds(ts2));
139
+ }
140
+ // .NET scales the tick count as a double and rounds: `new TimeSpan((long)Math
141
+ // .Round(Ticks * factor))`. Scaling ticks rather than nanoseconds keeps the
142
+ // magnitude — and so the rounding — identical to .NET's.
143
+ export function multiply(ts, factor) {
144
+ return fromTicks(BigInt(Math.round(Number(ticks(ts)) * factor)));
145
+ }
146
+ export function divide(ts, factor) {
147
+ return fromTicks(BigInt(Math.round(Number(ticks(ts)) / factor)));
148
+ }
149
+ export function divideByTimeSpan(ts, other) {
150
+ return Number(ticks(ts)) / Number(ticks(other));
151
+ }
152
+ export const op_Addition = add;
153
+ export const op_Subtraction = subtract;
154
+ export const op_Multiply = multiply;
155
+ export const op_UnaryNegation = negate;
156
+ export function compare(x, y) {
157
+ return Temporal.Duration.compare(x, y);
158
+ }
159
+ export const compareTo = compare;
160
+ export function equals(x, y) {
161
+ return Temporal.Duration.compare(x, y) === 0;
162
+ }
163
+ export function hash(ts) {
164
+ return Number(totalNanoseconds(ts) % 2147483647n);
165
+ }
166
+ export function duration(ts) {
167
+ return ts.abs();
168
+ }
169
+ export function toString(ts, format = "c", _provider) {
170
+ if (["c", "g", "G"].indexOf(format) === -1) {
171
+ throw new Exception("Custom formats are not supported");
172
+ }
173
+ const d = Math.abs(ts.days);
174
+ const h = Math.abs(ts.hours);
175
+ const m = Math.abs(ts.minutes);
176
+ const s = Math.abs(ts.seconds);
177
+ const ticks = Math.abs(ts.milliseconds) * 10000
178
+ + Math.abs(ts.microseconds) * 10
179
+ + Math.trunc(Math.abs(ts.nanoseconds) / 100);
180
+ const sign = ts.sign < 0 ? "-" : "";
181
+ const days = d === 0 && format !== "G" ? "" : format === "c" ? d + "." : d + ":";
182
+ const time = `${format === "g" ? h : padWithZeros(h, 2)}:${padWithZeros(m, 2)}:${padWithZeros(s, 2)}`;
183
+ // .NET prints seven tick digits for "c" and "G", trims trailing zeros for "g", and omits a zero fraction for "c" and "g".
184
+ const fraction = format === "g"
185
+ ? (ticks === 0 ? "" : "." + padWithZeros(ticks, 7).replace(/0+$/, ""))
186
+ : (ticks === 0 && format === "c" ? "" : "." + padWithZeros(ticks, 7));
187
+ return `${sign}${days}${time}${fraction}`;
188
+ }
189
+ export function parse(str) {
190
+ const firstDot = str.search("\\.");
191
+ const firstColon = str.search("\\:");
192
+ if (firstDot === -1 && firstColon === -1) { // There is only a day ex: 4
193
+ const d = parseInt(str, 0);
194
+ if (isNaN(d)) {
195
+ throw new Exception(`String '${str}' was not recognized as a valid TimeSpan.`);
196
+ }
197
+ else {
198
+ return create(d, 0, 0, 0, 0);
199
+ }
200
+ }
201
+ if (firstColon > 0) { // process time part
202
+ // WIP: (-?)(((\d+)\.)?([0-9]|0[0-9]|1[0-9]|2[0-3]):(\d+)(:\d+(\.\d{1,7})?)?|\d+(?:(?!\.)))
203
+ const r = /^(-?)((\d+)\.)?(?:0*)([0-9]|0[0-9]|1[0-9]|2[0-3]):(?:0*)([0-5][0-9]|[0-9])(:(?:0*)([0-5][0-9]|[0-9]))?\.?(\d+)?$/.exec(str);
204
+ if (r != null && r[4] != null && r[5] != null) {
205
+ let d = 0;
206
+ let ms = 0;
207
+ let s = 0;
208
+ const sign = r[1] != null && r[1] === "-" ? -1 : 1;
209
+ const h = +r[4];
210
+ const m = +r[5];
211
+ if (r[3] != null) {
212
+ d = +r[3];
213
+ }
214
+ if (r[7] != null) {
215
+ s = +r[7];
216
+ }
217
+ if (r[8] != null) {
218
+ // Depending on the number of decimals passed, we need to adapt the numbers
219
+ switch (r[8].length) {
220
+ case 1:
221
+ ms = +r[8] * 100;
222
+ break;
223
+ case 2:
224
+ ms = +r[8] * 10;
225
+ break;
226
+ case 3:
227
+ ms = +r[8];
228
+ break;
229
+ case 4:
230
+ ms = +r[8] / 10;
231
+ break;
232
+ case 5:
233
+ ms = +r[8] / 100;
234
+ break;
235
+ case 6:
236
+ ms = +r[8] / 1000;
237
+ break;
238
+ case 7:
239
+ ms = +r[8] / 10000;
240
+ break;
241
+ default:
242
+ throw new Exception(`String '${str}' was not recognized as a valid TimeSpan.`);
243
+ }
244
+ }
245
+ const ts = create(d, h, m, s, ms);
246
+ return sign < 0 ? negate(ts) : ts;
247
+ }
248
+ }
249
+ throw new Exception(`String '${str}' was not recognized as a valid TimeSpan.`);
250
+ }
251
+ export function tryParse(v, defValue) {
252
+ try {
253
+ defValue.contents = parse(v);
254
+ return true;
255
+ }
256
+ catch {
257
+ return false;
258
+ }
259
+ }
@@ -1,25 +1,31 @@
1
- import { combineHashCodes, compare, compareArrays, equalArrays, equals, sameConstructor, numberHash, structuralHash } from "./Util.js";
1
+ import { Exception, combineHashCodes, compare, compareArrays, equalArrays, equals, sameConstructor, numberHash, structuralHash } from "./Util.js";
2
2
  export function seqToString(self) {
3
3
  let count = 0;
4
4
  let str = "[";
5
5
  for (const x of self) {
6
6
  if (count === 0) {
7
- str += toString(x);
7
+ str += toStringQuoted(x);
8
8
  }
9
9
  else if (count === 100) {
10
10
  str += "; ...";
11
11
  break;
12
12
  }
13
13
  else {
14
- str += "; " + toString(x);
14
+ str += "; " + toStringQuoted(x);
15
15
  }
16
16
  count++;
17
17
  }
18
18
  return str + "]";
19
19
  }
20
+ // Structured (%A-style) rendering of a value used as an element/field of a
21
+ // container. F#'s structured formatting (which records, unions, lists, etc.
22
+ // use in their ToString) quotes strings, e.g. `["a"; "b"]` and `{ Name = "John" }`.
23
+ function toStringQuoted(x, callStack = 0) {
24
+ return typeof x === "string" ? "\"" + x + "\"" : toString(x, callStack);
25
+ }
20
26
  export function toString(x, callStack = 0) {
21
27
  if (x != null && typeof x === "object") {
22
- if (typeof x.toString === "function") {
28
+ if (typeof x.toString === "function" && x.toString !== Object.prototype.toString) {
23
29
  return x.toString();
24
30
  }
25
31
  else if (Symbol.iterator in x) {
@@ -29,7 +35,7 @@ export function toString(x, callStack = 0) {
29
35
  const cons = Object.getPrototypeOf(x)?.constructor;
30
36
  return cons === Object && callStack < 10
31
37
  // Same format as recordToString
32
- ? "{ " + Object.entries(x).map(([k, v]) => k + " = " + toString(v, callStack + 1)).join("\n ") + " }"
38
+ ? "{ " + Object.entries(x).map(([k, v]) => k + " = " + toStringQuoted(v, callStack + 1)).join("\n ") + " }"
33
39
  : cons?.name ?? "";
34
40
  }
35
41
  }
@@ -43,11 +49,11 @@ export function unionToString(name, fields) {
43
49
  let fieldStr;
44
50
  let withParens = true;
45
51
  if (fields.length === 1) {
46
- fieldStr = toString(fields[0]);
52
+ fieldStr = toStringQuoted(fields[0]);
47
53
  withParens = fieldStr.indexOf(" ") >= 0;
48
54
  }
49
55
  else {
50
- fieldStr = fields.map((x) => toString(x)).join(", ");
56
+ fieldStr = fields.map((x) => toStringQuoted(x)).join(", ");
51
57
  }
52
58
  return name + (withParens ? " (" : " ") + fieldStr + (withParens ? ")" : "");
53
59
  }
@@ -105,7 +111,7 @@ function recordToJSON(self) {
105
111
  return o;
106
112
  }
107
113
  function recordToString(self) {
108
- return "{ " + Object.entries(self).map(([k, v]) => k + " = " + toString(v)).join("\n ") + " }";
114
+ return "{ " + Object.entries(self).map(([k, v]) => k + " = " + toStringQuoted(v)).join("\n ") + " }";
109
115
  }
110
116
  function recordGetHashCode(self) {
111
117
  const hashes = Object.values(self).map((v) => structuralHash(v));
@@ -172,22 +178,6 @@ export class FSharpRef {
172
178
  }
173
179
  }
174
180
  // EXCEPTIONS
175
- // Exception is intentionally not derived from Error, for performance reasons (see #2160)
176
- export class Exception {
177
- constructor(message) {
178
- this.message = message;
179
- }
180
- }
181
- export function isException(x) {
182
- return x instanceof Exception || x instanceof Error;
183
- }
184
- export function isPromise(x) {
185
- return x instanceof Promise;
186
- }
187
- export function ensureErrorOrException(e) {
188
- // Exceptionally admitting promises as errors for compatibility with React.suspense (see #3298)
189
- return (isException(e) || isPromise(e)) ? e : new Error(String(e));
190
- }
191
181
  export class FSharpException extends Exception {
192
182
  toJSON() { return recordToJSON(this); }
193
183
  toString() { return recordToString(this); }